nordpool icon indicating copy to clipboard operation
nordpool copied to clipboard

Prices not always updated after day change

Open Floppe opened this issue 1 year ago • 5 comments

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 ?

Floppe avatar Aug 09 '22 12:08 Floppe

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

petepalm avatar Aug 10 '22 06:08 petepalm

Same problem here

sippe2 avatar Aug 31 '22 00:08 sippe2

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.

PeterAndreS avatar Sep 19 '22 11:09 PeterAndreS

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.

jpulakka avatar Sep 23 '22 12:09 jpulakka

Fixed for me in: Home Assistant 2022.10.1

PeterAndreS avatar Oct 09 '22 07:10 PeterAndreS