Skip to content

Instantly share code, notes, and snippets.

@vogon1
Last active November 29, 2022 20:07
Show Gist options
  • Save vogon1/db0cd2ee98f21e0b73bac03d456c9758 to your computer and use it in GitHub Desktop.
Save vogon1/db0cd2ee98f21e0b73bac03d456c9758 to your computer and use it in GitHub Desktop.
Day forward and backward in apex charts
type: vertical-stack
cards:
- type: horizontal-stack
cards:
- type: custom:button-card
name: <
tap_action:
action: call-service
service: input_number.increment
service_data:
entity_id: input_number.verspring_dag
- type: custom:button-card
name: nu
tap_action:
action: call-service
service: input_number.set_value
service_data:
entity_id: input_number.verspring_dag
value: 0
- type: custom:button-card
name: '>'
tap_action:
action: call-service
service: input_number.decrement
service_data:
entity_id: input_number.verspring_dag
- type: custom:config-template-card
variables:
datum: |
a => {
var date = new Date();
date.setDate(date.getDate() - states['input_number.verspring_dag'].state);
return (date.getDate() + '/' + (date.getMonth()+1));
}
entities:
- input_number.verspring_dag
card:
type: custom:apexcharts-card
graph_span: 24h/h
update_interval: 5min
header:
title: ${('Kosten ' + datum() + ' (€)')}
show: true
apex_config:
grid:
borderColor: '#444444'
xaxis:
lines:
show: true
ticks: 3
row:
opacity: 0.1
chart:
height: 250px
span:
start: day
offset: ${('-' + states['input_number.verspring_dag'].state + 'd')}
hours_12: false
stacked: true
series:
- entity: sensor.vastrecht_cost
type: column
statistics:
period: 5minute
type: sum
group_by:
func: diff
duration: 1h
start_with_last: true
color: '#994499'
name: vast
show:
legend_value: false
- entity: sensor.avs_laag_verbruikt_cost
type: column
statistics:
period: 5minute
type: sum
group_by:
func: diff
duration: 1h
start_with_last: true
color: '#338833'
name: laag
show:
legend_value: false
- entity: sensor.avs_hoog_verbruikt_cost
type: column
statistics:
period: 5minute
type: sum
group_by:
func: diff
duration: 1h
start_with_last: true
color: '#bb6644'
name: hoog
show:
legend_value: false
- entity: sensor.warmte_verbruikt_cost
type: column
statistics:
period: 5minute
type: sum
group_by:
func: diff
duration: 1h
start_with_last: true
color: '#bb4444'
name: warmte
show:
legend_value: false
- entity: sensor.water_verbruikt_cost
type: column
statistics:
period: 5minute
type: sum
group_by:
func: diff
duration: 1h
start_with_last: true
color: '#6688cc'
name: water
show:
legend_value: false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment