Calculation based on History stats

Hi,

i have the Smarther2 thermostat from Legrand. It is working just fine, however i want to track the time the heater was on.
there is a state_attr hvac_action that shows if it is heating or idle. So yes, i know the long way solution to create a template sensor to monitor the hvac action, and them have a utility meter to do calculations.
However, the climate device it self, when you go to History, it shows exactly when it is heating or idle. How can a get that to do the calculation. Adding all the time sensors i do not think it is the right approach, since you increasing the duplication or triplication of the records.

Use this rather than a utility meter:

But it does not support attributes, so you still need the template binary sensor as an entity for it to track when your heating is on.