custom-components / nordpool

This component allows you to pull in the energy prices into Home-Assistant.
444 stars 105 forks source link

Values for tomorrow are null #125

Closed alexschwantes closed 1 year ago

alexschwantes commented 2 years ago

As per #85, I'm raising a new issue with logs attached. It also appears to reference #82

Version of the custom_component

Latest version 0.0.4

Homeassistant version

Home Assistant 2022.2.0

Configuration


logger:
  default: info
  logs:
    nordpool: debug
    custom_components.nordpool: debug
    custom_components.nordpool.sensor: debug
    custom_components.nordpool.aio_price: debug

sensor:
  - platform: nordpool
    region: "Oslo"
    currency: "NOK"

Describe the bug

Tomorrow's values fail to update. If I restart the system it works, but after a day, it no longer updates.

It appears that it first tries to check for tomorrow's price at 13:10:46 on the current day, which returns a value of 'inf', then it checks every hour and continues to fail. The first time it checkts, it logs a json response where all the values are 'inf', in all the other times (every hour) there doesn't appear to be a json response (at least not logged).

Is the first check for tomorrows values at the expected time of just after 13:00? Shouldn't it be some time after 14:00?

I'm also referencing #82 as it appears that tomorrow valid field is set to 'true' even though all values for tomorrow are null.

Without knowing too much of the workings of the plugin, it seems like there could be multiple issues, 1. with when to first check for the updated values, and 2. being able to check for values at a later stage (as the plugin is in an inconsistent error state potentially regarding the tomorrow valid state..).

Debug log

Received a generic warning Setup of sensor platform nordpool is taking over 10 seconds. in addition to the logs below:

.......

2022-03-18 13:00:00 DEBUG (MainThread) [custom_components.nordpool] Called new_hr callback
2022-03-18 13:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] called check_stuff
2022-03-18 13:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] NordpoolSensor _data_tomorrow is none, trying to fetch it.
2022-03-18 13:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] Updated nordpool_kwh_oslo_nok_3_10_025 _current_price 1799.01

...

