Use improved loadpoint api
This commit is contained in:
parent
b88ec450e0
commit
781f19b8c4
1 changed files with 5 additions and 14 deletions
|
|
@ -383,23 +383,14 @@ func (s *SEMP) allDeviceInfo() (res []DeviceInfo) {
|
|||
}
|
||||
|
||||
func (s *SEMP) deviceStatus(id int, lp core.LoadPointAPI) DeviceStatus {
|
||||
var chargePower float64
|
||||
if chargePowerP, err := s.cache.GetChecked(id, "chargePower"); err == nil {
|
||||
chargePower = chargePowerP.Val.(float64)
|
||||
}
|
||||
chargePower := lp.GetChargePower()
|
||||
|
||||
isPV := false
|
||||
if modeP, err := s.cache.GetChecked(id, "mode"); err == nil {
|
||||
if mode, ok := modeP.Val.(api.ChargeMode); ok && (mode == api.ModeMinPV || mode == api.ModePV) {
|
||||
isPV = true
|
||||
}
|
||||
}
|
||||
mode := lp.GetMode()
|
||||
isPV := mode == api.ModeMinPV || mode == api.ModePV
|
||||
|
||||
status := StatusOff
|
||||
if statusP, err := s.cache.GetChecked(id, "charging"); err == nil {
|
||||
if statusP.Val.(bool) {
|
||||
status = StatusOn
|
||||
}
|
||||
if lp.GetStatus() == api.StatusC {
|
||||
status = StatusOn
|
||||
}
|
||||
|
||||
var hasVehicle bool
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue