Visualising Amber Electric Forecast Data

I am an Amber Electric customer in Australia. Amber delivers buy and sell price forecasts via 2 sensors in the integration. Each sensor has many attributes in the following format.


state_class: measurement
forecasts:
  - duration: 30
    date: "2025-05-10"
    nem_date: "2025-05-10T12:30:00+10:00"
    per_kwh: -0.02
    spot_per_kwh: -0.01
    start_time: "2025-05-10T02:00:01+00:00"
    end_time: "2025-05-10T02:30:00+00:00"
    renewables: 71
    spike_status: none
    descriptor: extremely_low
  - duration: 30
    date: "2025-05-10"
    nem_date: "2025-05-10T13:00:00+10:00"
    per_kwh: -0.02
    spot_per_kwh: -0.01
    start_time: "2025-05-10T02:30:01+00:00"
    end_time: "2025-05-10T03:00:00+00:00"
    renewables: 70
    spike_status: none
    descriptor: extremely_low

The list of forecasts has 40 entries, being the 40 x 30 min forecasts for the next 20 hours.

I have successfully visualised these in a list on a dashboard, like this

12:30, 0.06
13:00, 0.05
13:30, 0.05
14:00, 0.07
14:30, 0.07
15:00, 0.08
…

I would like to visualise it as a chart (line or bar). I’m still pretty new to all this and my Python and HA skill is still in its infancy. I’ve read that I can’t visualise this in a chart unless I get the data into an entity or maybe the recorder db, or maybe influxDB. I’m happy to do the hard yards, but would appreciate any advice on the best way forward. Ideally I would be able to compare forecasts over time, but that is nice to have.

You could probably graph it with an apexcharts data generator. See here for an example: REST API command/platform fails on POST to external URL (solcast) - #121 by tjafbe

1 Like

Thanks for your advice. Using the approach suggested I was able to visualise the data in an Apex chart as follows.

For the benefit of others, here is my code. If someone knows how I can eliminate the 3 hours of unused space on the left, I would appreciate a suggestion.


type: custom:apexcharts-card
view_layout:
  grid-column: span 4
graph_span: 24h
span:
  start: day
  offset:  10h
header:
  show: true
  title: Price Forecasts
  show_states: false
now:
  show: true
  label: Now
apex_config:
  legend:
    show: true
  tooltip:
    enabled: false
yaxis:
  - id: first
    decimals: 2
series:
  - entity: sensor.my_feed_in_forecast
    type: line
    name: FIT Forecast
    unit: $/kWh
    data_generator: |
      const forecasts = entity.attributes.forecasts;
      const offsetMs = 60 * 60;
      const result = forecasts.map(e => [
        new Date(new Date(e.start_time).getTime()   offsetMs),
        parseFloat(e.per_kwh || 0)
      ]);
      console.log("Adjusted forecast:", result);
      return result;
  - entity: sensor.my_general_forecast
    type: line
    name: Buy Price Forecast
    unit: $/kWh
    data_generator: |
      const forecasts = entity.attributes.forecasts;
      const offsetMs = 60 * 60; 
      const result = forecasts.map(e => [
        new Date(new Date(e.start_time).getTime()   offsetMs),
        parseFloat(e.per_kwh || 0)
      ]);
      console.log("Adjusted forecast:", result);
      return result;


1 Like

Here is an update for anyone wanting to do this.

The only thing I want to do that i haven’t succeeded with so far is to remove the current values from the legend (or format them 2 decimals would also be fine)


type: custom:apexcharts-card
graph_span: 24h
span:
  offset:  24h
header:
  show: true
  title: Price Forecasts
  show_states: false
now:
  show: true
  label: Now
apex_config:
  legend:
    show: true
  tooltip:
    "y":
      enabled: true
      formatter: function (val) { return val.toFixed(2); }
yaxis:
  - id: first
    decimals: 2
series:
  - entity: sensor.short_street_general_forecast
    type: line
    color: red
    name: Buy Price Forecast
    unit: $/kWh
    data_generator: |
      const forecasts = entity.attributes.forecasts;
      const result = forecasts.map(e => [
        new Date(e.start_time).getTime(),
        parseFloat(e.per_kwh || 0)
      ]);
      return result;
  - entity: sensor.short_street_feed_in_forecast
    type: line
    name: FIT Forecast
    unit: $/kWh
    data_generator: |
      const forecasts = entity.attributes.forecasts;
      const result = forecasts.map(e => [
        new Date(e.start_time).getTime(),
        parseFloat(e.per_kwh || 0)
      ]);
      return result;

https://github.com/RomRider/apexcharts-card?tab=readme-ov-file#series-show-options

series:
  - entity: sensor.short_street_general_forecast
    type: line
    ...
    show:
      legend_value: false