#Green planet energy energy price action
1 messages ยท Page 1 of 1 (latest)
At some point there was a PR that would add the 2.5hr cheapest moment, so you could use that to charge your car or run a washer. I pushed back on that, as 2.5hr was too use case specific
https://github.com/home-assistant/core/pull/162577 Now there's a PR that adds actions, but I think the response is still too specific
I told them that ideally we at least give a whole key value list, so "01:00": 0.21, "02:00": 0.22
so that it would tell the user 1-2 the price is 0.21 eur per kWh
and 2-3 0.22
Current the PR is just a cheapest price actions that returns
return {
"duration": duration,
"average_price": round(avg_price / 100, 4),
"start_time": start_time.isoformat(),
"hours_until_start": round(hours_until_start, 1),
"time_range": time_range,
}
So my argument kinda is like, we should convey the data as raw as possible so the user can do what they want with the data
Yes, I am also in favor of. Afaik this is how the price actions of Tibber and Nordpool work aswell.
And it might be cool to have some form of energy processing in HA at some point, like how we have the energy.py platform to convey solar predictions, maybe we can create an API for energy prices and then just have HA actions to be like "when is it cheapest to run for 2 hours", but that's a different discussion
Yes, I like this a lot.
-# (But I believe this once was thought of but never was added, but that was when the energy dashboard was created AFAIK, so I am not sure if that's true and why)
usually the reply to these kinds of automation-integrations is: template blueprint ๐
irt to the service, I agree with you Joost, it should just return the full set of prices
hi there, I totally see the reasoning for providing the full information of the API and providing an action where the user can get the value for any hour they like and do more complex things if they want to.
But I also think - in addition - it would be nice to make a common usecase as easy as possible. The usecase that I am looking at where you want to get the chepeast timeframe for a given time in the night and during the day I think is not that simple to do with a template example or? I had to put quiet some logic into the API to get the values that make sense and not e.g. not use values that are in the past of the day or something like that. If that is easy to do with a template i am also happy but did not look too out of the box for me at the moment. do you mabye have an example from another integration for me?
a service to get the data for a range of time would still be useful. Users can then user it along with a template to go over the results and extract the min() one
I've created this for that use case Cheapest Energy Hours
It can return the cheapest consecutive hours between a set start and end time. But also split in multiple parts (with an option to set a minimum) which can be useful if you eg want to charge your car during the night, since that doesn't necessarily has to be one consecutive block.
It's a Jinja macro as my Python knowledge isn't sufficient to write an integration ๐
ah ok so the idea would be that I provide a service that takes the amount of time as the parameter but instead of just returning the start time of the timeframe I would return the date time with prices within the timeframe that was found?
@agile flume maybe that is also what you meant and what I kind of missunderstood?
maybe I can do it in a way where the service would take another parameter so that the user can choose between the raw data for the timeframe or just the starttime? or already to specific then agian?
I mean in a way you can do both, but I think having a service that returns a list of a whole day makes sense, as you can use that to do whatever
from graphing and whatnot
I think it might make sense to introduce such service, as long as we keep the option open for how long etf
c
@wicked vigil I did not know about your implementation. I still think that my simple cheapeast price action can solve a lot of use cases but would like to also support more complicated things and therefore added a PR that provides raw data.
Is that something your code could work with? https://github.com/home-assistant/core/pull/166405
- start: "2026-03-24T21:45:00+01:00"
end: "2026-03-24T22:00:00+01:00"
price: 0.2589
- start: "2026-03-24T22:00:00+01:00"
end: "2026-03-24T22:15:00+01:00"
price: 0.3009
- start: "2026-03-24T22:15:00+01:00"
end: "2026-03-24T22:30:00+01:00"
price: 0.2908
- start: "2026-03-24T22:30:00+01:00"
end: "2026-03-24T22:45:00+01:00"
price: 0.2744
- start: "2026-03-24T22:45:00+01:00"
end: "2026-03-24T23:00:00+01:00"
price: 0.2398
or would it require different kind of information?
This is totally fine for my macro
that was fast ๐ thanks for the feedback
Will it only return future data? Other integrations like Nordpool, Tibber and EnergyZero can also provide historical data
right now its configured for the future since I thought why would you look at the past.
the API does provide historic data so I could add it / would that rather be a separet config for the service "- hours" or what do you think would be the best approach as a parameter for the service