Skip to content

Commit

Permalink
If inverter in alarm and variable read fails the api limit could be e…
Browse files Browse the repository at this point in the history
…xhausted (#269)

If an inverter is in alarm, and the api call to read the real time variables fails as a result, retrying every 1 minute would cause the integration to burn through api calls every minute - this state has been corrected to retry no more than every 5 minutes.
  • Loading branch information
FozzieUK1 authored Sep 20, 2024
1 parent 01ca885 commit d29c540
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions custom_components/foxess/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,15 @@ async def async_update_data():
_LOGGER.debug("getReport False")
else:
_LOGGER.debug("getRaw False")
if statetest==2:
# The inverter is in alarm, don't check every minute
_LOGGER.debug(f" Inverter in alarm, slowing retry response for SN:{deviceSN}")
else:
# The get variables api call failed, leave it 5 minutes
_LOGGER.debug(f" Failed to get device variables, slowing retry response for SN:{deviceSN}")
allData["online"] = False
getError = False
TSlice = 25 # forces a retry on device detail in 5 minutes
else:
if statetest==3:
# The inverter is off-line, no raw data polling, don't update entities
Expand Down

0 comments on commit d29c540

Please sign in to comment.