Counter: How often do we use the Heater

Hi,

i have a EM at my Heater (Oil).

You can clearly see when it is in use. Now i want to count how often it is running per day.

Is there a helper that i can use?

Kind regards,
Dominik

Hi Dominik, have a look at home-assistant.io → integrations → history stats

1 Like

You man need a few intermediate sensors to get the answer you want. First you need to determine when it is running. If you only have this energy sensor, you could create a trend sensor to identify when the energy is rising fast enough to be considered on.

If you have a power sensor, it’s probably easier to use that instead, and you can use a threshold sensor to turn on when the power is higher than a certain value.

Whichever method you use, you will end up with a binary_sensor that reflects the on/off state of your heater. With that, you can use the history_stats integration suggested earlier to count the number of times it is in the ON state.

A side note, you may want to read this post to understand the caveats of the history_stats count function.

1 Like

Thank you. The Sensor is a Shelly 1 PM so i also have a Powersensor.
The “Ultimate” reason for this is to shut down the Waterheater after it heated up two times in the morning.

Again - thank you.

then make a template helper (here Binary)

insert your correct Energy Sensor here

{{ states(‘sensor.xxxxx_energy’)|float(0) > 1 }}

and then use this new binary.sensor to create a statistics sensor in the yaml


  - platform: history_stats
    name: "Heater to On"
    entity_id: binary_xyz
    state: "on"
    type: time
    start: "{{ now().replace(hour=0, minute=0, second=0) }}"
    end: "{{ now() }}"