chore: modernize go sources (#24896)

This commit is contained in:
andig 2025-10-31 16:25:53 +01:00 • committed by GitHub
parent 3421e8df81
commit 352012d24b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
324 changed files with 590 additions and 583 deletions

View file

@ -53,6 +53,10 @@ docs::
lint::
golangci-lint run
go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -test -category "-omitzero" -c 0 ./...
modernize:
go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -test -category "-omitzero" -fix ./...
lint-ui::
npm run lint

View file

@ -40,7 +40,7 @@ type All struct {
Chargers []config.Named
Vehicles []config.Named
Tariffs Tariffs
Site map[string]interface{}
Site map[string]any
Loadpoints []config.Named
Circuits []config.Named
}

View file

@ -57,7 +57,7 @@ func init() {
}
// NewABBFromConfig creates a ABB charger from generic config
func NewABBFromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewABBFromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
cc := modbus.Settings{
ID: 1,
}

View file

@ -53,7 +53,7 @@ func init() {
}
// NewAblEm4FromConfig creates an ABL eM4 charger from generic config
func NewAblEm4FromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewAblEm4FromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
cc := struct {
modbus.TcpSettings `mapstructure:",squash"`
Connector uint16

View file

@ -79,7 +79,7 @@ func init() {
// https://www.goingelectric.de/forum/viewtopic.php?p=1550459#p1550459
// NewABLeMHFromConfig creates a ABLeMH charger from generic config
func NewABLeMHFromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewABLeMHFromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
cc := struct {
modbus.Settings `mapstructure:",squash"`
Timeout time.Duration

View file

@ -59,7 +59,7 @@ func init() {
//go:generate go tool decorate -f decorateAlfen -b *Alfen -r api.Charger -t "api.PhaseSwitcher,Phases1p3p,func(int) error" -t "api.PhaseGetter,GetPhases,func() (int, error)"
// NewAlfenFromConfig creates a Alfen charger from generic config
func NewAlfenFromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewAlfenFromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
cc := modbus.TcpSettings{
ID: 1,
}

View file

@ -47,7 +47,7 @@ func init() {
}
// NewAlphatecFromConfig creates a Alphatec charger from generic config
func NewAlphatecFromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewAlphatecFromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
cc := modbus.Settings{
ID: 1,
}

View file

@ -62,7 +62,7 @@ func init() {
//go:generate go tool decorate -f decorateAmperfied -b *Amperfied -r api.Charger -t "api.PhaseSwitcher,Phases1p3p,func(int) error" -t "api.PhaseGetter,GetPhases,func() (int, error)"
// NewAmperfiedFromConfig creates a Amperfied charger from generic config
func NewAmperfiedFromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewAmperfiedFromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
cc := struct {
modbus.TcpSettings `mapstructure:",squash"`
Phases1p3p bool

View file

@ -92,7 +92,7 @@ func init() {
}
// NewBenderCCFromConfig creates a BenderCC charger from generic config
func NewBenderCCFromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewBenderCCFromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
cc := struct {
modbus.TcpSettings `mapstructure:",squash"`
Cache time.Duration

View file

@ -41,7 +41,7 @@ func init() {
//go:generate go tool decorate -f decorateCfos -b *CfosPowerBrain -r api.Charger -t "api.Meter,CurrentPower,func() (float64, error)" -t "api.MeterEnergy,TotalEnergy,func() (float64, error)" -t "api.PhaseCurrents,Currents,func() (float64, float64, float64, error)" -t "api.PhaseSwitcher,Phases1p3p,func(int) error"
// NewCfosPowerBrainFromConfig creates a cFos charger from generic config
func NewCfosPowerBrainFromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewCfosPowerBrainFromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
cc := modbus.TcpSettings{
ID: 1,
}

View file

@ -28,7 +28,7 @@ func init() {
//go:generate go tool decorate -f decorateCustom -b *Charger -r api.Charger -t "api.ChargerEx,MaxCurrentMillis,func(float64) error" -t "api.Identifier,Identify,func() (string, error)" -t "api.PhaseSwitcher,Phases1p3p,func(int) error" -t "api.Resurrector,WakeUp,func() error" -t "api.Battery,Soc,func() (float64, error)" -t "api.SocLimiter,GetLimitSoc,func() (int64, error)" -t "api.Meter,CurrentPower,func() (float64, error)" -t "api.MeterEnergy,TotalEnergy,func() (float64, error)" -t "api.PhaseCurrents,Currents,func() (float64, float64, float64, error)" -t "api.PhaseVoltages,Voltages,func() (float64, float64, float64, error)"
// NewConfigurableFromConfig creates a new configurable charger
func NewConfigurableFromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewConfigurableFromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
var cc struct {
embed `mapstructure:",squash"`
Status, Enable, Enabled, MaxCurrent plugin.Config

View file

@ -61,7 +61,7 @@ func init() {
}
// NewCompleoFromConfig creates a Compleo charger from generic config
func NewCompleoFromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewCompleoFromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
cc := struct {
Connector uint16
modbus.TcpSettings `mapstructure:",squash"`

View file

@ -15,6 +15,6 @@ func Types() []string {
}
// NewFromConfig creates charger from configuration
func NewFromConfig(ctx context.Context, typ string, other map[string]interface{}) (api.Charger, error) {
func NewFromConfig(ctx context.Context, typ string, other map[string]any) (api.Charger, error) {
return config.NewFromConfig(ctx, typ, other)
}

View file

@ -12,7 +12,7 @@ import (
var Registry = reg.New[api.Charger]("charger")
// NewFromConfig creates charger from configuration
func NewFromConfig(ctx context.Context, typ string, other map[string]interface{}) (api.Charger, error) {
func NewFromConfig(ctx context.Context, typ string, other map[string]any) (api.Charger, error) {
factory, err := Registry.Get(strings.ToLower(typ))
if err != nil {
return nil, err

View file

@ -43,7 +43,7 @@ func init() {
}
// NewConnectIqFromConfig creates a ConnectIq charger from generic config
func NewConnectIqFromConfig(other map[string]interface{}) (api.Charger, error) {
func NewConnectIqFromConfig(other map[string]any) (api.Charger, error) {
cc := struct {
URI string
Cache time.Duration

View file

@ -41,7 +41,7 @@ func init() {
}
// NewDadapowerFromConfig creates a Dadapower charger from generic config
func NewDadapowerFromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewDadapowerFromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
cc := modbus.TcpSettings{}
if err := util.DecodeOther(other, &cc); err != nil {

View file

@ -67,7 +67,7 @@ func init() {
//go:generate go tool decorate -f decorateDaheimLaden -b *DaheimLaden -r api.Charger -t "api.PhaseSwitcher,Phases1p3p,func(int) error" -t "api.PhaseGetter,GetPhases,func() (int, error)"
// NewDaheimLadenFromConfig creates a DaheimLaden charger from generic config
func NewDaheimLadenFromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewDaheimLadenFromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
cc := struct {
modbus.TcpSettings `mapstructure:",squash"`
Phases1p3p bool

View file

@ -64,7 +64,7 @@ func init() {
}
// NewDeltaFromConfig creates a Delta charger from generic config
func NewDeltaFromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewDeltaFromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
cc := struct {
Connector uint16
modbus.Settings `mapstructure:",squash"`

View file

@ -74,7 +74,7 @@ func init() {
}
// NewEaseeFromConfig creates a Easee charger from generic config
func NewEaseeFromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewEaseeFromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
cc := struct {
User string
Password string
@ -202,7 +202,7 @@ func NewEasee(ctx context.Context, user, password, charger string, timeout time.
}
func (c *Easee) waitForOptionalState() {
for i := 0; i < 30; i++ {
for range 30 {
if c.optionalStatePresent() {
return
}

View file

@ -10,7 +10,7 @@ import (
// Logger is a simple logger interface
type Logger interface {
Println(v ...interface{})
Println(v ...any)
}
type logger struct {
@ -23,7 +23,7 @@ func SignalrLogger(log Logger) signalr.StructuredLogger {
var skipped = []string{"ts", "class", "hub", "protocol", "value"}
func (l *logger) Log(keyVals ...interface{}) error {
func (l *logger) Log(keyVals ...any) error {
b := new(strings.Builder)
var skip bool

View file

@ -13,7 +13,7 @@ type Observation struct {
Value string
}
func (o *Observation) TypedValue() (interface{}, error) {
func (o *Observation) TypedValue() (any, error) {
switch o.DataType {
case Boolean:
return o.Value == "1", nil

View file

@ -54,7 +54,7 @@ func init() {
}
// NewEEBusFromConfig creates an EEBus charger from generic config
func NewEEBusFromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewEEBusFromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
var cc struct {
Ski string
Ip string

View file

@ -59,7 +59,7 @@ func init() {
}
// NewEm2GoDuoFromConfig creates a Em2GoDuo charger from generic config
func NewEm2GoDuoFromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewEm2GoDuoFromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
cc := struct {
modbus.TcpSettings `mapstructure:",squash"`
Connector int

View file

@ -72,7 +72,7 @@ func init() {
//go:generate go tool decorate -f decorateEm2Go -b *Em2Go -r api.Charger -t "api.ChargerEx,MaxCurrentMillis,func(float64) error" -t "api.PhaseSwitcher,Phases1p3p,func(int) error" -t "api.PhaseGetter,GetPhases,func() (int, error)"
// NewEm2GoFromConfig creates a Em2Go charger from generic config
func NewEm2GoFromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewEm2GoFromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
cc := struct {
modbus.TcpSettings `mapstructure:",squash"`
Connector int // TODO remove deprecated
@ -371,7 +371,7 @@ func (wb *Em2Go) Diagnose() {
fmt.Printf("\tCable Max. Current:\t%.1fA\n", float64(binary.BigEndian.Uint16(b)/10))
}
var serial []byte
for reg := 0; reg < 8; reg++ {
for reg := range 8 {
b, err := wb.conn.ReadHoldingRegisters(em2GoRegSerial+2*uint16(reg), 2)
if err != nil {
return

View file

@ -64,7 +64,7 @@ func init() {
}
// NewEtrelFromConfig creates a Etrel charger from generic config
func NewEtrelFromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewEtrelFromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
cc := struct {
Connector int
modbus.TcpSettings `mapstructure:",squash"`

View file

@ -90,7 +90,7 @@ type EVECUBELastStatusPacket struct {
// EVECUBEAutomationStatus is the /api/admin/automation/status response
type EVECUBEAutomationStatus struct {
Connectors map[string]interface{} `json:"connectors"`
Connectors map[string]any `json:"connectors"`
AuthTag struct {
Tag string `json:"tag"`
} `json:"authTag"`
@ -98,11 +98,11 @@ type EVECUBEAutomationStatus struct {
// EVECUBEUnitConfigRequest is the request body for /api/admin/unitconfig POST
type EVECUBEUnitConfigRequest struct {
Values map[string]interface{} `json:"values"`
Values map[string]any `json:"values"`
}
// NewEVECUBEFromConfig creates a EVECUBE charger from generic config
func NewEVECUBEFromConfig(other map[string]interface{}) (api.Charger, error) {
func NewEVECUBEFromConfig(other map[string]any) (api.Charger, error) {
cc := struct {
URI string
User string
@ -276,7 +276,7 @@ func (wb *EVECUBE) MaxCurrent(current int64) error {
// setValue sets a named value via admin API
func (wb *EVECUBE) setValue(key string, value int64) error {
reqBody := EVECUBEUnitConfigRequest{
Values: map[string]interface{}{
Values: map[string]any{
key: value,
},
}
@ -296,7 +296,7 @@ func (wb *EVECUBE) setValue(key string, value int64) error {
req.SetBasicAuth(wb.user, wb.pass)
}
var resp map[string]interface{}
var resp map[string]any
if err := wb.DoJSON(req, &resp); err != nil {
return err
}

View file

@ -32,7 +32,7 @@ func init() {
// https://www.evracing.cz/user/documents/upload/EVSE-WB-DIN_latest.pdf
// NewEvseDINFromConfig creates an EVSE DIN charger from generic config
func NewEvseDINFromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewEvseDINFromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
cc := modbus.Settings{
Baudrate: 9600,
Comset: "8N1",

View file

@ -30,7 +30,7 @@ func init() {
//go:generate go tool decorate -f decorateEVSE -b *EVSEWifi -r api.Charger -t "api.Meter,CurrentPower,func() (float64, error)" -t "api.MeterEnergy,TotalEnergy,func() (float64, error)" -t "api.PhaseCurrents,Currents,func() (float64, float64, float64, error)" -t "api.PhaseVoltages,Voltages,func() (float64, float64, float64, error)" -t "api.ChargerEx,MaxCurrentMillis,func(float64) error" -t "api.Identifier,Identify,func() (string, error)"
// NewEVSEWifiFromConfig creates a EVSEWifi charger from generic config
func NewEVSEWifiFromConfig(other map[string]interface{}) (api.Charger, error) {
func NewEVSEWifiFromConfig(other map[string]any) (api.Charger, error) {
cc := struct {
URI string
Meter struct {

View file

@ -15,9 +15,9 @@ func TestEvseWifi(t *testing.T) {
}))
defer ts.Close()
wb, err := NewEVSEWifiFromConfig(map[string]interface{}{
wb, err := NewEVSEWifiFromConfig(map[string]any{
"uri": ts.URL,
"meter": map[string]interface{}{
"meter": map[string]any{
"power": true,
"energy": true,
"currents": true,
@ -51,7 +51,7 @@ func TestEvseWifiEx(t *testing.T) {
}))
defer ts.Close()
wb, err := NewEVSEWifiFromConfig(map[string]interface{}{
wb, err := NewEVSEWifiFromConfig(map[string]any{
"uri": ts.URL,
})
if err != nil {

View file

@ -23,7 +23,7 @@ func init() {
}
// NewFritzDECTFromConfig creates a fritzdect charger from generic config
func NewFritzDECTFromConfig(other map[string]interface{}) (api.Charger, error) {
func NewFritzDECTFromConfig(other map[string]any) (api.Charger, error) {
var cc struct {
embed `mapstructure:",squash"`
fritzdect.Settings `mapstructure:",squash"`

View file

@ -22,7 +22,7 @@ func init() {
}
// NewWattpilotFromConfig creates a wattpilot charger from generic config
func NewWattpilotFromConfig(other map[string]interface{}) (api.Charger, error) {
func NewWattpilotFromConfig(other map[string]any) (api.Charger, error) {
var cc struct {
URI string
Password string

View file

@ -38,10 +38,10 @@ type GoE struct {
}
func init() {
registry.Add("go-e", func(other map[string]interface{}) (api.Charger, error) {
registry.Add("go-e", func(other map[string]any) (api.Charger, error) {
return newGoEFromConfig(true, other)
})
registry.Add("go-e-v3", func(other map[string]interface{}) (api.Charger, error) {
registry.Add("go-e-v3", func(other map[string]any) (api.Charger, error) {
return newGoEFromConfig(false, other)
})
}
@ -49,7 +49,7 @@ func init() {
//go:generate go tool decorate -f decorateGoE -b *GoE -r api.Charger -t "api.ChargeRater,ChargedEnergy,func() (float64, error)" -t "api.PhaseSwitcher,Phases1p3p,func(int) error"
// newGoEFromConfig creates a go-e charger from generic config
func newGoEFromConfig(v2 bool, other map[string]interface{}) (api.Charger, error) {
func newGoEFromConfig(v2 bool, other map[string]any) (api.Charger, error) {
cc := struct {
Token string
URI string

View file

@ -24,7 +24,7 @@ type Response interface {
Identify() string
}
type UpdateResponse map[string]interface{}
type UpdateResponse map[string]any
type API interface {
IsV2() bool
@ -78,7 +78,7 @@ func (c *LocalAPI) IsV2() bool {
}
// response returns a v1/v2 api response
func (c *LocalAPI) response(partial string, res interface{}) error {
func (c *LocalAPI) response(partial string, res any) error {
url := fmt.Sprintf("%s/%s", c.uri, partial)
return c.GetJSON(url, &res)
}

View file

@ -52,7 +52,7 @@ func init() {
}
// NewHardyBarthFromConfig creates a HardyBarth cPH1 charger from generic config
func NewHardyBarthFromConfig(other map[string]interface{}) (api.Charger, error) {
func NewHardyBarthFromConfig(other map[string]any) (api.Charger, error) {
cc := struct {
URI string
ChargeControl int

View file

@ -56,7 +56,7 @@ func init() {
//go:generate go tool decorate -f decorateSalia -b *Salia -r api.Charger -t "api.Meter,CurrentPower,func() (float64, error)" -t "api.MeterEnergy,TotalEnergy,func() (float64, error)" -t "api.PhaseCurrents,Currents,func() (float64, float64, float64, error)" -t "api.PhaseSwitcher,Phases1p3p,func(int) error" -t "api.PhaseGetter,GetPhases,func() (int, error)"
// NewSaliaFromConfig creates a Salia cPH2 charger from generic config
func NewSaliaFromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewSaliaFromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
cc := struct {
URI string
User string

View file

@ -43,7 +43,7 @@ func init() {
//go:generate go tool decorate -f decorateHeatpump -b *Heatpump -r api.Charger -t "api.Meter,CurrentPower,func() (float64, error)" -t "api.MeterEnergy,TotalEnergy,func() (float64, error)" -t "api.Battery,Soc,func() (float64, error)" -t "api.SocLimiter,GetLimitSoc,func() (int64, error)"
// NewHeatpumpFromConfig creates heatpump configurable charger from generic config
func NewHeatpumpFromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewHeatpumpFromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
cc := struct {
embed `mapstructure:",squash"`
SetMaxPower plugin.Config

View file

@ -61,7 +61,7 @@ func init() {
// https://cdn.shopify.com/s/files/1/0101/2409/9669/files/heidelberg-energy-control-modbus.pdf (older)
// NewHeidelbergECFromConfig creates a HeidelbergEC charger from generic config
func NewHeidelbergECFromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewHeidelbergECFromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
cc := modbus.Settings{
ID: 1,
}

View file

@ -60,7 +60,7 @@ func init() {
}
// NewHesotecFromConfig creates a Hesotec charger from generic config
func NewHesotecFromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewHesotecFromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
cc := modbus.TcpSettings{
ID: 1,
}

View file

@ -19,7 +19,7 @@ func init() {
registry.Add("homeassistant-switch", NewHomeAssistantSwitchFromConfig)
}
func NewHomeAssistantSwitchFromConfig(other map[string]interface{}) (api.Charger, error) {
func NewHomeAssistantSwitchFromConfig(other map[string]any) (api.Charger, error) {
var cc struct {
embed `mapstructure:",squash"`
URI string

View file

@ -26,7 +26,7 @@ func init() {
}
// NewHomeAssistantFromConfig creates a HomeAssistant charger from generic config
func NewHomeAssistantFromConfig(other map[string]interface{}) (api.Charger, error) {
func NewHomeAssistantFromConfig(other map[string]any) (api.Charger, error) {
cc := struct {
URI string
Token string

View file

@ -19,7 +19,7 @@ func init() {
}
// NewCCUFromConfig creates a Homematic charger from generic config
func NewCCUFromConfig(other map[string]interface{}) (api.Charger, error) {
func NewCCUFromConfig(other map[string]any) (api.Charger, error) {
cc := struct {
embed `mapstructure:",squash"`
URI string

View file

@ -23,7 +23,7 @@ func init() {
}
// NewHomeWizardFromConfig creates a HomeWizard charger from generic config
func NewHomeWizardFromConfig(other map[string]interface{}) (api.Charger, error) {
func NewHomeWizardFromConfig(other map[string]any) (api.Charger, error) {
cc := struct {
embed `mapstructure:",squash"`
URI string

View file

@ -56,7 +56,7 @@ func init() {
}
// NewInnogyFromConfig creates a Innogy charger from generic config
func NewInnogyFromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewInnogyFromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
cc := modbus.TcpSettings{
ID: 1,
}

View file

@ -75,7 +75,7 @@ func init() {
//go:generate go tool decorate -f decorateKeba -b *Keba -r api.Charger -t "api.Meter,CurrentPower,func() (float64, error)" -t "api.MeterEnergy,TotalEnergy,func() (float64, error)" -t "api.PhaseCurrents,Currents,func() (float64, float64, float64, error)" -t "api.Identifier,Identify,func() (string, error)" -t "api.StatusReasoner,StatusReason,func() (api.Reason, error)" -t "api.PhaseSwitcher,Phases1p3p,func(int) error" -t "api.PhaseGetter,GetPhases,func() (int, error)"
// NewKebaFromConfig creates a new Keba ModbusTCP charger
func NewKebaFromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewKebaFromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
cc := struct {
embed `mapstructure:",squash"`
modbus.TcpSettings `mapstructure:",squash"`

View file

@ -35,7 +35,7 @@ func init() {
//go:generate go tool decorate -f decorateKebaUdp -b *KebaUdp -r api.Charger -t "api.Meter,CurrentPower,func() (float64, error)" -t "api.MeterEnergy,TotalEnergy,func() (float64, error)" -t "api.PhaseCurrents,Currents,func() (float64, float64, float64, error)"
// NewKebaUdpFromConfig creates a new Keba UDP charger
func NewKebaUdpFromConfig(other map[string]interface{}) (api.Charger, error) {
func NewKebaUdpFromConfig(other map[string]any) (api.Charger, error) {
cc := struct {
URI string
Serial string
@ -124,7 +124,7 @@ func (c *KebaUdp) receive(report int, resC chan<- keba.UDPMsg, errC chan<- error
}
}
func (c *KebaUdp) roundtrip(msg string, report int, res interface{}) error {
func (c *KebaUdp) roundtrip(msg string, report int, res any) error {
resC := make(chan keba.UDPMsg)
errC := make(chan error)
closeC := make(chan struct{})

View file

@ -57,7 +57,7 @@ func init() {
}
// NewKSEFromConfig creates a KSE charger from generic config
func NewKSEFromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewKSEFromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
cc := modbus.Settings{
ID: 100,
Baudrate: 9600,

View file

@ -68,7 +68,7 @@ func init() {
}
// NewMennekesCompactFromConfig creates a new Mennekes ModbusTCP charger
func NewMennekesCompactFromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewMennekesCompactFromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
cc := struct {
modbus.Settings `mapstructure:",squash"`
Timeout time.Duration

View file

@ -53,7 +53,7 @@ func init() {
}
// NewMennekesHcc3FromConfig creates a Mennekes mennekesHcc3 charger from generic config
func NewMennekesHcc3FromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewMennekesHcc3FromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
cc := modbus.TcpSettings{
ID: 255,
}

View file

@ -60,22 +60,22 @@ var elwaStandbyPower uint16 = 10
func init() {
// https://github.com/evcc-io/evcc/discussions/12761
registry.AddCtx("ac-elwa-2", func(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
registry.AddCtx("ac-elwa-2", func(ctx context.Context, other map[string]any) (api.Charger, error) {
return newMyPvFromConfig(ctx, "ac-elwa-2", other, 2)
})
// https: // github.com/evcc-io/evcc/issues/18020
registry.AddCtx("ac-thor", func(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
registry.AddCtx("ac-thor", func(ctx context.Context, other map[string]any) (api.Charger, error) {
return newMyPvFromConfig(ctx, "ac-thor", other, 9)
})
registry.AddCtx("ac-elwa-e", func(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
registry.AddCtx("ac-elwa-e", func(ctx context.Context, other map[string]any) (api.Charger, error) {
return newMyPvFromConfig(ctx, "ac-elwa-e", other, 2)
})
}
// newMyPvFromConfig creates a MyPv charger from generic config
func newMyPvFromConfig(ctx context.Context, name string, other map[string]interface{}, statusC uint16) (api.Charger, error) {
func newMyPvFromConfig(ctx context.Context, name string, other map[string]any, statusC uint16) (api.Charger, error) {
cc := struct {
modbus.TcpSettings `mapstructure:",squash"`
TempSource int

View file

@ -24,7 +24,7 @@ type MyStrom struct {
}
// NewMyStromFromConfig creates a myStrom charger from generic config
func NewMyStromFromConfig(other map[string]interface{}) (api.Charger, error) {
func NewMyStromFromConfig(other map[string]any) (api.Charger, error) {
cc := struct {
embed `mapstructure:",squash"`
URI string

View file

@ -13,6 +13,6 @@ func init() {
}
// NewNRGKickBLEFromConfig creates a NRGKickBLE charger from generic config
func NewNRGKickBLEFromConfig(other map[string]interface{}) (api.Charger, error) {
func NewNRGKickBLEFromConfig(other map[string]any) (api.Charger, error) {
return nil, errors.New("NRGKick bluetooth is only supported on linux")
}

View file

@ -31,7 +31,7 @@ func init() {
}
// NewNRGKickConnectFromConfig creates a NRGKickConnect charger from generic config
func NewNRGKickConnectFromConfig(other map[string]interface{}) (api.Charger, error) {
func NewNRGKickConnectFromConfig(other map[string]any) (api.Charger, error) {
cc := struct {
URI, Mac, Password string
Cache time.Duration
@ -84,7 +84,7 @@ func (nrg *NRGKickConnect) apiURL(api string) string {
return fmt.Sprintf("%s/api/%s/%s", nrg.uri, api, nrg.mac)
}
func (nrg *NRGKickConnect) putJSON(url string, data interface{}) error {
func (nrg *NRGKickConnect) putJSON(url string, data any) error {
req, err := request.New(http.MethodPut, url, request.MarshalJSON(data), request.JSONEncoding)
if err != nil {
return err

View file

@ -52,7 +52,7 @@ func init() {
//go:generate go tool decorate -f decorateNRGKickGen2 -b *NRGKickGen2 -r api.Charger -t "api.PhaseSwitcher,Phases1p3p,func(int) error"
// NewNRGKickGen2FromConfig creates a NRGKickGen2 charger from generic config
func NewNRGKickGen2FromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewNRGKickGen2FromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
cc := struct {
modbus.TcpSettings `mapstructure:",squash"`
Phases1p3p bool

View file

@ -29,7 +29,7 @@ func init() {
}
// NewOboFromConfig creates a OBO Bettermann charger from generic config
func NewOboFromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewOboFromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
cc := modbus.Settings{
Baudrate: 19200,
Comset: "8E1",

View file

@ -56,7 +56,7 @@ func init() {
}
// NewOCPPFromConfig creates a OCPP charger from generic config
func NewOCPPFromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewOCPPFromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
cc := struct {
StationId string
IdTag string

View file

@ -174,7 +174,7 @@ func (cp *CP) HasMeasurement(val types.Measurand) bool {
func (cp *CP) tryMeasurands(measurands string, key string) []string {
var accepted []string
for _, m := range strings.Split(measurands, ",") {
for m := range strings.SplitSeq(measurands, ",") {
if err := cp.ChangeConfigurationRequest(key, m); err == nil {
accepted = append(accepted, m)
}

View file

@ -31,26 +31,26 @@ func (cs *CS) print(s string) {
}
}
func (cs *CS) Debug(args ...interface{}) {
func (cs *CS) Debug(args ...any) {
cs.print(fmt.Sprintln(args...))
}
func (cs *CS) Debugf(f string, args ...interface{}) {
func (cs *CS) Debugf(f string, args ...any) {
cs.print(fmt.Sprintf(f, args...))
}
func (cs *CS) Info(args ...interface{}) {
func (cs *CS) Info(args ...any) {
cs.print(fmt.Sprintln(args...))
}
func (cs *CS) Infof(f string, args ...interface{}) {
func (cs *CS) Infof(f string, args ...any) {
cs.print(fmt.Sprintf(f, args...))
}
func (cs *CS) Error(args ...interface{}) {
func (cs *CS) Error(args ...any) {
cs.print(fmt.Sprintln(args...))
}
func (cs *CS) Errorf(f string, args ...interface{}) {
func (cs *CS) Errorf(f string, args ...any) {
cs.print(fmt.Sprintf(f, args...))
}

View file

@ -32,7 +32,7 @@ func Instance() *CS {
dispatcher.SetTimeout(Timeout)
endpoint := ocppj.NewServer(server, dispatcher, nil, core.Profile, remotetrigger.Profile, smartcharging.Profile, security.Profile)
endpoint.SetInvalidMessageHook(func(client ws.Channel, err *ocpp.Error, rawMessage string, parsedFields []interface{}) *ocpp.Error {
endpoint.SetInvalidMessageHook(func(client ws.Channel, err *ocpp.Error, rawMessage string, parsedFields []any) *ocpp.Error {
log.ERROR.Printf("%v (%s)", err, rawMessage)
return nil
})

View file

@ -14,15 +14,15 @@ func print(t *testing.T, s string) {
t.Log((time.Now().Format(time.DateTime)), s)
}
func (l *ocppLogger) Debug(args ...interface{}) { print(l.t, fmt.Sprint(args...)) }
func (l *ocppLogger) Debugf(format string, args ...interface{}) {
func (l *ocppLogger) Debug(args ...any) { print(l.t, fmt.Sprint(args...)) }
func (l *ocppLogger) Debugf(format string, args ...any) {
print(l.t, fmt.Sprintf(format, args...))
}
func (l *ocppLogger) Info(args ...interface{}) { print(l.t, fmt.Sprint(args...)) }
func (l *ocppLogger) Infof(format string, args ...interface{}) {
func (l *ocppLogger) Info(args ...any) { print(l.t, fmt.Sprint(args...)) }
func (l *ocppLogger) Infof(format string, args ...any) {
print(l.t, fmt.Sprintf(format, args...))
}
func (l *ocppLogger) Error(args ...interface{}) { print(l.t, fmt.Sprint(args...)) }
func (l *ocppLogger) Errorf(format string, args ...interface{}) {
func (l *ocppLogger) Error(args ...any) { print(l.t, fmt.Sprint(args...)) }
func (l *ocppLogger) Errorf(format string, args ...any) {
print(l.t, fmt.Sprintf(format, args...))
}

View file

@ -31,7 +31,7 @@ func init() {
//go:generate go tool decorate -f decorateOpenEVSE -b *OpenEVSE -r api.Charger -t "api.PhaseSwitcher,Phases1p3p,func(int) error"
// NewOpenEVSEFromConfig creates an OpenEVSE charger from generic config
func NewOpenEVSEFromConfig(other map[string]interface{}) (api.Charger, error) {
func NewOpenEVSEFromConfig(other map[string]any) (api.Charger, error) {
cc := struct {
URI string
User string

View file

@ -44,7 +44,7 @@ func init() {
//go:generate go tool decorate -f decorateOpenWB20 -b *OpenWB20 -r api.Charger -t "api.PhaseSwitcher,Phases1p3p,func(int) error" -t "api.Identifier,Identify,func() (string, error)"
// NewOpenWB20FromConfig creates a OpenWB20 charger from generic config
func NewOpenWB20FromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewOpenWB20FromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
cc := struct {
Connector uint16
Phases1p3p bool

View file

@ -29,7 +29,7 @@ type OpenWBPro struct {
}
// NewOpenWBProFromConfig creates a OpenWBPro charger from generic config
func NewOpenWBProFromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewOpenWBProFromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
cc := struct {
URI string
Cache time.Duration

View file

@ -33,7 +33,7 @@ type OpenWB struct {
//go:generate go tool decorate -f decorateOpenWB -b *OpenWB -r api.Charger -t "api.PhaseSwitcher,Phases1p3p,func(int) error" -t "api.Battery,Soc,func() (float64, error)"
// NewOpenWBFromConfig creates a new configurable charger
func NewOpenWBFromConfig(other map[string]interface{}) (api.Charger, error) {
func NewOpenWBFromConfig(other map[string]any) (api.Charger, error) {
cc := struct {
mqtt.Config `mapstructure:",squash"`
Topic string

View file

@ -21,7 +21,7 @@ func init() {
}
// NewPantaboxFromConfig creates a Pantabox charger from generic config
func NewPantaboxFromConfig(other map[string]interface{}) (api.Charger, error) {
func NewPantaboxFromConfig(other map[string]any) (api.Charger, error) {
var cc struct {
URI string
}

View file

@ -33,7 +33,7 @@ func init() {
//go:generate go tool decorate -f decoratePCE -b *PCElectric -r api.Charger -t "api.Meter,CurrentPower,func() (float64, error)" -t "api.MeterEnergy,TotalEnergy,func() (float64, error)" -t "api.PhaseCurrents,Currents,func() (float64, float64, float64, error)"
// NewPCElectricFromConfig creates a PCElectric charger from generic config
func NewPCElectricFromConfig(other map[string]interface{}) (api.Charger, error) {
func NewPCElectricFromConfig(other map[string]any) (api.Charger, error) {
cc := struct {
URI string
SlaveIndex int

View file

@ -41,7 +41,7 @@ type Status struct {
NrOfPhases int // 1,
TwinSerial int // -1,
}
TwinCharger interface{}
TwinCharger any
}
// /servlet/rest/chargebox/slaves/false

View file

@ -74,7 +74,7 @@ func init() {
//go:generate go tool decorate -f decoratePeblar -b *Peblar -r api.Charger -t "api.PhaseSwitcher,Phases1p3p,func(int) error" -t "api.PhaseGetter,GetPhases,func() (int, error)"
// NewPeblarFromConfig creates a Peblar charger from generic config
func NewPeblarFromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewPeblarFromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
cc := modbus.TcpSettings{
ID: 255,
}

View file

@ -50,7 +50,7 @@ func init() {
//go:generate go tool decorate -f decoratePhoenixCharx -b *PhoenixCharx -r api.Charger -t "api.Meter,CurrentPower,func() (float64, error)" -t "api.MeterEnergy,TotalEnergy,func() (float64, error)" -t "api.PhaseCurrents,Currents,func() (float64, float64, float64, error)" -t "api.PhaseVoltages,Voltages,func() (float64, float64, float64, error)"
// NewPhoenixCharxFromConfig creates a Phoenix charger from generic config
func NewPhoenixCharxFromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewPhoenixCharxFromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
cc := struct {
modbus.TcpSettings `mapstructure:",squash"`
Connector uint16

View file

@ -37,7 +37,7 @@ func init() {
//go:generate go tool decorate -f decoratePhoenixEMEth -b *PhoenixEMEth -r api.Charger -t "api.Meter,CurrentPower,func() (float64, error)" -t "api.MeterEnergy,TotalEnergy,func() (float64, error)" -t "api.PhaseCurrents,Currents,func() (float64, float64, float64, error)" -t "api.PhaseVoltages,Voltages,func() (float64, float64, float64, error)"
// NewPhoenixEMEthFromConfig creates a Phoenix charger from generic config
func NewPhoenixEMEthFromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewPhoenixEMEthFromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
cc := modbus.TcpSettings{
ID: 180,
}

View file

@ -65,7 +65,7 @@ func init() {
//go:generate go tool decorate -f decoratePhoenixEVEth -b *PhoenixEVEth -r api.Charger -t "api.Meter,CurrentPower,func() (float64, error)" -t "api.MeterEnergy,TotalEnergy,func() (float64, error)" -t "api.PhaseCurrents,Currents,func() (float64, float64, float64, error)" -t "api.PhaseVoltages,Voltages,func() (float64, float64, float64, error)" -t "api.ChargerEx,MaxCurrentMillis,func(float64) error" -t "api.Identifier,Identify,func() (string, error)"
// NewPhoenixEVEthFromConfig creates a PhoenixEVEth charger from generic config
func NewPhoenixEVEthFromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewPhoenixEVEthFromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
cc := modbus.TcpSettings{
ID: 255,
}

View file

@ -26,7 +26,7 @@ func init() {
}
// NewPhoenixEVSerFromConfig creates a Phoenix charger from generic config
func NewPhoenixEVSerFromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewPhoenixEVSerFromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
cc := modbus.Settings{
ID: 1,
}

View file

@ -51,7 +51,7 @@ func init() {
}
// NewPlugchoiceFromConfig creates a Plugchoice charger from generic config
func NewPlugchoiceFromConfig(other map[string]interface{}) (api.Charger, error) {
func NewPlugchoiceFromConfig(other map[string]any) (api.Charger, error) {
cc := struct {
URI string
UUID string // kept for backward compatibility

View file

@ -51,7 +51,7 @@ func init() {
}
// NewPrachtAlphaFromConfig creates a PrachtAlpha charger from generic config
func NewPrachtAlphaFromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewPrachtAlphaFromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
cc := struct {
Connector uint16
modbus.Settings `mapstructure:",squash"`

View file

@ -54,7 +54,7 @@ func init() {
//go:generate go tool decorate -f decoratePulsares -b *Pulsares -r api.Charger -t "api.PhaseSwitcher,Phases1p3p,func(int) error"
// NewPulsaresFromConfig creates a Pulsares charger from generic config
func NewPulsaresFromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewPulsaresFromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
cc := modbus.Settings{
ID: 1,
}

View file

@ -96,7 +96,7 @@ func init() {
}
// NewPulsatrixFromConfig creates a pulsatrix charger from generic config
func NewPulsatrixFromConfig(other map[string]interface{}) (api.Charger, error) {
func NewPulsatrixFromConfig(other map[string]any) (api.Charger, error) {
var cc struct {
Host string
}
@ -173,7 +173,7 @@ func (c *Pulsatrix) connect() error {
// sync attempts synchronization with retry mechanism
func (c *Pulsatrix) sync() error {
for i := 0; i < syncRetries; i++ {
for i := range syncRetries {
if err := c.Enable(false); err == nil {
return nil
}

View file

@ -62,7 +62,7 @@ func init() {
// https://download.schneider-electric.com/files?p_enDocType=Other+technical+guide&p_File_Name=GEX1969300-04.pdf&p_Doc_Ref=GEX1969300
// NewSchneiderV3FromConfig creates a Schneider charger from generic config
func NewSchneiderV3FromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewSchneiderV3FromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
cc := modbus.TcpSettings{
ID: 255,
}

View file

@ -51,7 +51,7 @@ func init() {
}
// NewSEMPFromConfig creates a SEMP charger from generic config
func NewSEMPFromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewSEMPFromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
cc := struct {
URI string
DeviceID string

View file

@ -255,8 +255,7 @@ func TestSEMPCharger(t *testing.T) {
server := httptest.NewServer(handler)
defer server.Close()
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
ctx := t.Context()
wb, err := NewSEMP(ctx, server.URL+"/semp", "F-12345678-ABCDEF123456-00", time.Second)
require.NoError(t, err)
@ -323,8 +322,7 @@ func TestSEMPChargerOff(t *testing.T) {
server := httptest.NewServer(handler)
defer server.Close()
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
ctx := t.Context()
wb, err := NewSEMP(ctx, server.URL+"/semp", "F-12345678-ABCDEF123456-00", time.Second)
require.NoError(t, err)
@ -376,8 +374,7 @@ func TestSEMPChargerReady(t *testing.T) {
server := httptest.NewServer(handler)
defer server.Close()
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
ctx := t.Context()
wb, err := NewSEMP(ctx, server.URL+"/semp", "F-12345678-ABCDEF123456-00", time.Second)
require.NoError(t, err)
@ -405,8 +402,7 @@ func TestSEMPChargerPhases1p3p(t *testing.T) {
server := httptest.NewServer(handler)
defer server.Close()
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
ctx := t.Context()
wb, err := NewSEMP(ctx, server.URL+"/semp", "F-12345678-ABCDEF123456-00", time.Second)
require.NoError(t, err)
@ -450,8 +446,7 @@ func TestSEMPChargerChargedEnergy(t *testing.T) {
server := httptest.NewServer(handler)
defer server.Close()
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
ctx := t.Context()
wb, err := NewSEMP(ctx, server.URL+"/semp", "F-12345678-ABCDEF123456-00", time.Second)
require.NoError(t, err)
@ -496,8 +491,7 @@ func TestSEMPChargerAutoDetectDeviceID(t *testing.T) {
server := httptest.NewServer(handler)
defer server.Close()
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
ctx := t.Context()
// Create charger without deviceID - should auto-detect
wb, err := NewSEMP(ctx, server.URL+"/semp", "", time.Second)

View file

@ -15,7 +15,7 @@ func init() {
}
// NewSgReadyBoostFromConfig creates an SG Ready charger with boost relay from generic config
func NewSgReadyBoostFromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewSgReadyBoostFromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
cc := struct {
embed `mapstructure:",squash"`
Charger config.Typed

View file

@ -55,7 +55,7 @@ const (
//go:generate go tool decorate -f decorateSgReady -b *SgReady -r api.Charger -t "api.Meter,CurrentPower,func() (float64, error)" -t "api.MeterEnergy,TotalEnergy,func() (float64, error)" -t "api.Battery,Soc,func() (float64, error)" -t "api.SocLimiter,GetLimitSoc,func() (int64, error)"
// NewSgReadyFromConfig creates an SG Ready configurable charger from generic config
func NewSgReadyFromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewSgReadyFromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
cc := struct {
embed `mapstructure:",squash"`
SetMode plugin.Config

View file

@ -48,7 +48,7 @@ func init() {
}
// NewSigenergyFromConfig creates a new Sigenergy ModbusTCP charger
func NewSigenergyFromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewSigenergyFromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
cc := modbus.TcpSettings{
ID: 1,
}

View file

@ -50,7 +50,7 @@ func init() {
}
// NewSmaevchargerFromConfig creates a SMA EV Charger from generic config
func NewSmaevchargerFromConfig(other map[string]interface{}) (api.Charger, error) {
func NewSmaevchargerFromConfig(other map[string]any) (api.Charger, error) {
cc := struct {
Uri string
User string

View file

@ -70,7 +70,7 @@ func init() {
}
// NewsmartEVSEFromConfig creates a new smartEVSE ModbusTCP charger
func NewsmartEVSEFromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewsmartEVSEFromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
cc := modbus.Settings{
ID: 1,
}

View file

@ -63,16 +63,16 @@ func init() {
registry.AddCtx("solax-g2", NewSolaxG2FromConfig)
}
func NewSolaxG1FromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewSolaxG1FromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
return NewSolaxFromConfig(ctx, other, true)
}
func NewSolaxG2FromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewSolaxG2FromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
return NewSolaxFromConfig(ctx, other, false)
}
// NewSolaxFromConfig creates a Solax charger from generic config
func NewSolaxFromConfig(ctx context.Context, other map[string]interface{}, isLegacyHw bool) (api.Charger, error) {
func NewSolaxFromConfig(ctx context.Context, other map[string]any, isLegacyHw bool) (api.Charger, error) {
cc := modbus.Settings{
ID: 1,
}

View file

@ -67,7 +67,7 @@ func init() {
}
// NewSungrowFromConfig creates a Sungrow charger from generic config
func NewSungrowFromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewSungrowFromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
cc := modbus.Settings{
ID: 248,
}

View file

@ -21,7 +21,7 @@ type SwitchSocket struct {
//go:generate go tool decorate -f decorateSwitchSocket -b *SwitchSocket -r api.Charger -t "api.MeterEnergy,TotalEnergy,func() (float64, error)" -t "api.Battery,Soc,func() (float64, error)"
func NewSwitchSocketFromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewSwitchSocketFromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
var cc struct {
embed `mapstructure:",squash"`
Enabled plugin.Config

View file

@ -17,7 +17,7 @@ func init() {
}
// NewTapoFromConfig creates a Tapo charger from generic config
func NewTapoFromConfig(other map[string]interface{}) (api.Charger, error) {
func NewTapoFromConfig(other map[string]any) (api.Charger, error) {
var cc struct {
embed `mapstructure:",squash"`
URI string

View file

@ -26,7 +26,7 @@ func init() {
//go:generate go tool decorate -f decorateTasmota -b *Tasmota -r api.Charger -t "api.PhaseVoltages,Voltages,func() (float64, float64, float64, error)" -t "api.PhaseCurrents,Currents,func() (float64, float64, float64, error)"
// NewTasmotaFromConfig creates a Tasmota charger from generic config
func NewTasmotaFromConfig(other map[string]interface{}) (api.Charger, error) {
func NewTasmotaFromConfig(other map[string]any) (api.Charger, error) {
cc := struct {
embed `mapstructure:",squash"`
URI string

View file

@ -11,7 +11,7 @@ func init() {
registry.AddCtx("template", NewChargerFromTemplateConfig)
}
func NewChargerFromTemplateConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewChargerFromTemplateConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
instance, err := templates.RenderInstance(templates.Charger, other)
if err != nil {
return nil, err

View file

@ -24,7 +24,7 @@ func init() {
registry.AddCtx("tessie", NewTessieFromConfig)
}
func NewTessieFromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewTessieFromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
cc := struct {
Vin string
Token string

View file

@ -21,7 +21,7 @@ func init() {
}
// NewTPLinkFromConfig creates a TP-Link charger from generic config
func NewTPLinkFromConfig(other map[string]interface{}) (api.Charger, error) {
func NewTPLinkFromConfig(other map[string]any) (api.Charger, error) {
var cc struct {
embed `mapstructure:",squash"`
URI string

View file

@ -52,7 +52,7 @@ func init() {
}
// NewTrydanFromConfig creates a Trydan charger from generic config
func NewTrydanFromConfig(other map[string]interface{}) (api.Charger, error) {
func NewTrydanFromConfig(other map[string]any) (api.Charger, error) {
cc := struct {
URI string
Cache time.Duration

View file

@ -55,7 +55,7 @@ type Vitals struct {
}
// NewTwc3FromConfig creates a new charger
func NewTwc3FromConfig(other map[string]interface{}) (api.Charger, error) {
func NewTwc3FromConfig(other map[string]any) (api.Charger, error) {
cc := struct {
URI string
Cache time.Duration

View file

@ -46,7 +46,7 @@ type Vaillant struct {
//go:generate go tool decorate -f decorateVaillant -b *Vaillant -r api.Charger -t "api.Meter,CurrentPower,func() (float64, error)" -t "api.Battery,Soc,func() (float64, error)"
// NewVaillantFromConfig creates an Vaillant configurable charger from generic config
func NewVaillantFromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewVaillantFromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
cc := struct {
embed `mapstructure:",squash"`
User, Password string

View file

@ -25,7 +25,7 @@ func init() {
}
// NewVehicleApiFromConfig creates a new vehicle-api charger
func NewVehicleApiFromConfig(other map[string]interface{}) (api.Charger, error) {
func NewVehicleApiFromConfig(other map[string]any) (api.Charger, error) {
cc := struct {
GeofenceEnabled bool `mapstructure:"geofence_enabled"`
Lat float64 `mapstructure:"lat"`

View file

@ -60,7 +60,7 @@ func init() {
}
// NewVersichargeFromConfig creates a Versicharge charger from generic config
func NewVersichargeFromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewVersichargeFromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
cc := modbus.TcpSettings{
ID: 2,
}

View file

@ -72,7 +72,7 @@ func init() {
//go:generate go tool decorate -f decorateVestel -b *Vestel -r api.Charger -t "api.PhaseSwitcher,Phases1p3p,func(int) error" -t "api.PhaseGetter,GetPhases,func() (int, error)" -t "api.Identifier,Identify,func() (string, error)"
// NewVestelFromConfig creates a Vestel charger from generic config
func NewVestelFromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewVestelFromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
cc := modbus.TcpSettings{
ID: 255,
}

View file

@ -73,17 +73,17 @@ func init() {
}
// NewVictronGXFromConfig creates a ABB charger from generic config
func NewVictronGXFromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewVictronGXFromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
return NewVictronFromConfig(ctx, other, victronGX)
}
// NewVictronEVCSFromConfig creates a ABB charger from generic config
func NewVictronEVCSFromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewVictronEVCSFromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
return NewVictronFromConfig(ctx, other, victronEVCS)
}
// NewVictronFromConfig creates a ABB charger from generic config
func NewVictronFromConfig(ctx context.Context, other map[string]interface{}, regs victronRegs) (api.Charger, error) {
func NewVictronFromConfig(ctx context.Context, other map[string]any, regs victronRegs) (api.Charger, error) {
cc := modbus.TcpSettings{
ID: cast.ToUint8(regs.isGX) * 100,
}

View file

@ -44,7 +44,7 @@ func init() {
//go:generate go tool decorate -f decorateWallbe -b *Wallbe -r api.Charger -t "api.Meter,CurrentPower,func() (float64, error)" -t "api.MeterEnergy,TotalEnergy,func() (float64, error)" -t "api.PhaseCurrents,Currents,func() (float64, float64, float64, error)" -t "api.ChargerEx,MaxCurrentMillis,func(float64) error"
// NewWallbeFromConfig creates a Wallbe charger from generic config
func NewWallbeFromConfig(ctx context.Context, other map[string]interface{}) (api.Charger, error) {
func NewWallbeFromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
cc := struct {
URI string
Legacy bool

View file

@ -39,7 +39,7 @@ func init() {
//go:generate go tool decorate -f decorateWarp2 -b *Warp2 -r api.Charger -t "api.Meter,CurrentPower,func() (float64, error)" -t "api.MeterEnergy,TotalEnergy,func() (float64, error)" -t "api.PhaseCurrents,Currents,func() (float64, float64, float64, error)" -t "api.PhaseVoltages,Voltages,func() (float64, float64, float64, error)" -t "api.Identifier,Identify,func() (string, error)" -t "api.PhaseSwitcher,Phases1p3p,func(int) error" -t "api.PhaseGetter,GetPhases,func() (int, error)"
// NewWarpFromConfig creates a new configurable charger
func NewWarp2FromConfig(other map[string]interface{}) (api.Charger, error) {
func NewWarp2FromConfig(other map[string]any) (api.Charger, error) {
cc := struct {
mqtt.Config `mapstructure:",squash"`
Topic string

Some files were not shown because too many files have changed in this diff Show more