Room and floor presence v2

In 2020, I decided to rework the logic to handle room and floor presence, and this is the result. It will reduce the number of flows significantly, and completely avoid using timers. I have used this for a few months now, and I am very happy with the results.

The built in zone functionality is very convenient and elegant, however it is useless if used out of the box. There are mainly two things that concerns me:

  • If zone is active if the door is open

  • I have motion sensors that should trigger two zones as active, in particular those in the stairs between floors.

Preparing new zones

I created a new hierarcy for zones, only for tracking presence and active state.

I started with just creating zones for the zones I would like to track, and I grouped it in a zone I named "Aggregates".

The overall idea

The overall idea is to add two sensors is each zone. One sensor that aggregates all relevant motions sensors. And one sensor that becomes active for a few seconds each time a door is either opened or closed.

Required third party apps

Creating an aggregated motion sensor

  • Add a new < group > device in the first zone you'd like to setup.

  • Choose the type of device to be alarm.

  • Choose motion alarm.

  • Choose the motion sensors that is associated with that zone. Remember one motion sensor can now be associated with multiple zones.

  • Choose an appropriate icon indicating motion.

  • Set capabilities to Motion Alarm (On if any on)

  • Give the new device a proper name

  • Notice that you can edit which motion sensors if included later, by entering settings and then advanced settings on the device.

Creating a door sensor

  • Create a new virtual device

  • Choose device, not mode

  • Click install

  • Give the device a proper name, like Door activity 2nd floor

  • Select a door icon

  • Choose the device class Sensor

  • I've chose the capability motion, to represent that door state change represents motion in that area

Now some logic is needed for the new door sensor to change state.

You will need one flow for contact alarm turned on and one for alarm turned off. I use the trigger that triggers on all contact devices, in order to reduce the number of flows here. And then use and conditions to limit the doors to the one in the proper zones.

In the then section I set the newly created virtual sensor alarm_motion to true, waits for 5 seconds and sets it to false.

The end result will look like the screenshot in the section "the overall idea" above.

Setting a logic variable

You do not need to do this step, but I prepfare to have a boolean variable to indicate that there is presence in an area. In example I have presence-2etg representing whether there is presence in second floor.

The resulting variable will not turn inactive, 30 minutes after the last activity in any of the corresponding motion sensors or doors.

Last updated