Hi folks, I hope you are all well. I am looking for a solution to calculate the energy consumption of an infrared heating over a period of time. I control the heating through home assistant. In simple words: There is a wifi switch for the IR panel and a temperature sensor in every room and they are controlled through the generic thermostat integration. The information I am looking for is stored in the history of the entity ids of each switch (I know the exact electrical power of each infrared panel). Now I am looking for an automation to calculate the duration of active panels over some time. I have no idea how to manage that with home assistant, but I am sure that there is a solution for that. Any ideas?