type: custom:apexcharts-card
graph_span: 48h
experimental:
color_threshold: true
show:
last_updated: true
header:
title: Electricity price (c/kWh)
show: true
show_states: true
colorize_states: true
span:
start: day
yaxis:
- min: 0
decimals: 2
apex_config:
forceNiceScale: true
now:
show: true
label: Now
series:
- entity: sensor.shf_electricity_price_now
name: Average Price
show:
in_header: false
extremas: false
type: line
color: "blue"
float_precision: 2
stroke_width: 2
data_generator: |
return [[start, entity.attributes.today_avg*100], [moment(end).subtract(1, 'days'), entity.attributes.today_avg*100], []];
- entity: sensor.shf_electricity_price
show:
in_header: false
extremas: true
type: column
color: lightgray
float_precision: 2
data_generator: |
return entity.attributes.data.map((d, index) => {
return [new Date(d["DateTime"]).getTime(), entity.attributes.data[index]["PriceWithTax"]*100];
});
color_threshold:
- value: 0
color: 368f39
- value: 10
color: a3b34d
- value: 20
color: ffd57e
- value: 30
color: f18c56
- value: 40
color: de425b
- entity: sensor.shf_electricity_price
show:
in_header: true
header_color_threshold: true
in_chart: false
type: line
color: lightgray
float_precision: 2
stroke_width: 0
data_generator: |
var currentTime = new Date().setMinutes(0, 0, 0);
let currentPrice = entity.attributes.data.find(d => {
return new Date(d["DateTime"]).getTime() === currentTime;
})["PriceWithTax"];
return entity.attributes.data.map((d, index) => {
return [new Date(d["DateTime"]).getTime(), currentPrice*100];
});
color_threshold:
- value: 0
color: 368f39
- value: 10
color: a3b34d
- value: 20
color: ffd57e
- value: 30
color: f18c56
- value: 40
color: de425b