MTrab / energidataservice

Fetches spot prices from Energi Data Service
GNU General Public License v3.0
183 stars 26 forks source link

Certain hours with no tariffs #555

Closed MortenHannemose closed 2 months ago

MortenHannemose commented 2 months ago

Describe the issue

For two hours today I got a completely wrong price. The rest of the hours were with tariffs but, these two were without. I'm on Radius in Denmark, image

Around the same time as the problem, I also got a lot of errors, one of them is most likely related to this.

It is possible that my internet was having issues around that time, but preferably that should not give me incorrect prices.

What version of Home Assistant Core has the issue?

core-2024.8.0

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Diagnostics information

None (didn't enable debugging before the problem)

Anything in the logs that might be useful for us?

![image](https://github.com/user-attachments/assets/16140651-7dec-411b-b146-9e3408841618)

Logger: custom_components.energidataservice.connectors.energidataservice
Source: custom_components/energidataservice/connectors/energidataservice/__init__.py:131
integration: Energi Data Service ([documentation](https://github.com/MTrab/energidataservice/blob/master/README.md), [issues](https://github.com/MTrab/energidataservice/issues))
First occurred: 00:12:52 (18 occurrences)
Last logged: 14:36:11

API returned error 500
Logger: custom_components.energidataservice.connectors.energidataservice
Source: custom_components/energidataservice/connectors/energidataservice/__init__.py:100
integration: Energi Data Service ([documentation](https://github.com/MTrab/energidataservice/blob/master/README.md), [issues](https://github.com/MTrab/energidataservice/issues))
First occurred: 00:10:47 (20 occurrences)
Last logged: 14:35:29

API returned error 500
Logger: custom_components.energidataservice.connectors.energidataservice
Source: custom_components/energidataservice/connectors/energidataservice/__init__.py:116
integration: Energi Data Service ([documentation](https://github.com/MTrab/energidataservice/blob/master/README.md), [issues](https://github.com/MTrab/energidataservice/issues))
First occurred: 14:25:21 (2 occurrences)
Last logged: 14:28:21

API returned error 400, Bad Request!
Logger: custom_components.energidataservice.tariffs.energidataservice
Source: custom_components/energidataservice/tariffs/energidataservice/__init__.py:209
integration: Energi Data Service ([documentation](https://github.com/MTrab/energidataservice/blob/master/README.md), [issues](https://github.com/MTrab/energidataservice/issues))
First occurred: 13:18:26 (9 occurrences)
Last logged: 14:25:21

Error during API request: 500, message='Internal Server Error', url=URL('https://api.energidataservice.dk/dataset/DatahubPricelist?filter=%7B%22Note%22:%5B%22Elafgift%22,%22Systemtarif%22,%22Transmissions+nettarif%22%5D%7D&limit=500')
Error during API request: 400, message='Bad Request', url=URL('https://api.energidataservice.dk/dataset/DatahubPricelist?filter=%7B%22Note%22:%5B%22Elafgift%22,%22Systemtarif%22,%22Transmissions+nettarif%22%5D%7D&limit=500')


### Additional information

I'm surprised by how often the addon uses the internet. Is this intentional? My naïve thinking tells me that polling once a day would be enough since the electricity prices are known for 24 hours at a time. Any thoughts on this are also welcome.
MTrab commented 2 months ago

The integration polls for data on Home Assistant startup (or configuration of the integration), on midnight CO2 values are updated and around 13-14 (DK time) the next refresh are made. That's the only times the integration uses the internet, unless you trigger updates manually.

But the API 500 should handled in the latest version, just released. Seems like your issues are related to this.