diff --git a/server/eebus/eebus.go b/server/eebus/eebus.go index 3b1551aab..c39bda28e 100644 --- a/server/eebus/eebus.go +++ b/server/eebus/eebus.go @@ -4,9 +4,7 @@ import ( "crypto/tls" "errors" "fmt" - "net" "slices" - "strconv" "strings" "sync" "time" @@ -90,7 +88,7 @@ var Instance *EEBus func NewServer(other Config) (*EEBus, error) { cc := Config{ - URI: ":4712", + Port: 4712, } if err := mergo.Merge(&cc, other, mergo.WithOverride); err != nil { @@ -111,22 +109,11 @@ func NewServer(other Config) (*EEBus, error) { return nil, err } - _, portValue, err := net.SplitHostPort(cc.URI) - if err != nil { - return nil, err - } - - port, err := strconv.Atoi(portValue) - if err != nil { - return nil, err - } - - // TODO: get the voltage from the site configuration, err := eebusapi.NewConfiguration( BrandName, BrandName, Model, serial, model.DeviceTypeTypeEnergyManagementSystem, []model.EntityTypeType{model.EntityTypeTypeCEM}, - port, certificate, time.Second*4, + cc.Port, certificate, time.Second*4, ) if err != nil { return nil, err diff --git a/server/eebus/types.go b/server/eebus/types.go index 43aef380d..db35d5c1a 100644 --- a/server/eebus/types.go +++ b/server/eebus/types.go @@ -15,7 +15,8 @@ type Certificate struct { } type Config struct { - URI string + URI_ string `mapstructure:"uri"` // TODO deprecated + Port int ShipID string Interfaces []string Certificate Certificate