split() in control_const.py contains an off-by-one error that causes IndexError when the SolisCloud API returns a value with fewer segments than expected. This crashes setup of the number and time platforms, leaving those entities unavailable and stopping the integration's polling loop entirely.
Affected version: v4.0.1 (current latest)
Error:
File "custom_components/solis/number.py", line 105, in do_update
value = self.split(value)
File "custom_components/solis/control_const.py", line 82, in split
return values[self._index]
IndexError: list index out of range
Root cause: Line 81 uses <= instead of <:
# buggy
if self._index <= len(values):
return values[self._index] # IndexError when index == len(values)
Fix:
if self._index < len(values):
return values[self._index]
Impact: When SolisCloud returns fewer split segments than expected for a register (e.g. during inverter startup or API hiccup), the entire integration stops updating. Sensors remain stale until a manual reload.
split()incontrol_const.pycontains an off-by-one error that causesIndexErrorwhen the SolisCloud API returns a value with fewer segments than expected. This crashes setup of thenumberandtimeplatforms, leaving those entities unavailable and stopping the integration's polling loop entirely.Affected version: v4.0.1 (current latest)
Error:
Root cause: Line 81 uses
<=instead of<:Fix:
Impact: When SolisCloud returns fewer split segments than expected for a register (e.g. during inverter startup or API hiccup), the entire integration stops updating. Sensors remain stale until a manual reload.