When the door opens or closes, I set the presence to true, restart a timer from 50 minutes. When the timer fires, I flip the presence back to false.
For a door sensor, there is no available triggers that covers both open and close. The result is that I duplicate the flow above and have an nearly identical flow Bad1 trigger active2, that triggers when the contact alarm turned off instead of on.
The flow above fires when the door has not been opened or clsoed for 50 minutes.
I use this setup for rooms where you do not stay for very long at a time, such as bathroom and a booth. For the childrens room and other room where you can for stay longer, I've added a motion sensor as well.
Simple floor presence
I have a floor with multiple motion sensors. I track the presence in this floor by using the zone feature. I have no door sensors (nor doors) on this floor.
Then a second flow for setting presence to false.
More complex presence
It gets messy when you have an area with multiple motion sensor that does not match a floor, and combine them with multiple door sensors.
I have these flows:
One setActive flow, that is executed from the trigger cards. This flow is execturd when motion is detected.
The setActive flow sets presence to true,
and stops the timer.
One card for each of the motion sensors/zones when motion is detected, starting the setActive flow above.
One flow called trigger, that checks if there is no motion in any of the motion sensors, and if so, it:
starts a timer with a duration of 20 minutes
sets presence to true
One flow for each of the motion sensor when motion alarm is turned off, that:
starts the trigger flow
Two flows for each of the door sensors (one for open and one for close), that