Skip to content

Commit

Permalink
EEBUS fixes (#15962)
Browse files Browse the repository at this point in the history
- Update eebus libraries
- Fix measurements reported as not available if the last limitUpdate was >15s ago
  • Loading branch information
DerAndereAndi authored Sep 8, 2024
1 parent ede3cec commit d3f9ca3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
9 changes: 8 additions & 1 deletion charger/eebus.go
Original file line number Diff line number Diff line change
Expand Up @@ -578,10 +578,17 @@ func (c *EEBus) currents() (float64, float64, float64, error) {
c.mux.Unlock()

// if there is no measurement data available within 15 seconds after the last limit change, return an error
if d := ts.Sub(c.limitUpdated); d < 0 || d > 15*time.Second {
// only consider it an error, if there is no measurement data since 15 seconds after the last limit change
// a measurement only being available before the last limit change is not an error, because that can happen often
d := ts.Sub(c.limitUpdated)
if !c.limitUpdated.IsZero() && (d > 15*time.Second) {
return 0, 0, 0, api.ErrNotAvailable
}

// we got a valid measurement, reset the limitUpdate to zero
// otherwise frequent measurement updates will trigger an unwanted error as the time between those is > 15 seconds
c.limitUpdated = time.Time{}

res, err := c.uc.EvCem.CurrentPerPhase(evEntity)
if err != nil {
return 0, 0, 0, eebus.WrapError(err)
Expand Down
8 changes: 5 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ require (
github.com/cstockton/go-conv v1.0.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/enbility/go-avahi v0.0.0-20240829083637-9ae2ef5f5ed2 // indirect
github.com/enbility/zeroconf/v2 v2.0.0-20240827101515-f3956627c450 // indirect
github.com/fatih/color v1.17.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
Expand All @@ -138,7 +139,6 @@ require (
github.com/google/go-querystring v1.1.0 // indirect
github.com/gorilla/websocket v1.5.3 // indirect
github.com/grid-x/serial v0.0.0-20211107191517-583c7356b3aa // indirect
github.com/holoplot/go-avahi v0.0.0-20240210093433-b8dc0fc11e7e // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/influxdata/line-protocol v0.0.0-20210922203350-b1ad95c89adf // indirect
github.com/insomniacslk/xjson v0.0.0-20240821125711-1236daaf6808 // indirect
Expand Down Expand Up @@ -204,6 +204,8 @@ replace github.com/grid-x/modbus => github.com/evcc-io/modbus v0.0.0-20240503125

replace github.com/lorenzodonini/ocpp-go => github.com/evcc-io/ocpp-go v0.0.0-20240730071053-d69e53b0fce9

replace github.com/enbility/ship-go => github.com/enbility/ship-go v0.0.0-20240827103353-35c86c3ba136
replace github.com/enbility/ship-go => github.com/enbility/ship-go v0.0.0-20240904104254-04d944c4f825

replace github.com/enbility/eebus-go => github.com/enbility/eebus-go v0.0.0-20240827111001-330aad85c442
replace github.com/enbility/spine-go => github.com/enbility/spine-go v0.0.0-20240907194637-0024041a4f36

replace github.com/enbility/eebus-go => github.com/enbility/eebus-go v0.0.0-20240907200357-cd3e59d01934
16 changes: 8 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,14 @@ github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFP
github.com/eclipse/paho.mqtt.golang v1.5.0 h1:EH+bUVJNgttidWFkLLVKaQPGmkTUfQQqjOsyvMGvD6o=
github.com/eclipse/paho.mqtt.golang v1.5.0/go.mod h1:du/2qNQVqJf/Sqs4MEL77kR8QTqANF7XU7Fk0aOTAgk=
github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
github.com/enbility/eebus-go v0.0.0-20240827111001-330aad85c442 h1:Bl8nmcx2x55h+c0C+YNw5cYlUAbZsliDJWMV06Cjwls=
github.com/enbility/eebus-go v0.0.0-20240827111001-330aad85c442/go.mod h1:G9MOCaHFHx9nkOQkZfQvtkINB/wt5T7KuH/UaAQCSys=
github.com/enbility/ship-go v0.0.0-20240827103353-35c86c3ba136 h1:e6A5g8bFQkfyC56Md/4l95/uY7GPMYgTJGJ386OH5Aw=
github.com/enbility/ship-go v0.0.0-20240827103353-35c86c3ba136/go.mod h1:O5w7zpGEDgiW8tJXqT9hU3JjcBD4auKEHJrWVsz8yUw=
github.com/enbility/spine-go v0.6.2 h1:uxEUGLcaaA3PzkaTYTe4Ic64PElFlMQcfcES0O4Dk1c=
github.com/enbility/spine-go v0.6.2/go.mod h1:6AbRXzd0fLVGFJdT60YQACe1WskwdjiznCfljQ+Ud6s=
github.com/enbility/eebus-go v0.0.0-20240907200357-cd3e59d01934 h1:dqPRBE0JpbLmPfIhvqDMKKFJmCChHbN/zfu9YWwXtJc=
github.com/enbility/eebus-go v0.0.0-20240907200357-cd3e59d01934/go.mod h1:WhvimKG+DVyHRr4H++A+9c3F9AuuA7VJtLFo6m/BwxY=
github.com/enbility/go-avahi v0.0.0-20240829083637-9ae2ef5f5ed2 h1:voP4zFVNvVWxlV22T1EUAdZ0VlqVV1pkFLhoTTPgwbA=
github.com/enbility/go-avahi v0.0.0-20240829083637-9ae2ef5f5ed2/go.mod h1:KJXUEgg/b4XZzS+OFfqnykHREsinuNSL/IzJ+nU43P8=
github.com/enbility/ship-go v0.0.0-20240904104254-04d944c4f825 h1:i/n9UFYf660TyC8Y48P3MDxLaWWKRNW3pFjEOVzPzto=
github.com/enbility/ship-go v0.0.0-20240904104254-04d944c4f825/go.mod h1:dzymc1D7BDZUTLVHVt9JRRkFLlBrlUmRKyLJvAe07Mc=
github.com/enbility/spine-go v0.0.0-20240907194637-0024041a4f36 h1:Y44hzp5uIYSEyBMe/zwFzlXKokgZHQ9cv2NiIF1NkZs=
github.com/enbility/spine-go v0.0.0-20240907194637-0024041a4f36/go.mod h1:BDvhbs+XsWDGYwd8eQOzPXc8w/avVFmWKLlSKV/gx9k=
github.com/enbility/zeroconf/v2 v2.0.0-20240827101515-f3956627c450 h1:39tnpfiV5OVfYb9sOqYmoivBzTHyNLWSYIxd9Qng1eg=
github.com/enbility/zeroconf/v2 v2.0.0-20240827101515-f3956627c450/go.mod h1:1sUbJ+VE7yLNyRzGoCMjoDWtdZ+bW4aYBKx2+Rw+9hs=
github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g=
Expand Down Expand Up @@ -312,8 +314,6 @@ github.com/hasura/go-graphql-client v0.13.0 h1:mPYtqToLttIk/89hIHJYQgPShdBffrloC
github.com/hasura/go-graphql-client v0.13.0/go.mod h1:17qYcHgGSensF/wMAHKUhtMYaRZwZa3TyD7biqH9L3k=
github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec h1:qv2VnGeEQHchGaZ/u7lxST/RaJw+cv273q79D81Xbog=
github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec/go.mod h1:Q48J4R4DvxnHolD5P8pOtXigYlRuPLGl6moFx3ulM68=
github.com/holoplot/go-avahi v0.0.0-20240210093433-b8dc0fc11e7e h1:XOKmPp6CgtFByseoBaL5Ew9b6NWSie+nr6pMFeO0Tvc=
github.com/holoplot/go-avahi v0.0.0-20240210093433-b8dc0fc11e7e/go.mod h1:WRfsMEGa+MvsfqqKmS7Ye1jrnfRW6kfF/CTP9UMZj0Q=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
Expand Down

0 comments on commit d3f9ca3

Please sign in to comment.