Add soc to logging
This commit is contained in:
parent
1dff1a9f13
commit
f0d09a2c5c
2 changed files with 9 additions and 0 deletions
|
|
@ -34,6 +34,14 @@ func dumpAPIs(v interface{}) {
|
|||
}
|
||||
}
|
||||
|
||||
if v, ok := v.(api.Battery); ok {
|
||||
if soc, err := v.SoC(); err != nil {
|
||||
fmt.Printf("SoC: %v\n", err)
|
||||
} else {
|
||||
fmt.Printf("SoC: %.0f%%\n", soc)
|
||||
}
|
||||
}
|
||||
|
||||
if v, ok := v.(api.ChargeRater); ok {
|
||||
if energy, err := v.ChargedEnergy(); err != nil {
|
||||
fmt.Printf("Charged: %v\n", err)
|
||||
|
|
|
|||
|
|
@ -322,6 +322,7 @@ func (site *Site) sitePower() (float64, error) {
|
|||
if err != nil {
|
||||
site.log.ERROR.Printf("updating battery soc: %v", err)
|
||||
} else {
|
||||
site.log.DEBUG.Printf("battery soc: %.0f%%", soc)
|
||||
site.publish("batterySoC", soc)
|
||||
|
||||
// if battery is charging give it priority
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue