JaccoR / hass-entso-e

Integration for Home Assistant to fetch day ahead energy prices from European countries via ENTSO-e Transparency Platform
Apache License 2.0
173 stars 28 forks source link

Question: why so many updates on one day? #63

Closed whulshof closed 1 year ago

whulshof commented 1 year ago

I see, that the integration fills the database with many sensor updates during the day, whereas it is only updated once a day. Around 15.00, when the prices of the next day are added. Why is this?

JaccoR commented 1 year ago

See #51. The moment at which the data updates differs.

whulshof commented 1 year ago

Yes, I know. I was involved in the day ahead auction project back in 2010. But in that case we can just give in the update moment of the respective country in config, can't we? So one update per day would be enough if you ask me.

sfstar commented 1 year ago

Have you updated to the latest version? A lot has changed recently regarding DB usage and update frequency. For example attributes are now only present on the average price sensor (this causes the static price list attributes to be updated only 2x a day). All other sensors no longer have these attributes (reducing DB usage) and the current / next hour entities have been brought back to their most atomic update size and frequency.

All sensors currently update once the new day's pricing becomes available. While the attributes of the average entity get an extra update at midnight. The next and current hour pricing entities are updated once a hour.

So (genuinely curious) in what way you would propose cutting down the DB usage even more. Especially with #59 in the works allowing you to select to have average/min/max/etc only update at midnight. In that case everything gets updated at midnight with the current and next hour entities remaining hourly updated.

whulshof commented 1 year ago

Hi, the last release is a huge improvement, but still (for the record) I already have 18 attribute_id's with the same hourprices in my db today. Bcs also the current price is inside of the attributes, it is hourly updated indeed. If you remove those, it really will do as you say, update once or twice a day. But it was a question. Compared to many other state's and attributes you/we now have a modest update frequency, which is perfectly ok for me. Thanks for your answer! Can be closed!

sfstar commented 1 year ago

Great explaination. Completely forgot about the attributes of the average entity containing the current and next hour prices as well. Will look into opening a PR to remove them from the attributes (since the same information is already present in the dedicated entities)

sfstar commented 1 year ago

Made a PR with small change to reduce duplication by having dedicated entity values no longer being present as attributes. Explicitly did not remove the invalid_keys statement (although with this change it provides no additional functionality at the moment).