2022-03-18 13:10:46 DEBUG (MainThread) [custom_components.nordpool] Called new_data_cb
2022-03-18 13:10:46 DEBUG (MainThread) [custom_components.nordpool] Updating tomorrows prices.
2022-03-18 13:10:46 DEBUG (MainThread) [custom_components.nordpool] calling _update tomorrow 2022-03-19 13:10:46.005477+01:00
2022-03-18 13:10:46 DEBUG (MainThread) [custom_components.nordpool.aio_price] requested https://www.nordpoolgroup.com/api/marketdata/page/10?currency=NOK&endDate=18-03-2022 {'currency': 'NOK', 'endDate': '18-03-2022'}
2022-03-18 13:10:46 DEBUG (MainThread) [custom_components.nordpool.aio_price] requested https://www.nordpoolgroup.com/api/marketdata/page/10?currency=NOK&endDate=17-03-2022 {'currency': 'NOK', 'endDate': '17-03-2022'}
2022-03-18 13:10:46 DEBUG (MainThread) [custom_components.nordpool.aio_price] requested https://www.nordpoolgroup.com/api/marketdata/page/10?currency=NOK&endDate=19-03-2022 {'currency': 'NOK', 'endDate': '19-03-2022'}
2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.aio_price] join_result_for_correct_time 2022-03-19 13:10:46.005477+01:00
2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.aio_price] Combines result: defaultdict(<class 'dict'>, {'areas': {'SYS': {'Min': inf, 'Max': inf, 'Average': inf, 'Peak': inf, 'Off-peak 1': inf, 'Off-peak 2': inf, 'values': [{'start': datetime.datetime(2022, 3, 18, 23, 0, tzinfo=<UTC>), 'end': datetime.datetime(2022, 3, 19, 0, 0, tzinfo=<UTC>), 'value': inf}, {'start': datetime.datetime(2022, 3, 19, 0, 0, tzinfo=<UTC>), 'end': datetime.datetime(2022, 3, 19, 1, 0, tzinfo=<UTC>), 'value': inf}, {'start': datetime.datetime(2022, 3, 19, 1, 0, tzinfo=<UTC>), 'end': datetime.datetime(2022, 3, 19, 2, 0, tzinfo=<UTC>), 'value': inf}, {'start': datetime.datetime(2022, 3, 19, 2, 0, tzinfo=<UTC>), 'end': datetime.datetime(2022, 3, 19, 3, 0, tzinfo=<UTC>), 'value': inf}, {'start': datetime.datetime(2022, 3, 19, 3, 0, tzinfo=<UTC>), 'end': datetime.datetime(2022, 3, 19, 4, 0, tzinfo=<UTC>), 'value': inf}, {'start': datetime.datetime(2022, 3, 19, 4, 0, tzinfo=<UTC>), 'end': datetime.datetime(2022, 3, 19, 5, 0, tzinfo=<UTC>), 'value': inf}, {'start': datetime.datetime(2022, 3, 19, 5, 0, tzinfo=<UTC>), 'end': datetime.datetime(2022, 3, 19, 6, 0, tzinfo=<UTC>), 'value': inf}, {'start': datetime.datetime(2022, 3, 19, 6, 0, tzinfo=<UTC>), 'end': datetime.datetime(2022, 3, 19, 7, 0, tzinfo=<UTC>), 'value': inf}, {'start': datetime.datetime(2022, 3, 19, 7, 0, tzinfo=<UTC>), 'end': datetime.datetime(2022, 3, 19, 8, 0, tzinfo=<UTC>), 'value': inf}, {'start': datetime.datetime(2022, 3, 19, 8, 0, tzinfo=<UTC>), 'end': datetime.datetime(2022, 3, 19, 9, 0, tzinfo=<UTC>), 'value': inf}, {'start': datetime.datetime(2022, 3, 19, 9, 0, tzinfo=<UTC>), 'end': datetime.datetime(2022, 3, 19, 10, 0, tzinfo=<UTC>), 'value': inf}, {'start': datetime.datetime(2022, 3, 19, 10, 0, tzinfo=<UTC>), 'end': datetime.datetime(2022, 3, 19, 11, 0, tzinfo=<UTC>), 'value': inf}, {'start': datetime.datetime(2022, 3, 19, 11, 0, tzinfo=<UTC>), 'end': datetime.datetime(2022, 3, 19, 12, 0, tzinfo=<UTC>), 'value': inf}, {'start': datetime.datetime(2022, 3, 19, 12, 0, tzinfo=<UTC>), 'end': datetime.datetime(2022, 3, 19, 13, 0, tzinfo=<UTC>), 'value': inf}, {'start': datetime.datetime(2022, 3, 19, 13, 0, tzinfo=<UTC>), 'end': datetime.datetime(2022, 3, 19, 14, 0, tzinfo=<UTC>), 'value': inf}, {'start': datetime.datetime(2022, 3, 19, 14, 0, tzinfo=<UTC>), 'end': datetime.datetime(2022, 3, 19, 15, 0, tzinfo=<UTC>), 'value': inf}, {'start': datetime.datetime(2022, 3, 19, 15, 0, tzinfo=<UTC>), 'end': datetime.datetime(2022, 3, 19, 16, 0, tzinfo=<UTC>), 'value': inf}, {'start': datetime.datetime(2022, 3, 19, 16, 0, tzinfo=<UTC>), 'end': datetime.datetime(2022, 3, 19, 17, 0, tzinfo=<UTC>), 'value': inf}, {'start': datetime.datetime(2022, 3, 19, 17, 0, tzinfo=<UTC>), 'end': datetime.datetime(2022, 3, 19, 18, 0, tzinfo=<UTC>), 'value': inf}, {'start': datetime.datetime(2022, 3, 19, 18, 0, tzinfo=<UTC>), 'end': datetime.datetime(2022, 3, 19, 19, 0, tzinfo=<UTC>), 'value': inf}, {'start': datetime.datetime(2022, 3, 19, 19, 0, tzinfo=<UTC>), 'end': datetime.datetime(2022, 3, 19, 20, 0, tzinfo=<UTC>), 'value': inf}, {'start': datetime.datetime(2022, 3, 19, 20, 0, tzinfo=<UTC>), 'end': datetime.datetime(2022, 3, 19, 21, 0, tzinfo=<UTC>), 'value': inf}, {'start': datetime.datetime(2022, 3, 19, 21, 0, tzinfo=<UTC>), 'end': datetime.datetime(2022, 3, 19, 22, 0, tzinfo=<UTC>), 'value': inf}, {'start': datetime.datetime(2022, 3, 19, 22, 0, tzinfo=<UTC>), 'end': datetime.datetime(2022, 3, 19, 23, 0, tzinfo=<UTC>), 'value': inf}]}, 'SE1': {'Min': inf, 'Max': inf, 'Average': inf, 'Peak': inf, 'Off-peak 1': inf, 'Off-peak 2': inf, 'values': [{'start': datetime.datetime(2022, 3, 18, 23, 0, tzinfo=<UTC>), 'end': datetime.datetime(2022, 3, 19, 0, 0, tzinfo=<UTC>), 'value': inf}, {'start': datetime.datetime(2022, 3, 19, 0, 0, tzinfo=<UTC>), 'end': datetime.datetime(2022, 3, 19, 1, 0, tzinfo=<UTC>), 'value': inf}, {'start': datetime.datetime(2022, 3, 19, 1, 0, tzinfo=<UTC>), 'end': datetime.datetime(2022, 3, 19, 2, 0, tzinfo=<UTC>), 'value': inf}, {'start': datetime.datetime(2022, 3, 19, 2, 0, tzinfo=<UTC>), 'end': datetime.datetime(2022, 3, 19, 3, 0, tzinfo=<UTC>), 'value': inf}, {'start': datetime.datetime(2022, 3, 19, 3, 0, tzinfo=<UTC>), 'end': 

[I cropped the JSON it as it was too long to post]
....

2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.sensor] called check_stuff
2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.sensor] NordpoolSensor _data_tomorrow is none, trying to fetch it.
2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.sensor] Updated nordpool_kwh_oslo_nok_3_10_025 _current_price 1799.01
2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 13:10:47 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf

....

2022-03-18 14:00:00 DEBUG (MainThread) [custom_components.nordpool] Called new_hr callback
2022-03-18 14:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] called check_stuff
2022-03-18 14:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] Updated nordpool_kwh_oslo_nok_3_10_025 _current_price 1792.41
2022-03-18 14:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 14:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 14:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 14:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 14:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 14:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 14:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 14:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 14:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 14:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 14:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 14:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 14:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 14:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 14:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 14:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 14:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 14:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 14:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 14:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 14:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 14:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 14:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 14:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 14:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 14:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 14:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 14:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 14:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 14:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 14:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 14:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 14:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 14:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 14:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 14:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 14:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 14:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 14:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 14:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 14:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 14:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 14:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 14:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 14:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 14:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 14:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 14:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf

...

2022-03-18 15:00:00 DEBUG (MainThread) [custom_components.nordpool] Called new_hr callback
2022-03-18 15:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] called check_stuff
2022-03-18 15:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] Updated nordpool_kwh_oslo_nok_3_10_025 _current_price 1793.38
2022-03-18 15:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 15:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 15:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 15:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 15:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 15:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 15:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 15:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 15:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 15:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 15:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 15:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 15:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 15:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 15:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 15:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 15:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 15:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 15:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 15:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 15:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 15:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 15:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 15:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 15:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 15:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 15:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 15:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 15:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 15:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 15:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 15:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 15:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 15:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 15:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 15:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 15:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 15:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 15:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 15:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 15:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 15:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 15:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 15:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 15:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 15:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 15:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
2022-03-18 15:00:00 DEBUG (MainThread) [custom_components.nordpool.sensor] api returned junk infinty inf
Hellowlol commented 2 years ago

