binary_sensor:
- platform: template
sensors:
house_occupied:
delay_off:
minutes: 20
value_template: >-
{{ is_state('device_tracker.stoles_phone', 'home')
or is_state('binary_sensor.office_motion', 'on')
or is_state('binary_sensor.front_door', 'on')
or is_state('binary_sensor.bedroom_window', 'on') }}
This will give you binary_sensor.house_occupied and it will turn on when any of those states are true, but will wait 20 minutes before turning off after those states are false.