Two options:
A)
Start with this to calculate time on
:
Then create a template sensor where you multiply the result(s) of the above mentioned component with your 0.74kW.
e.g. for yesterday
- platform: history_stats
name: Heater ON yesterday
entity_id: sensor.heater
state: '1'
type: time
end: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
duration:
hours: 24
and the template sensor:
energy_heater_yesterday:
value_template: '{{ states.sensor.heater_on_yesterday.state | multiply(0.74) | round(2)}} kWh'
friendly_name: 'Heater yesterday kWh'
B)
You mentioned Grafana. I assume you also have InfluxDB.
Do your aggregations using a combination of template sensors (some math inside) and InfluxDB sensors:
However, since you are not reading kWh or kW directly I recommend option A.