Skip to content

Commit

Permalink
Fix stale AC power value when inverter offline (#355)
Browse files Browse the repository at this point in the history
Fixes stale or undefined AC Power value when inverter offline and time is PM.
  • Loading branch information
hozob authored Mar 22, 2024
1 parent 5ac3c21 commit cef6dbf
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions custom_components/solis/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,12 @@ async def update_devices(self, data: GinlongData) -> None:
for attribute in data.keys():
if attribute in self._subscriptions[serial]:
value = getattr(data, attribute)
if attribute == INVERTER_ENERGY_TODAY or attribute == INVERTER_ACPOWER:
# Energy_today and AC power are not reset at midnight, but in the

if attribute == INVERTER_ACPOWER and getattr(data, INVERTER_STATE) == 2:
# Overriding stale AC Power value when inverter is offline
value = 0
elif attribute == INVERTER_ENERGY_TODAY:
# Energy_today is not reset at midnight, but in the
# morning at sunrise when the inverter switches back on. This
# messes up the energy dashboard. Return 0 while inverter is
# still off.
Expand Down

0 comments on commit cef6dbf

Please sign in to comment.