@@ -45,14 +45,16 @@ type MyPv struct {
4545}
4646
4747const (
48- elwaRegSetPower = 1000
49- elwaRegTempLimit = 1002
50- elwaRegStatus = 1003
51- elwaRegLoadState = 1059
52- elwaRegPower = 1000 // https://github.com/evcc-io/evcc/issues/18020#issuecomment-2585300804
48+ elwaRegSetPower = 1000
49+ elwaRegTempLimit = 1002
50+ elwaRegStatus = 1003
51+ elwaRegLoadState = 1059
52+ elwaRegPower = 1000 // https://github.com/evcc-io/evcc/issues/18020#issuecomment-2585300804
53+ elwaRegOperationState = 1077
5354)
5455
5556var elwaTemp = []uint16 {1001 , 1030 , 1031 }
57+ var elwaStandbyPower uint16 = 10
5658
5759func init () {
5860 // https://github.com/evcc-io/evcc/discussions/12761
@@ -183,7 +185,7 @@ func (wb *MyPv) Status() (api.ChargeStatus, error) {
183185 }
184186
185187 // ignore standby power
186- if binary .BigEndian .Uint16 (b ) == wb .statusC && binary .BigEndian .Uint16 (c ) > 10 {
188+ if binary .BigEndian .Uint16 (b ) == wb .statusC && binary .BigEndian .Uint16 (c ) > elwaStandbyPower {
187189 res = api .StatusC
188190 }
189191
@@ -192,15 +194,22 @@ func (wb *MyPv) Status() (api.ChargeStatus, error) {
192194
193195// Enabled implements the api.Charger interface
194196func (wb * MyPv ) Enabled () (bool , error ) {
195- b , err := wb .conn .ReadHoldingRegisters (elwaRegSetPower , 1 )
197+ b , err := wb .conn .ReadHoldingRegisters (elwaRegOperationState , 1 )
196198 if err != nil {
197199 return false , err
198200 }
199201
200- if binary .BigEndian .Uint16 (b ) == 0 {
201- wb .enabled = false
202+ switch binary .BigEndian .Uint16 (b ) {
203+ case
204+ 1 , // heating PV excess
205+ 2 : // boost backup
206+ return true , nil
207+ case
208+ 0 : // standby
209+ return false , nil
202210 }
203211
212+ // fallback to cached value as last resort
204213 return wb .enabled , nil
205214}
206215
0 commit comments