Add delay or inertia for sensor

Hi!

I have several automation scenarios depending on binary sensors. Let’s say on window open sensor. I want to add some inertia to them. So I want sensor that is true if window is currently open or was open within last 10 minutes.

So I want to create some synthetic fake binary sensor that depends on real sensor and goes to true immediately after real goes true, but goes false only if real was false within last 10 minutes.

Is simple words I want flag “window is currently open or was opened within last 10 minutes” which I can later use in scenarios.

Is it somehow possible?

Hi, i think the fastest way is with automation

Probably easiest in automation using the for option for the state trigger.

Can you please give a piece of advice how to use automation for that?

This code turn on the input_boolean.windows_status when the binary_sensor.windows goes from off to on

- id: '1'
  alias: Windows_status_on
  description: ''
  trigger:
  - entity_id: binary_sensor.windows
    from: 'off'
    platform: state
    to: 'on'
  condition: []
  action:
  - data: {}
    entity_id: Input_boolean.windows_status
    service: input_boolean.turn_on

This code turn off the input_boolean.windows_status when the binary_sensor.windows goes from on to off and stays off for 10 minutes

- id: '2'
  alias: Windows_status_off
  description: ''
  trigger:
  - entity_id: binary_sensor.windows
    for: 00:10:00
    from: 'on'
    platform: state
    to: 'off'
  condition: []
  action:
  - data: {}
    entity_id: Input_boolean.windows_status
    service: input_boolean.turn_off
1 Like