Innogy: add api.MeterEnergy
This commit is contained in:
parent
33aa8841bb
commit
da4af01d73
1 changed files with 13 additions and 0 deletions
|
|
@ -35,6 +35,7 @@ const (
|
|||
igyRegManufacturer = 100 // Input
|
||||
igyRegFirmware = 200 // Input
|
||||
igyRegStatus = 275 // Input
|
||||
igyRegEnergy = 307 // Input
|
||||
igyRegCurrents = 1006 // current readings per phase
|
||||
)
|
||||
|
||||
|
|
@ -163,6 +164,18 @@ func (wb *Innogy) CurrentPower() (float64, error) {
|
|||
return 230 * (l1 + l2 + l3), err
|
||||
}
|
||||
|
||||
var _ api.MeterEnergy = (*Innogy)(nil)
|
||||
|
||||
// TotalEnergy implements the api.MeterEnergy interface
|
||||
func (wb *Innogy) TotalEnergy() (float64, error) {
|
||||
b, err := wb.conn.ReadInputRegisters(igyRegEnergy, 2)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
return float64(math.Float32frombits(binary.BigEndian.Uint32(b))), nil
|
||||
}
|
||||
|
||||
var _ api.PhaseCurrents = (*Innogy)(nil)
|
||||
|
||||
// Currents implements the api.PhaseCurrents interface
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue