Delay on/off helper

A helper that I think would be useful would be one that takes a switch, group, etc with on/off states and has a configurable on or off delay.

Of course, you could do this with a toggle helper and an automation, but it would be nice to have a single helper that does this.

Not sure I understand.
Do you want a helper that switches of a group or switch with a delay?
Sounds a bit confusing

No, I mean one that shows a delayed state change. For example, if the input entity switch changes to OFF, and you have an off delay set to 10s, the helper will continue to show the state as ON for another 10 seconds. If the input entity changes to ON again within that 10-second window, the helper will not change its state.

Switch Entity = ON, Helper = ON
Switch Entity Changes State: ON > OFF
Helper 10 second timer started
10 seconds later
Helper = OFF
Switch Entity = ON, Helper = ON
Switch Entity Changes State: ON > OFF
Helper 10 second timer started
3 seconds later
Switch Entity Changes State: OFF > ON
7 seconds later
Helper = ON (no change)

I don’t recall anyone ever asking for an entity that behaves like that. What’s the application for this behavior?

You could do this with a template binary sensor that responds to changes on the entity in question, as they have “delay_on” and “delay_off”. For example:

    - name: Radiator In Use
      unique_id: radiator_in_use
      device_class: power
      state: "{{ (states('sensor.radiator_power') | int(default=0)) > 10 }}"
      delay_on: 0:01:00
      delay_off: 0:01:00
1 Like

Thanks @michaelblight! Didn’t know template sensors had that feature.

One application for this for me was to setup a bed sensor so that it wouldn’t give false negative readings as I roll around in the middle of the night, as I tend to do.

Ah! Now I understand; I misunderstood your feature request.

You want a binary_sensor that can filter out temporary fluctuations in another entity’s state.

Yes. michaelblight’s suggestion helped. Thanks to everyone for the help :slight_smile: