> For the complete documentation index, see [llms.txt](https://homey.solweb.no/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://homey.solweb.no/aggregated-state/room-and-floor-presence.md).

# Room and floor presence v1

{% hint style="warning" %}
In 2020, I decided to rework the logic to handle room and floor presence.

This page represent the "old" way of doing it. The reason why I had to reconsider this model, was the large number of flows and timers involved.

I'd reccomend to instead use the updated [room and floor presence logic v2](/aggregated-state/room-and-floor-presence-v2.md).
{% endhint %}

I use logic boolean variables to track if there is anyone present in the room or not. For some areas I use the same technique, but track the present in a complete floor.

### Simple room presence with door sensor

The simplest setup I have to track a room, is to add a window/door sensor and a timer.

I currently use the [chronograph timer](https://homey.app/en-us/app/nl.fellownet.chronograph/Chronograph/).

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`.

![](/files/-Ltofx0VBbfzrQyjVYmY)

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.

![](/files/-LtogLXy6lSahrG7QTnW)

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.

![](/files/-LtohE-8zfzvGo-4AjnL)

Then a second flow for setting presence to false.

![](/files/-LtohQQs5dGkDOa3TK0E)

### 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`,&#x20;
  * 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
  * starts the **trigger** flow
* One flow that fires when the timer finishes
  * Sets presence to `false`

#### setActive flow

![](/files/-Ltoja1yah0wVoADy5WC)

#### trigger flow

![](/files/-Ltojw-TqAs40-_4i70h)

#### inactive flow (timer finishes)

![](/files/-LtojztxAmub15nZlyhB)

#### example of a motion alarm turns on

![](/files/-Ltok4E-5DIjv6ItKQqT)

#### example of a motion alarm turns off

![](/files/-Ltok8eQnU1K4_tT4hcP)

#### example of a door opens

![](/files/-LtokDq1IJKSzprX2Eq8)
