nordpool
nordpool copied to clipboard
Prices not always updated after day change
Version of the custom_component
0.0.7
Homeassistant version
2022.7.4
Describe the bug
Sometime when day changes then the prices are not updated. Have started to happen more frequent these days.
This is logged every hour until I restart HA and it starts to work again.
Debug log
2022-08-09 09:00:00 ERROR (MainThread) [homeassistant.util.logging] Exception in check_stuff when dispatching 'nordpool_update': ()
Traceback (most recent call last):
File "/usr/local/lib/python3.10/statistics.py", line 258, in _exact_ratio
return (x.numerator, x.denominator)
AttributeError: 'NoneType' object has no attribute 'numerator'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/config/custom_components/nordpool/sensor.py", line 460, in check_stuff
self._update(self._data_today)
File "/config/custom_components/nordpool/sensor.py", line 314, in _update
self._peak = mean(peak)
File "/usr/local/lib/python3.10/statistics.py", line 329, in mean
T, total, count = _sum(data)
File "/usr/local/lib/python3.10/statistics.py", line 188, in _sum
for n, d in map(_exact_ratio, values):
File "/usr/local/lib/python3.10/statistics.py", line 261, in _exact_ratio
raise TypeError(msg)
TypeError: can't convert type 'NoneType' to numerator/denominator
Perhaps related to #127 ?
I've had the same problem for about a week. Tried to reinstall too but with no luck.
edit: Thinking that could be same issue as #125
Same problem here
At midnight, there are only (wrong) values for the first hour for both days. The rest of the fields are empty. A restart of HA is required.
This is very likely closely related to https://github.com/custom-components/nordpool/issues/125 which has apparently been fixed in https://github.com/custom-components/nordpool/pull/127 almost half year ago but somehow that fix has still not been merged to master.
One approach could be just using https://github.com/custom-components/nordpool/tree/fix-1 branch until it gets merged.
Fixed for me in: Home Assistant 2022.10.1