I have an overall consumption template which adds all the consumption sensors into one for usage in the energy dashboard. When I reboot, eg deconz(holds a few consumption sensors), the overall consumption sensor drops to the ones that are available. I have tried to mitigate it with adding an availability field to check if the total some is higher then a statistics sensor. I somehow can’t get the statistics sensor configured correct to hold the all time max value, when a reboot of a sensor occurs the value of the statistics sensor also drops. What I’m missing?
The reason I don’t use a not_available check, is that it could be that several sensor are out for the winter and don’t want to reconfigure the template. eg:
{{ not ( is_state('sensor.waterpump_consumption', 'unavailable') or
is_state('sensor.boiler_keuken_consumption', 'unavailable') or
is_state('sensor.vriezer_garage_consumption', 'unavailable') ) }}
Template:
- sensor:
- name: "Overall Consumption"
state_class: total_increasing
unit_of_measurement: kWh
device_class: energy
state: >
{{
(
states('sensor.waterpump_consumption') | float(0) +
states('sensor.verlichting_gang_eerste_verdiep_current_energy') | float(0) +
states('sensor.verlichting_inkom_energy') | float(0) +
states('sensor.verlichting_voordeur_energy') | float(0) +
states('sensor.koelkast_vriezer_berging_consumption') | float(0) +
states('sensor.koelkast_vriezer_garage_consumption') | float(0) +
states('sensor.koelkast_keuken_consumption') | float(0) +
states('sensor.vriezer_garage_consumption') | float(0) +
states('sensor.boiler_keuken_consumption') | float(0) +
states('sensor.wasmachine_consumption') | float(0) +
states('sensor.droogkast_consumption') | float(0) +
states('sensor.computer_consumption') | float(0) +
states('sensor.vaatwas_consumption') | float(0) +
states('sensor.verlichting_garage_gelijkvloers_energy') | float(0) +
states('sensor.verlichting_garage_zolder_energy') | float(0) +
states('sensor.verlichting_garage_voorkant_energy') | float(0) +
states('sensor.verlichting_garage_zijkant_energy') | float(0)
) | round (2)
}}
availability: >
{{
(
states('sensor.waterpump_consumption') | float(0) +
states('sensor.verlichting_gang_ eerste_verdiep_current_energy') | float(0) +
states('sensor.verlichting_inkom_energy') | float(0) +
states('sensor.verlichting_voordeur_energy') | float(0) +
states('sensor.koelkast_vriezer_berging_consumption') | float(0) +
states('sensor.koelkast_vriezer_garage_consumption') | float(0) +
states('sensor.koelkast_keuken_consumption') | float(0) +
states('sensor.vriezer_garage_consumption') | float(0) +
states('sensor.boiler_keuken_consumption') | float(0) +
states('sensor.wasmachine_consumption') | float(0) +
states('sensor.droogkast_consumption') | float(0) +
states('sensor.computer_consumption') | float(0) +
states('sensor.vaatwas_consumption') | float(0) +
states('sensor.verlichting_garage_gelijkvloers_energy') | float(0) +
states('sensor.verlichting_garage_zolder_energy') | float(0) +
states('sensor.verlichting_garage_voorkant_energy') | float(0) +
states('sensor.verlichting_garage_zijkant_energy') | float(0)
) | round (2) >= (states('sensor.statistics_overall_consumption') | float(0))
}}
Statistics:
- platform: statistics
name: "Statistics Overall Consumption"
entity_id: sensor.overall_consumption
state_characteristic: value_max
sampling_size: 100
max_age:
hours: 24