Hi Peeps,
I’ve have stitched all my energy readings from my Shelly devices into groups so I can track energy use by category…and normally this works really well. However, from time to time I will get a MASSIVE jump in consumption as something somewhere has a fit. I’ve been waiting for another instance of this problem so I could ask for help…and now we are away for a week one has happened in my absence.
This is what we would normally see:
Note that the “Services” energy is about 1kWh - this is normal.
And this is what happens when one of the aggregating template sensors has a brain fart:
For some reason it suddenly decides that we’ve used >20kWh on energy! If I look at the sensor you can see that there was a sudden drop:
That drop is also ~20kWh so I think the sudden drop (e.g. from a shelly resetting or some other glitch) has somehow come across as consumption.
My config for this piece is as follows:
# Services - we exclude the washing machine, dryer, and dishwasher here as we count these separately.
- sensor:
- unique_id: bathroom_towel_energy
name: "Bathroom_Towel_Energy"
unit_of_measurement: "kWh"
device_class: energy
state_class: total_increasing
state: "{{states('sensor.bathroom_towel_rail_energy') | float | round(2) }}"
availability: "{{ states('sensor.bathroom_towel_rail_energy') | int(default=-100000) > -100000 }}"
- sensor:
- unique_id: bathroom_fan_energy
name: "Bathroom_Fan_Energy"
unit_of_measurement: "kWh"
device_class: energy
state_class: total_increasing
state: "{{states('sensor.bathroom_extractor_fan_energy') | float | round(2) }}"
availability: "{{ states('sensor.bathroom_extractor_fan_energy') | int(default=-100000) > -100000 }}"
- sensor:
- unique_id: ensuite_towel_energy
name: "Ensuite_Towel_Energy"
unit_of_measurement: "kWh"
device_class: energy
state_class: total_increasing
state: "{{states('sensor.ensuite_towel_rail_energy') | float | round(2) }}"
availability: "{{ states('sensor.ensuite_towel_rail_energy') | int(default=-100000) > -100000 }}"
- sensor:
- unique_id: ensuite_fan_energy
name: "Ensuite_Fan_Energy"
unit_of_measurement: "kWh"
device_class: energy
state_class: total_increasing
state: "{{states('sensor.ensuite_extractor_fan_energy') | float | round(2) }}"
availability: "{{ states('sensor.ensuite_extractor_fan_energy') | int(default=-100000) > -100000 }}"
- sensor:
- unique_id: services_energy
name: "Services"
unit_of_measurement: "kWh"
device_class: energy
state_class: total_increasing
state: >
{% set ensuite_fan = states('sensor.ensuite_fan_energy') | float %}
{% set ensuite_towel = states('sensor.ensuite_towel_energy') | float %}
{% set bathroom_fan = states('sensor.bathroom_fan_energy') | float %}
{% set bathroom_towel = states('sensor.bathroom_towel_energy') | float %}
{{(ensuite_fan + ensuite_towel + bathroom_fan + bathroom_towel) | round(2)}}
availability: >
{{
is_number(states('sensor.ensuite_fan_energy')) and
is_number(states('sensor.ensuite_towel_energy')) and
is_number(states('sensor.bathroom_fan_energy')) and
is_number(states('sensor.bathroom_towel_energy'))
}}
As I understand it the use of state_class: total_increasing is what should stop that sort of behaviour…but no…
Any ideas as to what I could do / change to prevent these sort of problems? It happens randomly (every few weeks / months) to any of my energy aggregators, but it can also happen to single devices such as the washing machine.
It’s bound to be something simple on my end but I have not been able to figure it out…
Thanks!