Skip to content

Commit

Permalink
Cfos: Fix register usage (evcc-io#156)
Browse files Browse the repository at this point in the history
Should hopefully fix evcc-io#1809
  • Loading branch information
premultiply authored and dontbyte committed Aug 2, 2022
1 parent ca859ee commit f75cbbc
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions charger/cfos.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
)

const (
cfosRegStatus = 8092 // Input
cfosRegStatus = 8092 // Holding
cfosRegMaxCurrent = 8093 // Holding
cfosRegEnable = 8094 // Coil
cfosRegEnable = 8094 // Holding
)

// CfosPowerBrain is an charger implementation for cFos PowerBrain wallboxes.
Expand Down Expand Up @@ -72,7 +72,7 @@ func (wb *CfosPowerBrain) Status() (api.ChargeStatus, error) {
return api.StatusNone, err
}

switch b[0] {
switch b[1] {
case 0: // warten
return api.StatusA, nil
case 1: // Fahrzeug erkannt
Expand All @@ -97,7 +97,7 @@ func (wb *CfosPowerBrain) Enabled() (bool, error) {
return false, err
}

return b[0] == 1, nil
return b[1] == 1, nil
}

// Enable implements the Charger.Enable interface
Expand All @@ -107,7 +107,7 @@ func (wb *CfosPowerBrain) Enable(enable bool) error {
u = 1
}

_, err := wb.conn.WriteSingleCoil(cfosRegEnable, u)
_, err := wb.conn.WriteSingleRegister(cfosRegEnable, u)

return err
}
Expand Down

0 comments on commit f75cbbc

Please sign in to comment.