Skip to content

Commit

Permalink
Merge pull request #301 from hultenvp/300-cannot-authenticatesetup
Browse files Browse the repository at this point in the history
Robustness against offline inverters
  • Loading branch information
hultenvp committed Jul 9, 2023
2 parents 6f5fb53 + 5ea46b5 commit e1e2abb
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions custom_components/solis/soliscloud_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
_LOGGER = logging.getLogger(__name__)

# VERSION
VERSION = '0.4.3'
VERSION = '0.4.4'

# API NAME
API_NAME = 'SolisCloud'
Expand Down Expand Up @@ -461,9 +461,13 @@ def _post_process(self) -> None:
# just making 0 voltage. So this is too simplistic.
# mypy trips over self_data[STRING_COUNT] as it could be of type str, int or float
# needs to be fixed at some point in time, but this works.
for i, stringlist in enumerate(STRING_LISTS):
if i > int(self._data[STRING_COUNT]):
self._purge_if_unused(0, *stringlist)
try:
for i, stringlist in enumerate(STRING_LISTS):
if i > int(self._data[STRING_COUNT]):
self._purge_if_unused(0, *stringlist)
except KeyError:
# Ignore offline inverters
pass

def _fix_units(self, num_key: str, units_key: str) -> None:
""" Convert numeric values according to the units reported by the API. """
Expand Down

0 comments on commit e1e2abb

Please sign in to comment.