Skip to content

Instantly share code, notes, and snippets.

@mortenmathiasen
Last active November 24, 2024 14:41
Show Gist options
  • Select an option

  • Save mortenmathiasen/b5dfa2a2c02116e4403b545c8ed4d12d to your computer and use it in GitHub Desktop.

Select an option

Save mortenmathiasen/b5dfa2a2c02116e4403b545c8ed4d12d to your computer and use it in GitHub Desktop.
Elpriser custom apexcharts-card
type: custom:apexcharts-card
apex_config:
chart:
height: 200px
legend:
show: false
experimental:
color_threshold: true
graph_span: 24h
header:
title: Pris (kr/kWh)
show: true
span:
start: hour
now:
show: false
label: Nu
yaxis:
- min: 0
apex_config:
tickAmount: 5
series:
- entity: sensor.ev_smart_charging_charging
name: Charging
data_generator: >
return entity.attributes.charging_schedule.map((entry) => { return [new
Date(entry.start), entry.value]; });
type: area
stroke_width: 0
color: blue
opacity: 1
- entity: sensor.energi_data_service
type: area
stroke_width: 3
opacity: 0.5
data_generator: |
var today = entity.attributes.raw_today.map((start, index) => {
return [new Date(start["hour"]).getTime(), entity.attributes.raw_today[index]["price"]-0.945];
});
if (entity.attributes.tomorrow_valid) {
var tomorrow = entity.attributes.raw_tomorrow.map((start, index) => {
return [new Date(start["hour"]).getTime(), entity.attributes.raw_tomorrow[index]["price"]-0.945];
});
var data = today.concat(tomorrow);
} else {
var data = today
}
var forecast = entity.attributes.forecast.map((start, index) => {
return [new Date(start["hour"]).getTime(), entity.attributes.forecast[index]["price"]-0.945];
});
return data.concat(forecast);
float_precision: 2
color_threshold:
- value: 0.5
color: green
- value: 1
color: orange
- value: 1.5
color: red
- value: 2
color: darkred
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment