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.
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.
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.
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;