I’ve tried to create a graph similar to what was done here: Display future values in a graph - #6 by Kristian_Schneider
I’ve copied the card @Kristian_Schneider posted - but I get a horizontal line indicating what I think is the maximum value in the series that I would like to get rid of. Also - the actual power use is shown with the last recorded value all the way to the predicted end of the graph 12 hours later, and I would like to get rid of that… (colors need some tweaking ):
The card code looks like like this:
type: custom:apexcharts-card
graph_span: 24h
span:
start: hour
offset: '-12h'
now:
show: true
label: Nu
header:
show: true
title: El-pris, forbrug og udledning
yaxis:
- id: first
decimals: 0
apex_config:
tickAmount: 4
- id: second
opposite: true
decimals: 2
apex_config:
tickAmount: 4
series:
- entity: sensor.electricity_spot_price
type: column
stroke_width: 10
color: '#730712'
yaxis_id: first
data_generator: |
return entity.attributes.records.map((record, index) => {
return [record.HourDK, record.SpotPriceEUR];
});
- entity: sensor.co2_prognose
type: line
stroke_width: 3
color: cyan
yaxis_id: first
data_generator: |
return entity.attributes.records.map((record, index) => {
return [record.Minutes5DK, record.CO2Emission];
});
- entity: sensor.power_usage
type: line
stroke_width: 3
color: '#ff00ff'
float_precision: 3
yaxis_id: second
The sensors look like this:
sensor:
- platform: rest
name: "CO2 prognose"
resource: https://api.energidataservice.dk/datastore_search?resource_id=co2emisprog&limit=576&filters={%22PriceArea%22:%22DK2%22}&sort=Minutes5DK%20desc
json_attributes:
- records
json_attributes_path: '$.result'
value_template: 'OK'
unit_of_measurement: "g/kWh"
- platform: rest
name: "Electricity spot price"
resource: https://api.energidataservice.dk/datastore_search?resource_id=elspotprices&limit=48&filters={%22PriceArea%22:%22DK2%22}&sort=HourDK%20desc
json_attributes:
- records
json_attributes_path: '$.result'
value_template: 'OK'
unit_of_measurement: "EUR/kWh"
- platform: rest
resource: http://[IP]:[PORT]/sensor/power_meter
name: "Power Usage"
value_template: "{{ value_json.value }}"
unit_of_measurement: "kW"
Any suggestions?