Thanks for a awesome bug report. Your right that there are multiple issues they are all related to missing info from the api. Reload the sensors and see if i got time for a fix in sunday

nichlasholmen commented 2 years ago

Hi, this link might help to understand the problem. https://developers.nordpoolgroup.com/docs/da-introduction?fbclid=IwAR1ibGErGfykbqXbhyz834AIUdhtXx8w7iU6Cgu6m9Rgjmn9P2TwTjY1v64

kjbu commented 2 years ago

Hi, this link might help to understand the problem. https://developers.nordpoolgroup.com/docs/da-introduction?fbclid=IwAR1ibGErGfykbqXbhyz834AIUdhtXx8w7iU6Cgu6m9Rgjmn9P2TwTjY1v64

I have got the same error, and the link you found seems to be the cause. Crossing our fingers that @Hellowlol is able to fix it quickly

Seems that Nordpool has closed down the API used in our sensor, and switched to the new API: https://developers.nordpoolgroup.com/docs/introduction-1

raudraido commented 2 years ago

Ok, now I also do not have tomorrows prices? Is there any fix? EDIT: After nordpool app reload, tomorrows prices appeared again

kjbu commented 2 years ago

@raudraido : It will fail again tomorrow. I have had the error every day the past 2-3 days.

Leatherface75 commented 2 years ago

