Hi all,
I’ve been tampering with this card for a few weeks now, and it’s great, really like it. I’ve encountered several issues, but with all the info in this thread, I’ve managed to figure out most of them myself. However, there is one issue I can’t get my head around. Hopefully, one of you sees what I’m doing wrong.
Like many, I want to track my energy usage and costs. So I made 2 cards, 1 for gas and 1 for electricity, to track the costs of the fixed, variable and total costs (total being the sum of fixed and variable) throughout the day.
For gas, this works fine, see the plot below. Fixed (Vast) stays at 0,64, Variable increases every 5 minuted (per the statistics setting) and consequently, Total increases parallel to Variable (with a difference of 0,64).
For electricity, however, for some reason, total does not increase, it stays at -0,53, whereas, as you can see, Variable is increasing. The yaml code for both cards is exactly the same (I copied the yaml code and only changed the entity IDs), see the code below. I also checked the ninja code of the template and the number is in fact increasing.
And finally, I checked the entity’s history and there it also shows an increasing number.
I created the template sensor yesterday and at that moment the value was -0,53, so it hasn’t changed since, so also no changes at the start of today. The only difference I see with the gas card is that the fixed electricity costs are negative, but that shouldn’t cause this issue right? Anyone seeing what’s wrong with the card or its yaml code?
type: custom:apexcharts-card
header:
show: true
title: Stroomkosten per dag
show_states: true
colorize_states: true
update_interval: 1m
graph_span: 1d
span:
end: day
color_list:
- '#008FFB'
- '#00E396'
- '#FF4560'
- '#FEB019'
- '#775DD0'
- '#775DD0'
all_series_config:
type: line
show:
legend_value: false
statistics:
type: state
period: 5minute
align: start
extend_to: now
float_precision: 2
stacked: false
series:
- entity: sensor.stroomkosten_per_dag_vast
name: Vast
- entity: sensor.stroomkosten_per_dag_variabel
name: Variabel
- entity: sensor.stroomkosten_per_dag
name: Totaal
Edit: I checked to see what happens if I delete the statistics part of the code. It seems that’s causing the issue, see plot below. However, I do want to use statistics to be able to make the same card for a longer period. Also, I get this vertical line at the beginning of the day, which I understand, but is not pretty… Finally, I still don’t understand why the gas card is working fine.
type: custom:apexcharts-card
header:
show: true
title: Stroomkosten per dag
show_states: true
colorize_states: true
update_interval: 1m
graph_span: 1d
span:
end: day
color_list:
- '#008FFB'
- '#00E396'
- '#FF4560'
- '#FEB019'
- '#775DD0'
- '#775DD0'
all_series_config:
type: line
show:
legend_value: false
extend_to: now
float_precision: 2
stacked: false
series:
- entity: sensor.stroomkosten_per_dag_vast
name: Vast
- entity: sensor.stroomkosten_per_dag_variabel
name: Variabel
- entity: sensor.stroomkosten_per_dag
name: Totaal