I am trying to configure my alarmo based alarm system to have a night mode that I could use when the familiy is home. But to make this usable I need a custom sensor that works such that ff sensor “binary_sensor.upstairs_hallway” is triggered first then I want it to ignore “binary_sensor.hallway” for say 15 minutes. This way if someone uses the toilet in the middle of the night, the hallway sensor is not triggered.
Usually you would just put the perimeter sensors (e.g. door and window contact sensors) in the night mode group. So you can walk around the house but not enter/exit it. Also some unused rooms. e.g. I have the perimeter of my house plus all downstairs movement sensors as I do not go downstairs at night. However my alarm is disarmed when I get out of bed.
If you do not have sufficient sensors to cover the perimeter of your house or to automate based on bed occupancy you could maybe use a triggered binary sensor:
Try this (untested)
# configuration.yaml
template:
- trigger:
- platform: state
entity_id:
- binary_sensor.upstairs_hallway
- binary_sensor.hallway
not_to:
- unknown
- unavailable
binary_sensor:
- name: Hallway Night Movement
device_class: motion
state: >
{% if now() - states.binary_sensor.upstairs_hallway.last_changed < timedelta(minutes=15) or is_state('binary_sensor.hallway','off') %}
{{ false }}
{% else %}
{{ states('binary_sensor.hallway')|bool }}
{% endif %}