Same problem here

niklascp commented 2 years ago

Can also confirm this problem for DK2 - started a couple of days ago. If I restart HA the prices will appear, but if will fail the following day.

jonasbkarlsson commented 2 years ago

This problem seems to be solvable. However, I'm more concerned about that now Nordpool has officially depreciated this API. It can completely stop working any day. I remember reading a statement from them a year ago or so, that they were considering to offer a limited API for free for personal (non-profit) use. But I haven't seen anything about that lately.

raudraido commented 2 years ago

Maybe it is possible to integrate FI,EE,LV,LT market data from link bellow. I was using it before I found this nordpool app. https://dashboard.elering.ee/assets/api-doc.html#/nps-controller

rihokirss commented 2 years ago

I also havent seen update notifications from their own app couple of days.

dogmatic69 commented 2 years ago

Also started experiencing this issue. Seems the data is fixed after "reloading" the integration so would it not solve for now to make the coordinator run more frequently than what seems to be once per day currently.

eg: run it every 5 minutes and if the values are not empty do the actual request otherwise do a NOOP.

Alternatively is there a way to automate the reload of an integration through a service call or similar?

dogmatic69 commented 2 years ago

duplicate of #124?

Inrego commented 2 years ago

Anyone else experienced it again now?

rihokirss commented 2 years ago

Same

mikke49 commented 2 years ago

Been working fine since 20 March, then failed again yesterday.

TSA19 commented 2 years ago

Now it seams like it is totally dead.. 😭

Inrego commented 2 years ago

Reload the integration will bring back values for tomorrow (if set up from interface rather than yaml)

TSA19 commented 2 years ago

Had to delete it complety and reistall it, then it worked :-) But it seams like when using setup from yaml it will not work... So I have no ideas on how to add aditional dost now :-(

kjbu commented 2 years ago

I have nordpool sensor configured in yaml. Tried just a restart of Templates, that didn't work. But restart of Home Assistant solved it for me. I got tomorrow values without need to reinstall the nordpool sensor.

But something is wrong since we have to restart Home Assistant quite often to get the integration to work again. Crossing our fingers that @Hellowlol can spend his time to fix the sensor.

dogmatic69 commented 2 years ago

I use HACS and simply "reload" the integration and things are good again. Kinda annoying, might do an automation to reload it :D

alexschwantes commented 2 years ago

So it has been working reliably for me of late, although I did make 1 change in the code. I set it back from updating at 13:00ish to 14:00ish to run the update. This is a crude hack of course, and the better option if you want to test things out is to try the code from #127 which is looking to make it more reliable.

nordpool/init.py

        # Handles futures updates
        cb_update_tomorrow = async_track_time_change_in_tz(
            hass,
            new_data_cb,
            hour=14, // **** Changed this value from 13 to 14
            minute=RANDOM_MINUTE,
            second=RANDOM_SECOND,
            tz=timezone("Europe/Stockholm"),
        )
dogmatic69 commented 2 years ago

Instead of checking once at a particular time it should run every 5 minutes or similar and if there is already data simply do a NOOP.

If the system is down at 14:00 for one minute then your "fix" won't work 🤷🏻

yksxjan commented 2 years ago

So it has been working reliably for me of late, although I did make 1 change in the code. I set it back from updating at 13:00ish to 14:00ish to run the update. This is a crude hack of course, and the better option if you want to test things out is to try the code from #127 which is looking to make it more reliable.

nordpool/init.py

        # Handles futures updates
        cb_update_tomorrow = async_track_time_change_in_tz(
            hass,
            new_data_cb,
            hour=14, // **** Changed this value from 13 to 14
            minute=RANDOM_MINUTE,
            second=RANDOM_SECOND,
            tz=timezone("Europe/Stockholm"),
        )

worked for me as a temporary fix at least :)

