Looking for a card to display forecasted value data against time

I have a data set containing an hourly solar energy forecast.
It is in an array where each item is a dictionary of dateTime (a time value) and globalRadiation (a numeric value).
I would like to plot time on the X axis against solar energy on the Y axis, so I can see the solar forecast for the coming days/hours.

Is there an existing card that can display future datetime data.

So far I can find historic data display or single value display.

Have a look at this project and the thread about it. I’ve used it for basic HA recorder data and it is fantastic. I’ve not done it, however I am pretty sure the project author created a way to plot arbitrary JSON data. Good hunting!

2 Likes

Thanks, trying to wrangle that at the moment. Looks like the most promising yet.

Here’s an example apexchart forecast series example from my solar forecast data:

  - entity: sensor.solcast_forecast_data
    type: line
    name: Future Forecast 90
    color: '#e3a8ab'
    opacity: 0.3
    extend_to_end: false
    stroke_width: 2
    unit: W
    show:
      in_header: false
      legend_value: false
    data_generator: |
      return entity.attributes.forecasts.map((entry) => {
         return [new Date(entry.period_end), entry.pv_estimate90*1000];
       });

The data:

forecasts: 
- pv_estimate: 2.5872
  pv_estimate10: 0.9286
  pv_estimate90: 4.2418
  period_end: '2022-02-20T23:00:00.0000000Z'
  period: PT30M
- pv_estimate: 2.2441
  pv_estimate10: 0.2514
  pv_estimate90: 5.95
  period_end: '2022-02-20T23:30:00.0000000Z'
  period: PT30M
- pv_estimate: 2.2203
  pv_estimate10: 0.3451
  pv_estimate90: 5.95
  period_end: '2022-02-21T00:00:00.0000000Z'
  period: PT30M
- pv_estimate: 3.2898
  pv_estimate10: 0.4723
  pv_estimate90: 5.95
  period_end: '2022-02-21T00:30:00.0000000Z'
  period: PT30M
- pv_estimate: 3.5687
  pv_estimate10: 0.303
  pv_estimate90: 5.95
  period_end: '2022-02-21T01:00:00.0000000Z'
  period: PT30M
- pv_estimate: 3.6542
  pv_estimate10: 0.5786
  pv_estimate90: 5.95
  period_end: '2022-02-21T01:30:00.0000000Z'
  period: PT30M
...etc
4 Likes

Deadly, thanks for that.

Now I know I have something that can handle the output, I just need to wrangle the input data into a shape HA will tolerate.

Can I ask where your data comes from? You seem to have a nice yaml, and is that orginating as a file or a collection of sensors?

I currently have a local server serving my dataset as both .json and .yaml, but HA doesn’t want to take those in through the rest sensor as they’re bigger than 255 char.

That’s an excerpt from a forecast from the Solcast third party Integration.

@tom_l your nice example of forecast series is from ha solcast integration v2 or v3? It seems that there is a difference between v2 and v3 outputs.

2 Likes

It’s from V2, and it used to work wonderfully.

Not sure how to get V3 going

1 Like

Hi tom_I,

taking the thread with some delay as I am struggling to find the right rest / GET setup in my sensor.yaml to gather data from solcast API and build the mentioned forecast graph. Do you have a link towards the “writing code” for such a GET request? I am a bit lost with the json attributes and how to transpose those in the apex chart data generator properly. The 3 hours refreshing time is not the best but the existing limitation for 10 calls a day makes it so for the time being. Thanks for support.

- platform: rest
  resource: https://api.solcast.com.au/rooftop_sites/my_site/forecasts?format=json&api_key=my_ key
  method: GET
  scan_interval: "03:00:00" # limited by 10 calls a day...
  name: "Solcast Forecast Data"
  unit_of_measurement: kW
  force_update: true
  value_template: "{{ value_json.forecasts[0].pv_estimate|round(2) }}"

https://community.home-assistant.io/t/solcast-global-solar-power-forecast-integration/334681/289?u=tom_l