Easee: publish total energy (#4741)

This commit is contained in:
andig 2022-10-06 16:14:40 +02:00 • committed by GitHub
parent 6057ce6632
commit d9e8161779
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -54,7 +54,7 @@ type Easee struct {
smartCharging bool
enabledStatus bool
phaseMode int
currentPower, sessionEnergy,
currentPower, sessionEnergy, totalEnergy,
currentL1, currentL2, currentL3 float64
rfid string
lp loadpoint.API
@ -278,6 +278,8 @@ func (c *Easee) observe(typ string, i json.RawMessage) {
c.currentPower = 1e3 * value.(float64)
case easee.SESSION_ENERGY:
c.sessionEnergy = value.(float64)
case easee.LIFETIME_ENERGY:
c.totalEnergy = value.(float64)
case easee.IN_CURRENT_T3:
c.currentL1 = value.(float64)
case easee.IN_CURRENT_T4:
@ -498,6 +500,16 @@ func (c *Easee) Currents() (float64, float64, float64, error) {
return c.currentL1, c.currentL2, c.currentL3, nil
}
var _ api.MeterEnergy = (*Easee)(nil)
// TotalEnergy implements the api.MeterEnergy interface
func (c *Easee) TotalEnergy() (float64, error) {
c.mux.L.Lock()
defer c.mux.L.Unlock()
return c.totalEnergy, nil
}
var _ api.Identifier = (*Easee)(nil)
// Currents implements the api.MeterCurrent interface