alexschwantes commented 2 years ago

Instead of checking once at a particular time it should run every 5 minutes or similar and if there is already data simply do a NOOP.

If the system is down at 14:00 for one minute then your "fix" won't work 🤷🏻

@dogmatic69 Yes that is correct, which is why I called it a crude hack until the new version is released that does properly check the api response and retries as required.

riksarchen commented 2 years ago

I’m having this issue as per today. Tomorrow values are null and it doesn’t help by reloading the plugin

Hellowlol commented 2 years ago

@riksarchen please open a new issue using the issue template. Reload should work, if it don’t is most likely another problem.

gfrancesco commented 2 years ago

I also still have this issue, since several months actually. Tomorrows prices were null today, only way to get them was to restart HA.

How do you folks reload the plugin?

dogmatic69 commented 2 years ago

integration -> nordpool -> reload

gfrancesco commented 2 years ago

Mhh, mine is installed via HACS and I don't have that option, but I can see it for the official integrations 🤔

Inrego commented 2 years ago

Go to Configuration -> Devices & Services Find Nordpool and click the 3 little dots

image

And then click reload

image

This is only possible if you configured with GUI. Not with yaml configuration.

gfrancesco commented 2 years ago

That explains it, I have mine configured via YAML and if I go to Configuration -> Devices & Services (where your screenshots are from) it's not there, it's in HACS -> Integrations and there is no Reload option from there. Thanks for helping, mystery solved :)

meljas commented 2 years ago

Have seen this once during ~May to end-Jun use of this 0.0.7. Couldn't reload as I have nordpool added via HACS (and there's no reload in that case afaik). And as it's been stated reloading isn't the correct way to solve it. I'm surprised that @Hellowlol has managed to do this this far but hasn't been able to fix this (critical) bug. For me it seems that tomorrow prices (tomorrow_valid) is considered ok without checking the result and it cannot be fixed in that class but requires another interface from sensor to set to true if received & it contains no null's. In my case I had only the first price and the rest were nulls and tomorrow valis stated true. It's clear that it needs to be flagged false in that case (check_stuff).

I wanted to have to have trigger if current price/max(next 8 (adjustable) hour prices) is less that 0.2 (adjustable), and wanted to do that without touching nordpool code... was able to do that finally by using python_scripts but now ended up having own version for this anyway (because of this bug). Dunno if it works really so I'm just waiting to see it fail again and then fix again... But anyway thanks for the integration anyway, it's essential !

meljas commented 2 years ago

Or the reason for this is somehow the inadequete precision ... default 3 in there clearly isn't enough. Also, wouldn't make sensor name (& unique id I guess) to include precision as it creates new sensor when you increase precision. Why precision needs to be an configurable option, why not just use 8 or something in there ?

Hellowlol commented 2 years ago

@meljas having 8 digits would be way to much. It looks really ugly and 3 is more the enough imo. That’s why 3 is default. I added the possibility to have it configurable since some people uses other currency or unit where it might make more sense to have more digit’s. Setup the sensor in the ui and you can use reload. It has nothing to do with hacs..

Feel free to send a pr on all the things you complain about.

jmartensson commented 2 years ago

Are there any more information regarding this? I installed nordpool last week and have had these issues every day since.

meljas commented 2 years ago

I fixed it as follows:

init,py (comment the line commented) async def update_tomorrow(self, n: datetime): _LOGGER.debug("Updating tomorrows prices.") await self.update(type="tomorrow", dt=dt_utils.now() + timedelta(hours=24))

self._tomorrow_valid = True

(add) def set_tomorrow_valid(self, state) -> None: self._tomorrow_valid = state

