chore: modernize go sources (#24896)
This commit is contained in:
parent
3421e8df81
commit
352012d24b
324 changed files with 590 additions and 583 deletions
4
Makefile
4
Makefile
|
|
@ -53,6 +53,10 @@ docs::
|
||||||
|
|
||||||
lint::
|
lint::
|
||||||
golangci-lint run
|
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::
|
lint-ui::
|
||||||
npm run lint
|
npm run lint
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ type All struct {
|
||||||
Chargers []config.Named
|
Chargers []config.Named
|
||||||
Vehicles []config.Named
|
Vehicles []config.Named
|
||||||
Tariffs Tariffs
|
Tariffs Tariffs
|
||||||
Site map[string]interface{}
|
Site map[string]any
|
||||||
Loadpoints []config.Named
|
Loadpoints []config.Named
|
||||||
Circuits []config.Named
|
Circuits []config.Named
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewABBFromConfig creates a ABB charger from generic config
|
// 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{
|
cc := modbus.Settings{
|
||||||
ID: 1,
|
ID: 1,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewAblEm4FromConfig creates an ABL eM4 charger from generic config
|
// 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 {
|
cc := struct {
|
||||||
modbus.TcpSettings `mapstructure:",squash"`
|
modbus.TcpSettings `mapstructure:",squash"`
|
||||||
Connector uint16
|
Connector uint16
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ func init() {
|
||||||
// https://www.goingelectric.de/forum/viewtopic.php?p=1550459#p1550459
|
// https://www.goingelectric.de/forum/viewtopic.php?p=1550459#p1550459
|
||||||
|
|
||||||
// NewABLeMHFromConfig creates a ABLeMH charger from generic config
|
// 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 {
|
cc := struct {
|
||||||
modbus.Settings `mapstructure:",squash"`
|
modbus.Settings `mapstructure:",squash"`
|
||||||
Timeout time.Duration
|
Timeout time.Duration
|
||||||
|
|
|
||||||
|
|
@ -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)"
|
//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
|
// 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{
|
cc := modbus.TcpSettings{
|
||||||
ID: 1,
|
ID: 1,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewAlphatecFromConfig creates a Alphatec charger from generic config
|
// 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{
|
cc := modbus.Settings{
|
||||||
ID: 1,
|
ID: 1,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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)"
|
//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
|
// 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 {
|
cc := struct {
|
||||||
modbus.TcpSettings `mapstructure:",squash"`
|
modbus.TcpSettings `mapstructure:",squash"`
|
||||||
Phases1p3p bool
|
Phases1p3p bool
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewBenderCCFromConfig creates a BenderCC charger from generic config
|
// 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 {
|
cc := struct {
|
||||||
modbus.TcpSettings `mapstructure:",squash"`
|
modbus.TcpSettings `mapstructure:",squash"`
|
||||||
Cache time.Duration
|
Cache time.Duration
|
||||||
|
|
|
||||||
|
|
@ -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"
|
//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
|
// 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{
|
cc := modbus.TcpSettings{
|
||||||
ID: 1,
|
ID: 1,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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)"
|
//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
|
// 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 {
|
var cc struct {
|
||||||
embed `mapstructure:",squash"`
|
embed `mapstructure:",squash"`
|
||||||
Status, Enable, Enabled, MaxCurrent plugin.Config
|
Status, Enable, Enabled, MaxCurrent plugin.Config
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewCompleoFromConfig creates a Compleo charger from generic config
|
// 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 {
|
cc := struct {
|
||||||
Connector uint16
|
Connector uint16
|
||||||
modbus.TcpSettings `mapstructure:",squash"`
|
modbus.TcpSettings `mapstructure:",squash"`
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,6 @@ func Types() []string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewFromConfig creates charger from configuration
|
// 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)
|
return config.NewFromConfig(ctx, typ, other)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ import (
|
||||||
var Registry = reg.New[api.Charger]("charger")
|
var Registry = reg.New[api.Charger]("charger")
|
||||||
|
|
||||||
// NewFromConfig creates charger from configuration
|
// 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))
|
factory, err := Registry.Get(strings.ToLower(typ))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewConnectIqFromConfig creates a ConnectIq charger from generic config
|
// 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 {
|
cc := struct {
|
||||||
URI string
|
URI string
|
||||||
Cache time.Duration
|
Cache time.Duration
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewDadapowerFromConfig creates a Dadapower charger from generic config
|
// 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{}
|
cc := modbus.TcpSettings{}
|
||||||
|
|
||||||
if err := util.DecodeOther(other, &cc); err != nil {
|
if err := util.DecodeOther(other, &cc); err != nil {
|
||||||
|
|
|
||||||
|
|
@ -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)"
|
//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
|
// 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 {
|
cc := struct {
|
||||||
modbus.TcpSettings `mapstructure:",squash"`
|
modbus.TcpSettings `mapstructure:",squash"`
|
||||||
Phases1p3p bool
|
Phases1p3p bool
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewDeltaFromConfig creates a Delta charger from generic config
|
// 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 {
|
cc := struct {
|
||||||
Connector uint16
|
Connector uint16
|
||||||
modbus.Settings `mapstructure:",squash"`
|
modbus.Settings `mapstructure:",squash"`
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewEaseeFromConfig creates a Easee charger from generic config
|
// 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 {
|
cc := struct {
|
||||||
User string
|
User string
|
||||||
Password string
|
Password string
|
||||||
|
|
@ -202,7 +202,7 @@ func NewEasee(ctx context.Context, user, password, charger string, timeout time.
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Easee) waitForOptionalState() {
|
func (c *Easee) waitForOptionalState() {
|
||||||
for i := 0; i < 30; i++ {
|
for range 30 {
|
||||||
if c.optionalStatePresent() {
|
if c.optionalStatePresent() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import (
|
||||||
|
|
||||||
// Logger is a simple logger interface
|
// Logger is a simple logger interface
|
||||||
type Logger interface {
|
type Logger interface {
|
||||||
Println(v ...interface{})
|
Println(v ...any)
|
||||||
}
|
}
|
||||||
|
|
||||||
type logger struct {
|
type logger struct {
|
||||||
|
|
@ -23,7 +23,7 @@ func SignalrLogger(log Logger) signalr.StructuredLogger {
|
||||||
|
|
||||||
var skipped = []string{"ts", "class", "hub", "protocol", "value"}
|
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)
|
b := new(strings.Builder)
|
||||||
|
|
||||||
var skip bool
|
var skip bool
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ type Observation struct {
|
||||||
Value string
|
Value string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *Observation) TypedValue() (interface{}, error) {
|
func (o *Observation) TypedValue() (any, error) {
|
||||||
switch o.DataType {
|
switch o.DataType {
|
||||||
case Boolean:
|
case Boolean:
|
||||||
return o.Value == "1", nil
|
return o.Value == "1", nil
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewEEBusFromConfig creates an EEBus charger from generic config
|
// 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 {
|
var cc struct {
|
||||||
Ski string
|
Ski string
|
||||||
Ip string
|
Ip string
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewEm2GoDuoFromConfig creates a Em2GoDuo charger from generic config
|
// 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 {
|
cc := struct {
|
||||||
modbus.TcpSettings `mapstructure:",squash"`
|
modbus.TcpSettings `mapstructure:",squash"`
|
||||||
Connector int
|
Connector int
|
||||||
|
|
|
||||||
|
|
@ -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)"
|
//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
|
// 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 {
|
cc := struct {
|
||||||
modbus.TcpSettings `mapstructure:",squash"`
|
modbus.TcpSettings `mapstructure:",squash"`
|
||||||
Connector int // TODO remove deprecated
|
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))
|
fmt.Printf("\tCable Max. Current:\t%.1fA\n", float64(binary.BigEndian.Uint16(b)/10))
|
||||||
}
|
}
|
||||||
var serial []byte
|
var serial []byte
|
||||||
for reg := 0; reg < 8; reg++ {
|
for reg := range 8 {
|
||||||
b, err := wb.conn.ReadHoldingRegisters(em2GoRegSerial+2*uint16(reg), 2)
|
b, err := wb.conn.ReadHoldingRegisters(em2GoRegSerial+2*uint16(reg), 2)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewEtrelFromConfig creates a Etrel charger from generic config
|
// 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 {
|
cc := struct {
|
||||||
Connector int
|
Connector int
|
||||||
modbus.TcpSettings `mapstructure:",squash"`
|
modbus.TcpSettings `mapstructure:",squash"`
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ type EVECUBELastStatusPacket struct {
|
||||||
|
|
||||||
// EVECUBEAutomationStatus is the /api/admin/automation/status response
|
// EVECUBEAutomationStatus is the /api/admin/automation/status response
|
||||||
type EVECUBEAutomationStatus struct {
|
type EVECUBEAutomationStatus struct {
|
||||||
Connectors map[string]interface{} `json:"connectors"`
|
Connectors map[string]any `json:"connectors"`
|
||||||
AuthTag struct {
|
AuthTag struct {
|
||||||
Tag string `json:"tag"`
|
Tag string `json:"tag"`
|
||||||
} `json:"authTag"`
|
} `json:"authTag"`
|
||||||
|
|
@ -98,11 +98,11 @@ type EVECUBEAutomationStatus struct {
|
||||||
|
|
||||||
// EVECUBEUnitConfigRequest is the request body for /api/admin/unitconfig POST
|
// EVECUBEUnitConfigRequest is the request body for /api/admin/unitconfig POST
|
||||||
type EVECUBEUnitConfigRequest struct {
|
type EVECUBEUnitConfigRequest struct {
|
||||||
Values map[string]interface{} `json:"values"`
|
Values map[string]any `json:"values"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewEVECUBEFromConfig creates a EVECUBE charger from generic config
|
// 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 {
|
cc := struct {
|
||||||
URI string
|
URI string
|
||||||
User string
|
User string
|
||||||
|
|
@ -276,7 +276,7 @@ func (wb *EVECUBE) MaxCurrent(current int64) error {
|
||||||
// setValue sets a named value via admin API
|
// setValue sets a named value via admin API
|
||||||
func (wb *EVECUBE) setValue(key string, value int64) error {
|
func (wb *EVECUBE) setValue(key string, value int64) error {
|
||||||
reqBody := EVECUBEUnitConfigRequest{
|
reqBody := EVECUBEUnitConfigRequest{
|
||||||
Values: map[string]interface{}{
|
Values: map[string]any{
|
||||||
key: value,
|
key: value,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
@ -296,7 +296,7 @@ func (wb *EVECUBE) setValue(key string, value int64) error {
|
||||||
req.SetBasicAuth(wb.user, wb.pass)
|
req.SetBasicAuth(wb.user, wb.pass)
|
||||||
}
|
}
|
||||||
|
|
||||||
var resp map[string]interface{}
|
var resp map[string]any
|
||||||
if err := wb.DoJSON(req, &resp); err != nil {
|
if err := wb.DoJSON(req, &resp); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ func init() {
|
||||||
// https://www.evracing.cz/user/documents/upload/EVSE-WB-DIN_latest.pdf
|
// https://www.evracing.cz/user/documents/upload/EVSE-WB-DIN_latest.pdf
|
||||||
|
|
||||||
// NewEvseDINFromConfig creates an EVSE DIN charger from generic config
|
// 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{
|
cc := modbus.Settings{
|
||||||
Baudrate: 9600,
|
Baudrate: 9600,
|
||||||
Comset: "8N1",
|
Comset: "8N1",
|
||||||
|
|
|
||||||
|
|
@ -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)"
|
//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
|
// 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 {
|
cc := struct {
|
||||||
URI string
|
URI string
|
||||||
Meter struct {
|
Meter struct {
|
||||||
|
|
|
||||||
|
|
@ -15,9 +15,9 @@ func TestEvseWifi(t *testing.T) {
|
||||||
}))
|
}))
|
||||||
defer ts.Close()
|
defer ts.Close()
|
||||||
|
|
||||||
wb, err := NewEVSEWifiFromConfig(map[string]interface{}{
|
wb, err := NewEVSEWifiFromConfig(map[string]any{
|
||||||
"uri": ts.URL,
|
"uri": ts.URL,
|
||||||
"meter": map[string]interface{}{
|
"meter": map[string]any{
|
||||||
"power": true,
|
"power": true,
|
||||||
"energy": true,
|
"energy": true,
|
||||||
"currents": true,
|
"currents": true,
|
||||||
|
|
@ -51,7 +51,7 @@ func TestEvseWifiEx(t *testing.T) {
|
||||||
}))
|
}))
|
||||||
defer ts.Close()
|
defer ts.Close()
|
||||||
|
|
||||||
wb, err := NewEVSEWifiFromConfig(map[string]interface{}{
|
wb, err := NewEVSEWifiFromConfig(map[string]any{
|
||||||
"uri": ts.URL,
|
"uri": ts.URL,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewFritzDECTFromConfig creates a fritzdect charger from generic config
|
// 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 {
|
var cc struct {
|
||||||
embed `mapstructure:",squash"`
|
embed `mapstructure:",squash"`
|
||||||
fritzdect.Settings `mapstructure:",squash"`
|
fritzdect.Settings `mapstructure:",squash"`
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewWattpilotFromConfig creates a wattpilot charger from generic config
|
// 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 {
|
var cc struct {
|
||||||
URI string
|
URI string
|
||||||
Password string
|
Password string
|
||||||
|
|
|
||||||
|
|
@ -38,10 +38,10 @@ type GoE struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
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)
|
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)
|
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"
|
//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
|
// 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 {
|
cc := struct {
|
||||||
Token string
|
Token string
|
||||||
URI string
|
URI string
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ type Response interface {
|
||||||
Identify() string
|
Identify() string
|
||||||
}
|
}
|
||||||
|
|
||||||
type UpdateResponse map[string]interface{}
|
type UpdateResponse map[string]any
|
||||||
|
|
||||||
type API interface {
|
type API interface {
|
||||||
IsV2() bool
|
IsV2() bool
|
||||||
|
|
@ -78,7 +78,7 @@ func (c *LocalAPI) IsV2() bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
// response returns a v1/v2 api response
|
// 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)
|
url := fmt.Sprintf("%s/%s", c.uri, partial)
|
||||||
return c.GetJSON(url, &res)
|
return c.GetJSON(url, &res)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewHardyBarthFromConfig creates a HardyBarth cPH1 charger from generic config
|
// 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 {
|
cc := struct {
|
||||||
URI string
|
URI string
|
||||||
ChargeControl int
|
ChargeControl int
|
||||||
|
|
|
||||||
|
|
@ -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)"
|
//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
|
// 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 {
|
cc := struct {
|
||||||
URI string
|
URI string
|
||||||
User string
|
User string
|
||||||
|
|
|
||||||
|
|
@ -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)"
|
//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
|
// 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 {
|
cc := struct {
|
||||||
embed `mapstructure:",squash"`
|
embed `mapstructure:",squash"`
|
||||||
SetMaxPower plugin.Config
|
SetMaxPower plugin.Config
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ func init() {
|
||||||
// https://cdn.shopify.com/s/files/1/0101/2409/9669/files/heidelberg-energy-control-modbus.pdf (older)
|
// 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
|
// 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{
|
cc := modbus.Settings{
|
||||||
ID: 1,
|
ID: 1,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewHesotecFromConfig creates a Hesotec charger from generic config
|
// 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{
|
cc := modbus.TcpSettings{
|
||||||
ID: 1,
|
ID: 1,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ func init() {
|
||||||
registry.Add("homeassistant-switch", NewHomeAssistantSwitchFromConfig)
|
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 {
|
var cc struct {
|
||||||
embed `mapstructure:",squash"`
|
embed `mapstructure:",squash"`
|
||||||
URI string
|
URI string
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewHomeAssistantFromConfig creates a HomeAssistant charger from generic config
|
// 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 {
|
cc := struct {
|
||||||
URI string
|
URI string
|
||||||
Token string
|
Token string
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewCCUFromConfig creates a Homematic charger from generic config
|
// 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 {
|
cc := struct {
|
||||||
embed `mapstructure:",squash"`
|
embed `mapstructure:",squash"`
|
||||||
URI string
|
URI string
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewHomeWizardFromConfig creates a HomeWizard charger from generic config
|
// 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 {
|
cc := struct {
|
||||||
embed `mapstructure:",squash"`
|
embed `mapstructure:",squash"`
|
||||||
URI string
|
URI string
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewInnogyFromConfig creates a Innogy charger from generic config
|
// 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{
|
cc := modbus.TcpSettings{
|
||||||
ID: 1,
|
ID: 1,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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)"
|
//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
|
// 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 {
|
cc := struct {
|
||||||
embed `mapstructure:",squash"`
|
embed `mapstructure:",squash"`
|
||||||
modbus.TcpSettings `mapstructure:",squash"`
|
modbus.TcpSettings `mapstructure:",squash"`
|
||||||
|
|
|
||||||
|
|
@ -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)"
|
//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
|
// 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 {
|
cc := struct {
|
||||||
URI string
|
URI string
|
||||||
Serial 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)
|
resC := make(chan keba.UDPMsg)
|
||||||
errC := make(chan error)
|
errC := make(chan error)
|
||||||
closeC := make(chan struct{})
|
closeC := make(chan struct{})
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewKSEFromConfig creates a KSE charger from generic config
|
// 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{
|
cc := modbus.Settings{
|
||||||
ID: 100,
|
ID: 100,
|
||||||
Baudrate: 9600,
|
Baudrate: 9600,
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewMennekesCompactFromConfig creates a new Mennekes ModbusTCP charger
|
// 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 {
|
cc := struct {
|
||||||
modbus.Settings `mapstructure:",squash"`
|
modbus.Settings `mapstructure:",squash"`
|
||||||
Timeout time.Duration
|
Timeout time.Duration
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewMennekesHcc3FromConfig creates a Mennekes mennekesHcc3 charger from generic config
|
// 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{
|
cc := modbus.TcpSettings{
|
||||||
ID: 255,
|
ID: 255,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,22 +60,22 @@ var elwaStandbyPower uint16 = 10
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
// https://github.com/evcc-io/evcc/discussions/12761
|
// 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)
|
return newMyPvFromConfig(ctx, "ac-elwa-2", other, 2)
|
||||||
})
|
})
|
||||||
|
|
||||||
// https: // github.com/evcc-io/evcc/issues/18020
|
// 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)
|
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)
|
return newMyPvFromConfig(ctx, "ac-elwa-e", other, 2)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// newMyPvFromConfig creates a MyPv charger from generic config
|
// 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 {
|
cc := struct {
|
||||||
modbus.TcpSettings `mapstructure:",squash"`
|
modbus.TcpSettings `mapstructure:",squash"`
|
||||||
TempSource int
|
TempSource int
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ type MyStrom struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewMyStromFromConfig creates a myStrom charger from generic config
|
// 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 {
|
cc := struct {
|
||||||
embed `mapstructure:",squash"`
|
embed `mapstructure:",squash"`
|
||||||
URI string
|
URI string
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,6 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewNRGKickBLEFromConfig creates a NRGKickBLE charger from generic config
|
// 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")
|
return nil, errors.New("NRGKick bluetooth is only supported on linux")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewNRGKickConnectFromConfig creates a NRGKickConnect charger from generic config
|
// 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 {
|
cc := struct {
|
||||||
URI, Mac, Password string
|
URI, Mac, Password string
|
||||||
Cache time.Duration
|
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)
|
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)
|
req, err := request.New(http.MethodPut, url, request.MarshalJSON(data), request.JSONEncoding)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
||||||
|
|
@ -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"
|
//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
|
// 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 {
|
cc := struct {
|
||||||
modbus.TcpSettings `mapstructure:",squash"`
|
modbus.TcpSettings `mapstructure:",squash"`
|
||||||
Phases1p3p bool
|
Phases1p3p bool
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewOboFromConfig creates a OBO Bettermann charger from generic config
|
// 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{
|
cc := modbus.Settings{
|
||||||
Baudrate: 19200,
|
Baudrate: 19200,
|
||||||
Comset: "8E1",
|
Comset: "8E1",
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewOCPPFromConfig creates a OCPP charger from generic config
|
// 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 {
|
cc := struct {
|
||||||
StationId string
|
StationId string
|
||||||
IdTag string
|
IdTag string
|
||||||
|
|
|
||||||
|
|
@ -174,7 +174,7 @@ func (cp *CP) HasMeasurement(val types.Measurand) bool {
|
||||||
|
|
||||||
func (cp *CP) tryMeasurands(measurands string, key string) []string {
|
func (cp *CP) tryMeasurands(measurands string, key string) []string {
|
||||||
var accepted []string
|
var accepted []string
|
||||||
for _, m := range strings.Split(measurands, ",") {
|
for m := range strings.SplitSeq(measurands, ",") {
|
||||||
if err := cp.ChangeConfigurationRequest(key, m); err == nil {
|
if err := cp.ChangeConfigurationRequest(key, m); err == nil {
|
||||||
accepted = append(accepted, m)
|
accepted = append(accepted, m)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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...))
|
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...))
|
cs.print(fmt.Sprintf(f, args...))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cs *CS) Info(args ...interface{}) {
|
func (cs *CS) Info(args ...any) {
|
||||||
cs.print(fmt.Sprintln(args...))
|
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...))
|
cs.print(fmt.Sprintf(f, args...))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cs *CS) Error(args ...interface{}) {
|
func (cs *CS) Error(args ...any) {
|
||||||
cs.print(fmt.Sprintln(args...))
|
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...))
|
cs.print(fmt.Sprintf(f, args...))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ func Instance() *CS {
|
||||||
dispatcher.SetTimeout(Timeout)
|
dispatcher.SetTimeout(Timeout)
|
||||||
|
|
||||||
endpoint := ocppj.NewServer(server, dispatcher, nil, core.Profile, remotetrigger.Profile, smartcharging.Profile, security.Profile)
|
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)
|
log.ERROR.Printf("%v (%s)", err, rawMessage)
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -14,15 +14,15 @@ func print(t *testing.T, s string) {
|
||||||
t.Log((time.Now().Format(time.DateTime)), s)
|
t.Log((time.Now().Format(time.DateTime)), s)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *ocppLogger) Debug(args ...interface{}) { print(l.t, fmt.Sprint(args...)) }
|
func (l *ocppLogger) Debug(args ...any) { print(l.t, fmt.Sprint(args...)) }
|
||||||
func (l *ocppLogger) Debugf(format string, args ...interface{}) {
|
func (l *ocppLogger) Debugf(format string, args ...any) {
|
||||||
print(l.t, fmt.Sprintf(format, args...))
|
print(l.t, fmt.Sprintf(format, args...))
|
||||||
}
|
}
|
||||||
func (l *ocppLogger) Info(args ...interface{}) { print(l.t, fmt.Sprint(args...)) }
|
func (l *ocppLogger) Info(args ...any) { print(l.t, fmt.Sprint(args...)) }
|
||||||
func (l *ocppLogger) Infof(format string, args ...interface{}) {
|
func (l *ocppLogger) Infof(format string, args ...any) {
|
||||||
print(l.t, fmt.Sprintf(format, args...))
|
print(l.t, fmt.Sprintf(format, args...))
|
||||||
}
|
}
|
||||||
func (l *ocppLogger) Error(args ...interface{}) { print(l.t, fmt.Sprint(args...)) }
|
func (l *ocppLogger) Error(args ...any) { print(l.t, fmt.Sprint(args...)) }
|
||||||
func (l *ocppLogger) Errorf(format string, args ...interface{}) {
|
func (l *ocppLogger) Errorf(format string, args ...any) {
|
||||||
print(l.t, fmt.Sprintf(format, args...))
|
print(l.t, fmt.Sprintf(format, args...))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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"
|
//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
|
// 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 {
|
cc := struct {
|
||||||
URI string
|
URI string
|
||||||
User string
|
User string
|
||||||
|
|
|
||||||
|
|
@ -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)"
|
//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
|
// 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 {
|
cc := struct {
|
||||||
Connector uint16
|
Connector uint16
|
||||||
Phases1p3p bool
|
Phases1p3p bool
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ type OpenWBPro struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewOpenWBProFromConfig creates a OpenWBPro charger from generic config
|
// 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 {
|
cc := struct {
|
||||||
URI string
|
URI string
|
||||||
Cache time.Duration
|
Cache time.Duration
|
||||||
|
|
|
||||||
|
|
@ -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)"
|
//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
|
// 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 {
|
cc := struct {
|
||||||
mqtt.Config `mapstructure:",squash"`
|
mqtt.Config `mapstructure:",squash"`
|
||||||
Topic string
|
Topic string
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewPantaboxFromConfig creates a Pantabox charger from generic config
|
// 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 {
|
var cc struct {
|
||||||
URI string
|
URI string
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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)"
|
//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
|
// 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 {
|
cc := struct {
|
||||||
URI string
|
URI string
|
||||||
SlaveIndex int
|
SlaveIndex int
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ type Status struct {
|
||||||
NrOfPhases int // 1,
|
NrOfPhases int // 1,
|
||||||
TwinSerial int // -1,
|
TwinSerial int // -1,
|
||||||
}
|
}
|
||||||
TwinCharger interface{}
|
TwinCharger any
|
||||||
}
|
}
|
||||||
|
|
||||||
// /servlet/rest/chargebox/slaves/false
|
// /servlet/rest/chargebox/slaves/false
|
||||||
|
|
|
||||||
|
|
@ -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)"
|
//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
|
// 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{
|
cc := modbus.TcpSettings{
|
||||||
ID: 255,
|
ID: 255,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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)"
|
//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
|
// 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 {
|
cc := struct {
|
||||||
modbus.TcpSettings `mapstructure:",squash"`
|
modbus.TcpSettings `mapstructure:",squash"`
|
||||||
Connector uint16
|
Connector uint16
|
||||||
|
|
|
||||||
|
|
@ -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)"
|
//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
|
// 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{
|
cc := modbus.TcpSettings{
|
||||||
ID: 180,
|
ID: 180,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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)"
|
//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
|
// 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{
|
cc := modbus.TcpSettings{
|
||||||
ID: 255,
|
ID: 255,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewPhoenixEVSerFromConfig creates a Phoenix charger from generic config
|
// 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{
|
cc := modbus.Settings{
|
||||||
ID: 1,
|
ID: 1,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewPlugchoiceFromConfig creates a Plugchoice charger from generic config
|
// 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 {
|
cc := struct {
|
||||||
URI string
|
URI string
|
||||||
UUID string // kept for backward compatibility
|
UUID string // kept for backward compatibility
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewPrachtAlphaFromConfig creates a PrachtAlpha charger from generic config
|
// 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 {
|
cc := struct {
|
||||||
Connector uint16
|
Connector uint16
|
||||||
modbus.Settings `mapstructure:",squash"`
|
modbus.Settings `mapstructure:",squash"`
|
||||||
|
|
|
||||||
|
|
@ -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"
|
//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
|
// 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{
|
cc := modbus.Settings{
|
||||||
ID: 1,
|
ID: 1,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewPulsatrixFromConfig creates a pulsatrix charger from generic config
|
// 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 {
|
var cc struct {
|
||||||
Host string
|
Host string
|
||||||
}
|
}
|
||||||
|
|
@ -173,7 +173,7 @@ func (c *Pulsatrix) connect() error {
|
||||||
|
|
||||||
// sync attempts synchronization with retry mechanism
|
// sync attempts synchronization with retry mechanism
|
||||||
func (c *Pulsatrix) sync() error {
|
func (c *Pulsatrix) sync() error {
|
||||||
for i := 0; i < syncRetries; i++ {
|
for i := range syncRetries {
|
||||||
if err := c.Enable(false); err == nil {
|
if err := c.Enable(false); err == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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
|
// 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
|
// 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{
|
cc := modbus.TcpSettings{
|
||||||
ID: 255,
|
ID: 255,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewSEMPFromConfig creates a SEMP charger from generic config
|
// 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 {
|
cc := struct {
|
||||||
URI string
|
URI string
|
||||||
DeviceID string
|
DeviceID string
|
||||||
|
|
|
||||||
|
|
@ -255,8 +255,7 @@ func TestSEMPCharger(t *testing.T) {
|
||||||
server := httptest.NewServer(handler)
|
server := httptest.NewServer(handler)
|
||||||
defer server.Close()
|
defer server.Close()
|
||||||
|
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx := t.Context()
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
wb, err := NewSEMP(ctx, server.URL+"/semp", "F-12345678-ABCDEF123456-00", time.Second)
|
wb, err := NewSEMP(ctx, server.URL+"/semp", "F-12345678-ABCDEF123456-00", time.Second)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
@ -323,8 +322,7 @@ func TestSEMPChargerOff(t *testing.T) {
|
||||||
server := httptest.NewServer(handler)
|
server := httptest.NewServer(handler)
|
||||||
defer server.Close()
|
defer server.Close()
|
||||||
|
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx := t.Context()
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
wb, err := NewSEMP(ctx, server.URL+"/semp", "F-12345678-ABCDEF123456-00", time.Second)
|
wb, err := NewSEMP(ctx, server.URL+"/semp", "F-12345678-ABCDEF123456-00", time.Second)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
@ -376,8 +374,7 @@ func TestSEMPChargerReady(t *testing.T) {
|
||||||
server := httptest.NewServer(handler)
|
server := httptest.NewServer(handler)
|
||||||
defer server.Close()
|
defer server.Close()
|
||||||
|
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx := t.Context()
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
wb, err := NewSEMP(ctx, server.URL+"/semp", "F-12345678-ABCDEF123456-00", time.Second)
|
wb, err := NewSEMP(ctx, server.URL+"/semp", "F-12345678-ABCDEF123456-00", time.Second)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
@ -405,8 +402,7 @@ func TestSEMPChargerPhases1p3p(t *testing.T) {
|
||||||
server := httptest.NewServer(handler)
|
server := httptest.NewServer(handler)
|
||||||
defer server.Close()
|
defer server.Close()
|
||||||
|
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx := t.Context()
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
wb, err := NewSEMP(ctx, server.URL+"/semp", "F-12345678-ABCDEF123456-00", time.Second)
|
wb, err := NewSEMP(ctx, server.URL+"/semp", "F-12345678-ABCDEF123456-00", time.Second)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
@ -450,8 +446,7 @@ func TestSEMPChargerChargedEnergy(t *testing.T) {
|
||||||
server := httptest.NewServer(handler)
|
server := httptest.NewServer(handler)
|
||||||
defer server.Close()
|
defer server.Close()
|
||||||
|
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx := t.Context()
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
wb, err := NewSEMP(ctx, server.URL+"/semp", "F-12345678-ABCDEF123456-00", time.Second)
|
wb, err := NewSEMP(ctx, server.URL+"/semp", "F-12345678-ABCDEF123456-00", time.Second)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
@ -496,8 +491,7 @@ func TestSEMPChargerAutoDetectDeviceID(t *testing.T) {
|
||||||
server := httptest.NewServer(handler)
|
server := httptest.NewServer(handler)
|
||||||
defer server.Close()
|
defer server.Close()
|
||||||
|
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx := t.Context()
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
// Create charger without deviceID - should auto-detect
|
// Create charger without deviceID - should auto-detect
|
||||||
wb, err := NewSEMP(ctx, server.URL+"/semp", "", time.Second)
|
wb, err := NewSEMP(ctx, server.URL+"/semp", "", time.Second)
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewSgReadyBoostFromConfig creates an SG Ready charger with boost relay from generic config
|
// 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 {
|
cc := struct {
|
||||||
embed `mapstructure:",squash"`
|
embed `mapstructure:",squash"`
|
||||||
Charger config.Typed
|
Charger config.Typed
|
||||||
|
|
|
||||||
|
|
@ -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)"
|
//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
|
// 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 {
|
cc := struct {
|
||||||
embed `mapstructure:",squash"`
|
embed `mapstructure:",squash"`
|
||||||
SetMode plugin.Config
|
SetMode plugin.Config
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewSigenergyFromConfig creates a new Sigenergy ModbusTCP charger
|
// 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{
|
cc := modbus.TcpSettings{
|
||||||
ID: 1,
|
ID: 1,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewSmaevchargerFromConfig creates a SMA EV Charger from generic config
|
// 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 {
|
cc := struct {
|
||||||
Uri string
|
Uri string
|
||||||
User string
|
User string
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewsmartEVSEFromConfig creates a new smartEVSE ModbusTCP charger
|
// 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{
|
cc := modbus.Settings{
|
||||||
ID: 1,
|
ID: 1,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -63,16 +63,16 @@ func init() {
|
||||||
registry.AddCtx("solax-g2", NewSolaxG2FromConfig)
|
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)
|
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)
|
return NewSolaxFromConfig(ctx, other, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewSolaxFromConfig creates a Solax charger from generic config
|
// 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{
|
cc := modbus.Settings{
|
||||||
ID: 1,
|
ID: 1,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewSungrowFromConfig creates a Sungrow charger from generic config
|
// 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{
|
cc := modbus.Settings{
|
||||||
ID: 248,
|
ID: 248,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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)"
|
//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 {
|
var cc struct {
|
||||||
embed `mapstructure:",squash"`
|
embed `mapstructure:",squash"`
|
||||||
Enabled plugin.Config
|
Enabled plugin.Config
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewTapoFromConfig creates a Tapo charger from generic config
|
// 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 {
|
var cc struct {
|
||||||
embed `mapstructure:",squash"`
|
embed `mapstructure:",squash"`
|
||||||
URI string
|
URI string
|
||||||
|
|
|
||||||
|
|
@ -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)"
|
//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
|
// 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 {
|
cc := struct {
|
||||||
embed `mapstructure:",squash"`
|
embed `mapstructure:",squash"`
|
||||||
URI string
|
URI string
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ func init() {
|
||||||
registry.AddCtx("template", NewChargerFromTemplateConfig)
|
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)
|
instance, err := templates.RenderInstance(templates.Charger, other)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ func init() {
|
||||||
registry.AddCtx("tessie", NewTessieFromConfig)
|
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 {
|
cc := struct {
|
||||||
Vin string
|
Vin string
|
||||||
Token string
|
Token string
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewTPLinkFromConfig creates a TP-Link charger from generic config
|
// 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 {
|
var cc struct {
|
||||||
embed `mapstructure:",squash"`
|
embed `mapstructure:",squash"`
|
||||||
URI string
|
URI string
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewTrydanFromConfig creates a Trydan charger from generic config
|
// 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 {
|
cc := struct {
|
||||||
URI string
|
URI string
|
||||||
Cache time.Duration
|
Cache time.Duration
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ type Vitals struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewTwc3FromConfig creates a new charger
|
// 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 {
|
cc := struct {
|
||||||
URI string
|
URI string
|
||||||
Cache time.Duration
|
Cache time.Duration
|
||||||
|
|
|
||||||
|
|
@ -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)"
|
//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
|
// 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 {
|
cc := struct {
|
||||||
embed `mapstructure:",squash"`
|
embed `mapstructure:",squash"`
|
||||||
User, Password string
|
User, Password string
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewVehicleApiFromConfig creates a new vehicle-api charger
|
// 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 {
|
cc := struct {
|
||||||
GeofenceEnabled bool `mapstructure:"geofence_enabled"`
|
GeofenceEnabled bool `mapstructure:"geofence_enabled"`
|
||||||
Lat float64 `mapstructure:"lat"`
|
Lat float64 `mapstructure:"lat"`
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewVersichargeFromConfig creates a Versicharge charger from generic config
|
// 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{
|
cc := modbus.TcpSettings{
|
||||||
ID: 2,
|
ID: 2,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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)"
|
//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
|
// 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{
|
cc := modbus.TcpSettings{
|
||||||
ID: 255,
|
ID: 255,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -73,17 +73,17 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewVictronGXFromConfig creates a ABB charger from generic config
|
// 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)
|
return NewVictronFromConfig(ctx, other, victronGX)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewVictronEVCSFromConfig creates a ABB charger from generic config
|
// 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)
|
return NewVictronFromConfig(ctx, other, victronEVCS)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewVictronFromConfig creates a ABB charger from generic config
|
// 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{
|
cc := modbus.TcpSettings{
|
||||||
ID: cast.ToUint8(regs.isGX) * 100,
|
ID: cast.ToUint8(regs.isGX) * 100,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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"
|
//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
|
// 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 {
|
cc := struct {
|
||||||
URI string
|
URI string
|
||||||
Legacy bool
|
Legacy bool
|
||||||
|
|
|
||||||
|
|
@ -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)"
|
//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
|
// 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 {
|
cc := struct {
|
||||||
mqtt.Config `mapstructure:",squash"`
|
mqtt.Config `mapstructure:",squash"`
|
||||||
Topic string
|
Topic string
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue