I have a Shelly EM and want to record the length of time my pool runs each day. I have created the following sensor but it has the run time as 0.0 even though the pump has been running.
platform: history_stats
name: Pool pump run time today
entity_id: sensor.shellyem_a4e57cba99c7_channel_2_power
state: ‘on’
type: time
start: ‘{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}’
end: ‘{{ now() }}’
I presume that the EM does not have an on/off state and this is why is it not working. Could I create a sensor to record the time that the the energy consumption is greater that 1kw to achieve the same result and what would this look like?