EEBus: expose machineid not available (#3727)
This commit is contained in:
parent
625b2e24f6
commit
d622b9b7d7
4 changed files with 13 additions and 9 deletions
2
go.mod
2
go.mod
|
|
@ -23,7 +23,7 @@ require (
|
|||
github.com/dustin/go-humanize v1.0.0
|
||||
github.com/dylanmei/iso8601 v0.1.0
|
||||
github.com/eclipse/paho.mqtt.golang v1.3.5
|
||||
github.com/evcc-io/eebus v0.0.0-20220403153356-c4f2bab5546f
|
||||
github.com/evcc-io/eebus v0.0.0-20220628095038-be707d322cfc
|
||||
github.com/fatih/structs v1.1.0
|
||||
github.com/foogod/go-powerwall v0.2.0
|
||||
github.com/go-ping/ping v1.1.0
|
||||
|
|
|
|||
4
go.sum
4
go.sum
|
|
@ -227,8 +227,8 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.m
|
|||
github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0=
|
||||
github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||
github.com/evcc-io/eebus v0.0.0-20220403153356-c4f2bab5546f h1:vk9CDuAuXJ2iy9My2Q34w6p/Qhq9yORG0RGvc1j6+0A=
|
||||
github.com/evcc-io/eebus v0.0.0-20220403153356-c4f2bab5546f/go.mod h1:2fJZDu2dSe7M6m+KIYkG5XPdk+Ws1ckuRyklZRvFzWE=
|
||||
github.com/evcc-io/eebus v0.0.0-20220628095038-be707d322cfc h1:yStUZv0hyUrRJuFx2n/p8Mz4m51QoxPX8DMprq9jPZQ=
|
||||
github.com/evcc-io/eebus v0.0.0-20220628095038-be707d322cfc/go.mod h1:2fJZDu2dSe7M6m+KIYkG5XPdk+Ws1ckuRyklZRvFzWE=
|
||||
github.com/fatih/camelcase v1.0.0/go.mod h1:yN2Sb0lFhZJUdVvtELVWefmrXpuZESvPmqwoZc+/fpc=
|
||||
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
||||
github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
|
||||
|
|
|
|||
|
|
@ -342,7 +342,7 @@ func (s *SEMP) serialNumber(id int) string {
|
|||
return fmt.Sprintf(sempSerialNumber, ser, id)
|
||||
}
|
||||
|
||||
// uniqueDeviceID creates a 6-bytes base device id from machine id
|
||||
// UniqueDeviceID creates a 6-bytes base device id from machine id
|
||||
func UniqueDeviceID() ([]byte, error) {
|
||||
bytes := 6
|
||||
|
||||
|
|
|
|||
|
|
@ -68,9 +68,13 @@ func NewEEBus(other map[string]interface{}) (*EEBus, error) {
|
|||
details := EEBusInstance.DeviceInfo()
|
||||
|
||||
log := util.NewLogger("eebus")
|
||||
id := server.UniqueID{Prefix: details.BrandName}.String()
|
||||
if len(cc.ShipID) > 0 {
|
||||
id = cc.ShipID
|
||||
|
||||
if len(cc.ShipID) == 0 {
|
||||
var err error
|
||||
cc.ShipID, err = ship.UniqueID(details.BrandName, "evcc-eebus")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
cert, err := tls.X509KeyPair(cc.Certificate.Public, cc.Certificate.Private)
|
||||
|
|
@ -83,7 +87,7 @@ func NewEEBus(other map[string]interface{}) (*EEBus, error) {
|
|||
Addr: cc.Uri,
|
||||
Path: "/ship/",
|
||||
Certificate: cert,
|
||||
ID: id,
|
||||
ID: cc.ShipID,
|
||||
Interfaces: cc.Interfaces,
|
||||
Brand: details.BrandName,
|
||||
Model: details.DeviceCode,
|
||||
|
|
@ -100,7 +104,7 @@ func NewEEBus(other map[string]interface{}) (*EEBus, error) {
|
|||
zc: zc,
|
||||
log: log,
|
||||
srv: srv,
|
||||
id: id,
|
||||
id: cc.ShipID,
|
||||
clients: make(map[string]EEBusClientCBs),
|
||||
connectedClients: make(map[string]ship.Conn),
|
||||
discoveredClients: make(map[string]*zeroconf.ServiceEntry),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue