Support decoding EM-CP/EV-CC meter readings (#714)

This commit is contained in:
andig 2021-03-02 14:54:53 +01:00
parent 1b5b8e283f
commit a29bfdbb2e

View file

@ -1,13 +1,13 @@
package charger
import (
"encoding/binary"
"fmt"
"time"
"github.com/andig/evcc/api"
"github.com/andig/evcc/util"
"github.com/andig/evcc/util/modbus"
"github.com/volkszaehler/mbmd/meters/rs485"
)
const (
@ -144,8 +144,7 @@ func (wb *PhoenixEMCP) ChargingTime() (time.Duration, error) {
}
func (wb *PhoenixEMCP) decodeReading(b []byte) float64 {
v := binary.BigEndian.Uint32(b)
return float64(v)
return rs485.RTUUint32ToFloat64Swapped(b) / 100
}
// CurrentPower implements the Meter.CurrentPower interface