Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DIvision by Zero error #88

Open
MicroDraco opened this issue Aug 26, 2024 · 4 comments
Open

DIvision by Zero error #88

MicroDraco opened this issue Aug 26, 2024 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@MicroDraco
Copy link

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
Copy link
Owner

krbaker commented Aug 26, 2024

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

@krbaker krbaker self-assigned this Aug 26, 2024
@krbaker krbaker added the bug Something isn't working label Nov 26, 2024
@chriswood1001
Copy link

I've begun to hit this identical error as well.
Nearly 2yrs without issue and now this "division by zero" issue blocks the custom integration from loading.

@chriswood1001
Copy link

The good news is that it self recovered after 48hrs without intervention.

@taylorbird
Copy link

I just started seeing this as well about 5 days ago, has not recovered. Havent dug in, just confirming its still an issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants
@taylorbird @krbaker @chriswood1001 @MicroDraco and others