sensor.py (few changes in check_stuff): if self._data_tomorrow is None or None in self._data_tomorrow: _LOGGER.debug("NordpoolSensor _data_tomorrow is none, trying to fetch it.") tomorrow = await self._api.tomorrow(self._area, self._currency) if tomorrow: self._data_tomorrow = tomorrow if not None in self._data_tomorrow: self._api.set_tomorrow_valid(True) else: self._api.set_tomorrow_valid(False)

I had forgotten this just and let it update the integration -> lost these and error came back so added these back and seems to work again now.

Regarding digits: 3 is certainly not enough since that causes the price to show zero causing errors. I use 4 now. But anyway I don't consider it good to configure digits based on what it looks like. You need to have as much needed to calculate correcly and then only round when showing something on UI. Minimum for Finland from one year back is now 0.01snt/kWh which is 0.0001EUR/kWh rounded with 3 gives 0... I originally thought that 0 price is not possible until some days back read that even negative prices can happen (maybe not during these days .. ) so that'd likely bring up new errors here and there.

yozik04 commented 2 years ago

Yes. Negative prices are possible. In EE we had -0.00173 EUR/kWh on 2020-11-02.

dogmatic69 commented 2 years ago

While the supply may be negative, remember there is usually a "delivery" fee / kWh also.

zama737 commented 1 year ago

Got values lost today as well. It did show tomorrow_raw: 21.3,,,,,,,,,,,,,,,,; so there was only one value for tomorrow, but still tomorrow_valid=true.

Seems to be fixed by method @meljas, thanks!

Home Assistant 2022.11.2, Supervisor 2022.10.2, Frontend 20221108.0 - latest

  1. Had custom component defined in yaml --> Had issue.
  2. Installed integration --> New nordpool sensor with different name --> Had issue
  3. Change above corrected it, after reloading integration nordpool did show correct values for tomorrow.

homeassistant\custom_components\nordpool/init.py

async def update_tomorrow(self, n: datetime):
  _LOGGER.debug("Updating tomorrows prices.")
  await self._update(type_="tomorrow", dt=dt_utils.now() + timedelta(hours=24))
  #self._tomorrow_valid = True
  def set_tomorrow_valid(self, state) -> None:
    self._tomorrow_valid = state

homeassistant\custom_components\nordpool/sensor.py

        if self._data_tomorrow is None or None in self._data_tomorrow:
  _LOGGER.debug("NordpoolSensor _data_tomorrow is none, trying to fetch it.")
  tomorrow = await self._api.tomorrow(self._area, self._currency)
  if tomorrow:
      self._data_tomorrow = tomorrow
  if not None in self._data_tomorrow:
      self._api.set_tomorrow_valid(True)
  else:
      self._api.set_tomorrow_valid(False)  
Hellowlol commented 1 year ago

@mmmahammm have you upgraded to the latest version?

zama737 commented 1 year ago

Hi @Hellowlol, it seems that there is recent update i wasn't aware and which I didn't have installed. Will update and see how it goes to. Many thanks for your support and such a great integration!

meljas commented 1 year ago

Sorry to ruin the party but my tomorrow also contained yesterday only one value even though I had the "fix". And it happened also once before. So, my "fix" wasn't good enough but maybe you fixed it better ... Yesterday I just rebooted hass (and after I got all the data) as I don't have the energy to look at this. .. Or I've got issues because I configured many market areas to retrieve by several nordpool instances which seems to work. But if yesterday problem happened for others then that's not the case. Anyway I noticed yesterday that some of the other market areas had tomorrow ok while some didn't.

Hellowlol commented 1 year ago

@meljas Please open a new issue using the issue template, your problem is not the same as the one initially posted here.

Hellowlol commented 1 year ago

Thanks @mmmahammm!

meljas commented 1 year ago

@meljas Please open a new issue using the issue template, your problem is not the same as the one initially posted here.

With all the respect, the error is exactly the same. And it took over 2 months for anyone to react or have any interest to this though it's critical. This has been open 8 months !! With that experience there's really no other solution than to fix these self and skip all the surrounding nonsense, I'm sure you understand that.

Hellowlol commented 1 year ago

LOL. Its really not the same, but now i cant be bothered anyway. 🤷‍♂️