krbaker / hass-sunpower

Home Assistant SunPower Integration using the local installer ethernet interface.
Apache License 2.0
61 stars 23 forks source link

DIvision by Zero error #88

Open MicroDraco opened 1 month ago

MicroDraco commented 1 month ago

The connection between the RPi and home assistant dropped while the solar panels were not producing anything. When the integration tried to reconnect, it fails repeatedly with the following error.

This error originated from a custom integration.

Logger: custom_components.sunpower Source: helpers/update_coordinator.py:312 integration: SunPower (documentation, issues) First occurred: 12:59:59 AM (161660 occurrences) Last logged: 1:14:11 AM

Unexpected error fetching SunPower PVS data Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 312, in _async_refresh self.data = await self._async_update_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 268, in _async_update_data return await self.update_method() ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/sunpower/init.py", line 348, in async_update_data return await hass.async_add_executor_job( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/sunpower/init.py", line 287, in sunpower_fetch data = convert_sunpower_data(sunpower_data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/sunpower/init.py", line 105, in convert_sunpower_data create_vmeter(data) File "/config/custom_components/sunpower/init.py", line 74, in create_vmeter freq_avg = sum(freq) / len(freq)


ZeroDivisionError: division by zero

The connection cannot be re-established.
krbaker commented 1 month ago

interesting its not getting any frequency measurements but also 'duh' that shouldn't be dividing that way unprotected.