Converting heating time to energy consumption using known power consumption

I have an entity sensor.master_bath_floor_heating_today that uses history stats to report the amount of time my floor heating is in the ‘heating’ state:


I know that the heat uses 1.44 kWh for every hour it is active. I would like to create an energy sensor that tracks the amount of kWh used by the floor heat, so I can later add it to my energy dashboard.

Any suggestions on the best way to do this?

The state of the history_stats sensor is decimal time. So it should be a simple case of a template sensor that uses:

{% set h = states('sensor.master_bath_floor_heating_today')|float(0) %}
{{ (h * 1.44)|round(2) if h > 0 else 0 }}

for the state.

You can create this sensor in the helpers section of devices and services, and set the unit of measurement to kwh.

Doing some quick checking.
0.5 (half an hour) * 1.44 = 0.72 which looks right, half of 1.44 (720 watts)
1 * 1.44 = 1.44 obviously.
2 * 1.44 = 2.88kWh
4 * 1.44 = 5.76kWh
8 * 1.44 = 11.52kWh

Amazing, this appears to work. Thank you so much!

1 Like