Time sensitive templates

Hi All,

I am using an ESP for power monitoring a device, it has an unusual usage signature (see screenshot), what I want to capture is when the device is ‘in use’ signified by the power usage never dropping below 6W (area shown in red on the screenshot).

The end result I want is a binary sensor that states if the device is in use or not, however the only way I can see to do this is some time based sensor, i.e. if power > 6W for 10s then sensor is on and stays on until power drops below 6W, I could easily do this in HA or NR, but I can’t figure out how to do it in ESPHome without multiple template sensor, some delays, etc.

Is there an easy way to do this in ESP? Must be lots of scenarios where people want to detect a status after a state has persisted for a given time.

I would have thought a template binary sensor with a delayed_on filter should do the trick.

How would you do it simpler in HA? I’d have thought you’d basically need to do the same/equivalent?

Thankyou!! That is exactly what I need!

1 Like