Hold the home state

I have a near-perfect soution Group people for detecting occupancy and it works well. I just noticed a problem, though. Whenever my Fritzbox recognizes and enlists a new WLAN device, my Smart phone goes from “home” to “unknown” (not “away”) for about thirty seconds and zone.home drops to zero. This is no problem for my “leaving home” trigger, I just set the “for” part to two minutes. But I also use the occupied state as a condition in several places. Now a trigger can come at any time and it only comes once. It’s rather improbable but possible that it just hits one of those short glitches and doesn’t start. Is it possible to make the occupied switch hold the “on” state for a bit before droping to “off”?

{{ states('zone.home')|int > 0 or is_state('input_boolean.immer_da', 'on') }}

Danke

I’ve solved it myself. It seems not to be possible through the UI, so I deleted it there and added it to my templates.yaml:

- binary_sensor:
    - name: Anwesend
      device_class: occupancy
      state: "{{ states('zone.home')|int > 0 or is_state('input_boolean.immer_da', 'on') }}"
      delay_off: "00:05:00"

Hope it may help somebody someday.