custom-components / nordpool

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

Tomorrow's data very slow to update, it takes hours. Perhaps implement Force update? #299

Closed elektrinis closed 1 year ago

elektrinis commented 1 year ago

Is your feature request related to a problem? Please describe. it is now 2 hours since nordpool announced tomorrows prices, yet the integration does not show them yet, and there seems to be no way to force update?

Describe the solution you'd like I want it to fetch tomorrow's data as soon as it's available.

Describe alternatives you've considered Alternatively, perhaps make a service I can call?

Additional context I am using YAML configuration due to complex hourly additional costs. I also don't see any way to update the settings without restarting the whole HA, which causes a lot of issues like stopped automations etc. Perhaps there could be a service to restart it.

Hellowlol commented 1 year ago

Setup using the ui. You can copy paste the additional costs into the web ui. It should update fairly quickly after the prices are released l. If that don’t happen there has usually been an api error and some exceptions. You can check the log and see what you can find.

achmeed commented 1 year ago

Is your feature request related to a problem? Please describe. it is now 2 hours since nordpool announced tomorrows prices, yet the integration does not show them yet, and there seems to be no way to force update?

Describe the solution you'd like I want it to fetch tomorrow's data as soon as it's available.

Describe alternatives you've considered Alternatively, perhaps make a service I can call?

Additional context I am using YAML configuration due to complex hourly additional costs. I also don't see any way to update the settings without restarting the whole HA, which causes a lot of issues like stopped automations etc. Perhaps there could be a service to restart it.

I've the same issue so made an automation to trigger a reload, seems to be working

alias: Service - Reload NordPool description: "" trigger:

elektrinis commented 1 year ago

Thanks you! Will try.

elektrinis commented 1 year ago

Just tried it and it did not work... I get unknown error even when trying to call a service via development tool. My nordpool is configured in YAML, nor GUI. Screenshot 2023-03-14 152554

Should this work in GUI-configured entity?

achmeed commented 1 year ago
image
elektrinis commented 1 year ago

Just to let everyone know, this update did not work for me when nordpool sensor is configured in YAML. Moved it to GUI and it seems to be working.

Would really love these to be editable though, as I need to store my "additional costs" code somewhere anyway. Also really difficult to debug when I can't even see the code.

Rantaki commented 1 year ago

I updated the integration two days ago to the latest version. Since then the tomorrows prices have not been updated automatically. I get the new prices immediately by disabling and enabling the integration. Do we really have to implement automation for the reload? Couldn’t the integration take care of that?

Hellowlol commented 1 year ago

@Rantaki noone has provided any logs. Hence, i havnt done anything.

Rantaki commented 1 year ago

I found this from log (14:15). Does this help?

` Logger: homeassistant Source: custom_components/nordpool/aio_price.py:256 Integration: Nord Pool (documentation, issues) First occurred: 14.15.37 (1 occurrences) Last logged: 14.15.37

Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/config/custom_components/nordpool/init.py", line 152, in new_data_cb await api.update_tomorrow(tdo) File "/config/custom_components/nordpool/init.py", line 88, in update_tomorrow await self.update(type="tomorrow", dt=dt_utils.now() + timedelta(hours=24)) File "/config/custom_components/nordpool/init.py", line 73, in _update data = await spot.hourly(end_date=dt) File "/config/custom_components/nordpool/aio_price.py", line 263, in hourly return await self.fetch(self.HOURLY, end_date, areas) File "/config/custom_components/nordpool/aio_price.py", line 256, in fetch raw = [self._parse_json(i, areas) for i in res] File "/config/custom_components/nordpool/aio_price.py", line 256, in raw = [self._parse_json(i, areas) for i in res] File "/usr/local/lib/python3.10/site-packages/nordpool/elspot.py", line 37, in _parse_json currency = data['currency'] KeyError: 'currency' `

Rantaki commented 1 year ago

Worked yesterday. Today the issue reproduced.

elektrinis commented 1 year ago

Just FYI the reset workaround with automation produces this kind of stuff (for few days in a row), so can't really use it. Not sure why, can't waste any more time on this now. Screenshot 2023-03-17 171925

Hellowlol commented 1 year ago

Integration will retry on key error in the latest version