Closed BrainDra1n closed 1 week ago
I now have an example of this effect happening. The results are for Thursday 06-06-2024. The following picture are from 23:15 and show:
entity sensor.average_electricity_price_today contains attributes: state_class: measurement unit_of_measurement: €/kWh attribution: Data provided by ENTSO-e Transparency Platform device_class: monetary icon: mdi:currency-eur friendly_name: Average electricity price today (Energy Prices) prices_today: list of prices for tomorrow in stead of today prices_tomorrow: list is empty prices: list of prices for today and tomorrow
Which looks like this in the State inspector:
After 24:00 this changes to:
prices_today: list of prices for yesterday. the values of today before 24:00 prices_tomorrow: list of prices for today. the values of tomorrow before 24:00 prices: list of prices for yesterday and today Which is still incorrect.
At 01:00 it changes again and becomes 'normal' as intended:
prices_today: list of prices for today. the values after 24:00 prices_tomorrow: list is empty. which is correct as tomorrow's prices are not available yet. prices: stil the list of prices for yesterday and today. But with correct dates, so no incorrect information.
As I'm using the integration as input for the EV Smart Charging integration. It gets confused when scheduling charging of my car around 23:00.
~~The beta version of v0.5.0 contains a complete rework of this logic. Can you test and provide feedback?~~
Just looked at the logic and is seems the issue is still there. Aiming to fix this in the next beta.
Should be fixed in the latest beta (v0.5.0-beta2)
v0.5.0 is released. The discussed issues should be solved. Please feel free to open a new issue if you feel this is needed.
At 23:00 the sensor.average_electricity_price_today has no today's prices, but still has tomorrow's prices. When it becomes 24:00 all prices are correct again.
I suspect that this is caused by timezone / daylight savings time. But still investigating it. This is what I know now.
My setup: Core 2024.5.4 Supervisor 2024.05.1 Operating System 12.3 Frontend 20240501.1 hass-entso-e 0.0.1 Timezone: GMT+01:00) Amsterdam Current date: 24 may 2024, so no daylight savings time at this moment.
Findings: The sensor.average_electricity_price_today contains the following attributes:
The three price attributes show the issue. At all times 'prices' contain a list of today's and tomorrow's prices, if available. Until 23:00 the 'prices_today' contains a list of today's prices. From 23:00 until 24:00 this list becomes empty. At all times 'prices_tomorrow' contains tomorrow's prices, if available.
In my situation I use the Day Ahead Prices for The Netherlands. The prices for tomorrow are available from ~15:00 today. From that time, the attribute prices_tomorrow is filled. At 24:00 the prices_tomorrow becomes an empty list. This is all normal behaviour.
At 23:00 when 'prices_today' becomes an empty list, the 'prices' list still contains all prices both today and tomorrow. I'm not sure what triggers this effect. It could be the hourly timer event used to update the prices from ENTSO-e.
I have tried to determine where this issue could be caused in the source code. But as I'm new to HA, Python, Jinja2 and all other languages used, this is not so easy.
One possible location is in the file coordinator.py which contains:
This seems the only place in the source code where:
The 'strange' thing I see happening here, is:
So who could help analyze this behaviour further? If a solution can be found, I'm willing to learn how to use git, update and publish the code.