Skip to content

Prices not always updated after day change #178

@Floppe

Description

@Floppe

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 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions