#Visualizing dynamic electricity pricing forecast

1 messages Β· Page 1 of 1 (latest)

frosty wind
#

I was signed up for a trial for dynamic electricity prices and am now looking to visualize the upcoming prices for other users in the house to maybe defer some energy-intensive stuff to a time where prices are cheaper. However, for that, I first need to actually get the data into Homeassistant.

I can fetch the data from an API and have already set this up in my EVCC instance. To avoid fetching the same data twice, I want to use the EVCC API to get the prices already available there. Using curl, this is easy, curl https://evcc.home/api/tariff/grid returns the data available in a format like this: ```{
"rates": [
{
"start": "2025-08-07T19:45:00+02:00",
"end": "2025-08-07T20:00:00+02:00",
"value": 0.270696
},
...
]
}


Now I'm both not sure how I can actually fetch the data from EVCC using Homeassistant and also how I can populate a sensor value with data from the future. Any help is appreciated, thanks πŸ™‚

Once that data is in Homeassistant, I think using some graph card addon will make it easy to visualize it, so it's more about getting the actual data into HA...
knotty fiber
#

are you comfortable writing python / writing a HA integration? Because that would be the most straightforward way

#

everything else is just going to be a hack

frosty wind
#

Yeah, I almost figured that this was the way to go already. However, I had a brief look at the Tibber integration and couldn't figure out right away how/if it stores data for the future...

knotty fiber
#

forecasts are made available to the frontend using an action (service)

#

they are not stored as far as I know, except cached

frosty wind
#

Forecasts as in the ones used for e.g. solar production?

knotty fiber
#

yes

#

energy prices of the future are also forecasts

frosty wind
#

Correct

knotty fiber
#

here's an implementation of what you would have to make

#

you could just copy this integration and adjust it for your data source

frosty wind
#

so from a glance this essentially provides a service where the forecast data can be fetched, right?

knotty fiber
#

exactly

frosty wind
#

Ok, so far so good, but how would I visualize this in a dashboard?

#

The EnergyZero docs mention that a template sensor should be created for this, but as far as I can see this will only look back, not into the future

bleak heath
#

A template sensor can have arbitrary data structure in attributes, which could be a set of future datapoints.

frosty wind
#

I see, then I could use something like the ApexCharts addon which can use something else than the state to create a graph...

#

sorry, not addon, card

knotty fiber
#

yeah, that could work

#

but that's what I meant by a hack. Storing forecasts in attributes will bloat the database

#

although it used to be like that for a long time 🀣

frosty wind
#

i'm open for other ideas πŸ˜„

knotty fiber
#

already did haha

frosty wind
#

So if it's a hack anyway, any possibility of avoiding to write a custom integration "just" to fetch some json data and transform it into attributes of a template sensor?

knotty fiber
#

if you're going the integration route might as well use a service

frosty wind
#

The service route seems to be a dead-end when coming to visualize the retrieved data...

knotty fiber
#

why?

#

apexcharts can visualize it, I know people have done it

frosty wind
#

I can't find the config options then

knotty fiber
#

that might still need a template but that's not storing it in attributes at least

frosty wind
#

then I could just fetch the data from EVCC and store the response as a string, would that be more efficient?

knotty fiber
#

you should be able to use that yeah

frosty wind
#

I'll give it a shot then, thank you!

#

well... state length cannot exceed 255 characters apparently πŸ™

frosty wind
#

So I ended up using with what probably is considered a hack, but it works: RESTful sensor which fetches the tariffs from EVCC into its attributes. And then use that attribute in the data_generator of apex chart card. I made sure to exclude the rest sensor from the recorder, so I hope at least that will not be an issue πŸ˜…

knotty fiber
#

nice!

#

could you share that yaml? it will be useful for others