Skip to content

Instantly share code, notes, and snippets.

@billerby
Created January 6, 2023 14:16
Show Gist options
  • Save billerby/b7a3a6e49f96a2332be329dee2328b56 to your computer and use it in GitHub Desktop.
Save billerby/b7a3a6e49f96a2332be329dee2328b56 to your computer and use it in GitHub Desktop.
Battery charge state apex card with spotprices
type: custom:apexcharts-card
header:
show: true
title: Battery Status
show_states: true
colorize_states: true
now:
show: true
label: now
all_series_config:
type: area
opacity: 0.1
stroke_width: 1
group_by:
func: avg
duration: 15m
show:
in_header: false
series:
- entity: sensor.battery_state_of_capacity
type: line
yaxis_id: pct
opacity: 1
stroke_width: 3
group_by:
func: last
duration: 15m
show:
in_header: true
- entity: sensor.battery_charge_discharge_power
name: Battery Charge
transform: return Math.max(0,x);
color: darkgreen
yaxis_id: watts
- entity: sensor.battery_charge_discharge_power
name: Battery Discharge
color: '#800080'
transform: return -Math.min(0,x);
yaxis_id: watts
- entity: sensor.nordpool_kwh_se3_sek_3_10_025
name: Spotprice
color: blue
yaxis_id: price
data_generator: |
return entity.attributes.raw_today.map((start, index) => {
return [new Date(start["start"]).getTime(), entity.attributes.raw_today[index]["value"]];
});
yaxis:
- id: pct
show: true
opposite: true
decimals: 0
max: 100
min: 15
- id: watts
show: true
decimals: 0
align_to: 250
- id: price
show: true
decimals: 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment