# Flow to turn on and off lights by room occupancy

**URL:** <https://community.homey.app/t/flow-to-turn-on-and-off-lights-by-room-occupancy/155719>\
**Category:** Flows\
**Tags:** flow, advancedflow\
**Created:** [June 3, 2026, 6:47pm UTC](https://community.homey.app/t/flow-to-turn-on-and-off-lights-by-room-occupancy/155719 "2026-06-03T18:47:30Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![Darren\_Barton](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/darren_barton/32/120935_2.png) [@Darren\_Barton](https://community.homey.app/u/Darren_Barton)\
**Post date:** [June 3, 2026, 6:47pm UTC](https://community.homey.app/t/flow-to-turn-on-and-off-lights-by-room-occupancy/155719/1 "2026-06-03T18:47:30Z")

</div>

Please can I ask for some advice. I am looking for two lamps to turn on (via smart plugs) after sunset and remain on whilst the room is occupied, and then turn the lamps off when the room is empty. I have two sonoff presence sensors and 1 aqara motion sensor along with two smart plugs.

When any of the presence sensors or motion sensor is triggered, I would like the lamps to turn on. To prevent the lamps turning off whilst the room is occupied I have inserted a 10 minute delay which I intended would reset the 10 minute delay each time any of the sensors are re-triggered.

However, my advanced flow does not seem to work correctly and the lights turn off after 10 mins when the room is still occupied.

Please can I ask for any suggestion on how I can modify the flow so the lamp remain on whilst the room is occupied? Thank you

 ![Screenshot 2026-06-03 194629](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/a/b/abaadbdf47a649d2b15e3d2341a51dbbb41ea3e9.jpeg)

specific Flows in homey.

---

<div class="post-metadata">

**Author:** ![Call\_e](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/call_e/32/79513_2.png) [@Call\_e](https://community.homey.app/u/Call_e)\
**Post date:** [June 3, 2026, 7:05pm UTC](https://community.homey.app/t/flow-to-turn-on-and-off-lights-by-room-occupancy/155719/2 "2026-06-03T19:05:33Z")

</div>

You are missing a second trigger for turning off the lamps as the setup of your will always turn them off after the ten minutes timer is ended. Personally I have created zones for each room and will turn the lights on when the zone is activated, and tuning them off when the zone has been inactive for a certain amount of time. This way of doing it will also exclude the need of using a separate timer as you are using in the flow. Bear in mind that this is just one way of doing, but this is the one that I prefer. But despite of it all, you will need a second trigger.

---

<div class="post-metadata">

**Author:** ![Wim\_Post](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/wim_post/32/56793_2.png) [@Wim\_Post](https://community.homey.app/u/Wim_Post)\
**Post date:** [June 3, 2026, 7:21pm UTC](https://community.homey.app/t/flow-to-turn-on-and-off-lights-by-room-occupancy/155719/3 "2026-06-03T19:21:30Z")

</div>

> [@Darren\_Barton](#):
>
> a 10 minute delay which I intended would reset the 10 minute delay each time any of the sensors are re-triggered.

Once the 10 minutes delay card is started it can’t be interrupted. So the lights will turn off after 10 minutes no matter what.

---

<div class="post-metadata">

**Author:** ![Darren\_Barton](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/darren_barton/32/120935_2.png) [@Darren\_Barton](https://community.homey.app/u/Darren_Barton)\
**Post date:** [June 3, 2026, 7:50pm UTC](https://community.homey.app/t/flow-to-turn-on-and-off-lights-by-room-occupancy/155719/4 "2026-06-03T19:50:23Z")

</div>

thank you for the advice - I will try out another trigger.

---

<div class="post-metadata">

**Author:** ![Darren\_Barton](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/darren_barton/32/120935_2.png) [@Darren\_Barton](https://community.homey.app/u/Darren_Barton)\
**Post date:** [June 3, 2026, 7:50pm UTC](https://community.homey.app/t/flow-to-turn-on-and-off-lights-by-room-occupancy/155719/5 "2026-06-03T19:50:57Z")

</div>

thank you!

---

<div class="post-metadata">

**Author:** ![Hsd1965](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/hsd1965/32/30160_2.png) [@Hsd1965](https://community.homey.app/u/Hsd1965)\
**Post date:** [June 3, 2026, 8:39pm UTC](https://community.homey.app/t/flow-to-turn-on-and-off-lights-by-room-occupancy/155719/6 "2026-06-03T20:39:07Z")

</div>

You need to program something like:

‘If none of the presence sensors was activated for 10 minutes, turn off the lamps’

Also look at the options to use the activity status of the room ‘Lounge’. If all the sensors are in the same room that is much simpler than checking each sensor individually.

---

<div class="post-metadata">

**Author:** ![deejayreissue](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/deejayreissue/32/81912_2.png) [@deejayreissue](https://community.homey.app/u/deejayreissue)\
**Post date:** [June 3, 2026, 9:31pm UTC](https://community.homey.app/t/flow-to-turn-on-and-off-lights-by-room-occupancy/155719/7 "2026-06-03T21:31:44Z")

</div>

Split the flow up into multiple commands

The card you want to use is actually a WHEN card, not a THEN card.

![Inactive](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/7/4/74c531962579e5a6aa529e216a32ba81121d8803.png)

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [June 3, 2026, 10:26pm UTC](https://community.homey.app/t/flow-to-turn-on-and-off-lights-by-room-occupancy/155719/8 "2026-06-03T22:26:50Z")

</div>

To not getting left in the dark, this works best for me

> [@The Flow Exchange(r) - Exchange Your Flows with Others!](https://community.homey.app/t/the-flow-exchange-r-exchange-your-flows-with-others/68981/8):
>
> To prevent the light (or other device) from turning off (or on), while there’s still motion detected.  
> It uses Homey’s **Zone Activity** _AND a timer_.  
> This way your motion- & contactsensors become exchangeable and expandable, without having to fix the flow.
> 
> This way, you can add a sensor, remove one (use 1 sensor minimum), use one with another protocol (f.i. zigbee/wifi/z-wave) in a zone.
> 
> ### Apps used
> 
> - [Chronograph](https://homey.app/a/nl.fellownet.chronograph/)
> 
> ### Flow example:
> 
> ![2aa742727e50bc75f1e9b207663d1b8b84560c32_2_1034x552](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/0/4/04e063fc9558c99ec6975824a193866f186e5406.jpeg)

---

<div class="post-metadata">

**Author:** ![Darren\_Barton](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/darren_barton/32/120935_2.png) [@Darren\_Barton](https://community.homey.app/u/Darren_Barton)\
**Post date:** [June 4, 2026, 7:02am UTC](https://community.homey.app/t/flow-to-turn-on-and-off-lights-by-room-occupancy/155719/9 "2026-06-04T07:02:44Z")

</div>

I will try that, thank you

---

<div class="post-metadata">

**Author:** ![Darren\_Barton](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/darren_barton/32/120935_2.png) [@Darren\_Barton](https://community.homey.app/u/Darren_Barton)\
**Post date:** [June 4, 2026, 7:03am UTC](https://community.homey.app/t/flow-to-turn-on-and-off-lights-by-room-occupancy/155719/10 "2026-06-04T07:03:31Z")

</div>

Thank you for sharing this.

---

<div class="post-metadata">

**Author:** ![FKey](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/fkey/32/14793_2.png) [@FKey](https://community.homey.app/u/FKey)\
**Post date:** [June 4, 2026, 10:39am UTC](https://community.homey.app/t/flow-to-turn-on-and-off-lights-by-room-occupancy/155719/11 "2026-06-04T10:39:41Z")

</div>

Zone activity also has this card

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/8/f/8f8c16b7c1e7bb65434b1df87ae9dbcc600315fd.png)

That way you can remove the timer. (But you are limited to minutes)

The ["zone activity](https://homey.app/en-us/app/nl.erikvl87.zoneactivity/Zone-Activity/)" app provides even more options

---

<div class="post-metadata">

**Author:** ![deejayreissue](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/deejayreissue/32/81912_2.png) [@deejayreissue](https://community.homey.app/u/deejayreissue)\
**Post date:** [June 4, 2026, 12:33pm UTC](https://community.homey.app/t/flow-to-turn-on-and-off-lights-by-room-occupancy/155719/12 "2026-06-04T12:33:15Z")

</div>

Most of the above solutions require more apps, so that’s less space and less ram for your Homey for other use cases

The card already exists for Matter products, so just use that

Timers for presence is just time consuming to build, manage and troubleshoot. Also, if the community app stops being updated to be compatible for future Homey firmware updates, you’ll have to redo those flows

People really need to start offering simple solutions for others on this forum and stop burdening them with unnecessary complexity

---

<div class="post-metadata">

**Author:** ![deejayreissue](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/deejayreissue/32/81912_2.png) [@deejayreissue](https://community.homey.app/u/deejayreissue)\
**Post date:** [June 4, 2026, 12:35pm UTC](https://community.homey.app/t/flow-to-turn-on-and-off-lights-by-room-occupancy/155719/13 "2026-06-04T12:35:52Z")

</div>

one activity also has this card

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/8/f/8f8c16b7c1e7bb65434b1df87ae9dbcc600315fd.png)

> "That way you can remove the timer. (But you are limited to minutes)
> 
> The ["zone activity](https://homey.app/en-us/app/nl.erikvl87.zoneactivity/Zone-Activity/)" app provides even more options"

You can literally put 0.25 minutes to get seconds on this card. It’s really not that difficult.

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [June 4, 2026, 5:28pm UTC](https://community.homey.app/t/flow-to-turn-on-and-off-lights-by-room-occupancy/155719/14 "2026-06-04T17:28:08Z")

</div>

> [@FKey](#):
>
> this card

I’m aware of that card. But it acts flaky here (doesn’t trigger at times). The Chronograph is very reliable.

I don’t see how we can remove the timer from my flow, because the “on” branch pauses that same timer.

All in all, I always use and show the timer version because it works at all times 😉

---

<div class="post-metadata">

**Author:** ![FKey](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/fkey/32/14793_2.png) [@FKey](https://community.homey.app/u/FKey)\
**Post date:** [June 4, 2026, 9:09pm UTC](https://community.homey.app/t/flow-to-turn-on-and-off-lights-by-room-occupancy/155719/15 "2026-06-04T21:09:09Z")

</div>

> [@Peter\_Kawa](#):
>
> I’m aware of that card. But it acts flaky here (doesn’t trigger at times)

Funny, Never had an issue with this card, use it in many flows to control my lights (so I would notice quiclkly if its flaky)

---

<div class="post-metadata">

**Author:** ![Darren\_Barton](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/darren_barton/32/120935_2.png) [@Darren\_Barton](https://community.homey.app/u/Darren_Barton)\
**Post date:** [June 6, 2026, 9:17am UTC](https://community.homey.app/t/flow-to-turn-on-and-off-lights-by-room-occupancy/155719/16 "2026-06-06T09:17:53Z")

</div>

Thank you

---

<div class="post-metadata">

**Author:** ![dsdevries](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/dsdevries/32/80220_2.png) [@dsdevries](https://community.homey.app/u/dsdevries)\
**Post date:** [June 8, 2026, 11:31am UTC](https://community.homey.app/t/flow-to-turn-on-and-off-lights-by-room-occupancy/155719/17 "2026-06-08T11:31:40Z")

</div>

@Darren_Barton  
I have written an extensive tutorial about how to implement presence detection and use it to control lights. You can read it down below.  
However, for this specific use case I don’t think you’ll need that complex setup, nor any third party app. The Aqara apps allow you to just configure the reset time in the advanced settings of the presence sensor. Just increase the presence sensor reset time to 10 minutes (600 seconds) and you’re done.

 ![Screenshot 2026-06-08 at 13.30.27](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/4/c/4c3c58ebf2e58d425faad3bc294335d6518367fc.png)

here’s the link to my tutorial, in case you want to build more complex automation in the future:

> [@\[HOW TO\] Gain full control over Zone Activity using Motion Sensors (PIR), Presence Sensors (Aqara FP300) and Virtual Motion Triggers](https://community.homey.app/t/how-to-gain-full-control-over-zone-activity-using-motion-sensors-pir-presence-sensors-aqara-fp300-and-virtual-motion-triggers/144082):
>
> UPDATE: Added implementation using AQARA FP300 presence sensor below Introduction This is not a guide on how to implement a specific use case, but rather a framework that will give you full control over zone activity. Many flows like turning on/off lights could be done much simpler. However, when my personal flows became more complex, I ran into a lot of caveats and quirks that caused me to rethink how I work with motion sensors. I came up with this system which allowed me to solve all the bugs …

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [June 8, 2026, 5:29pm UTC](https://community.homey.app/t/flow-to-turn-on-and-off-lights-by-room-occupancy/155719/18 "2026-06-08T17:29:38Z")

</div>

I get that. It just occurred after a few weeks, and then several days all was ok again. That went on and on with unknown intervals;  
I pulled my hair out what could be wrong, until I added a log card to that zone trigger card.

Maybe this issue is fixed in the meantime, I didn’t notice it in the changelogs. Just to be sure to not be left in the dark, I’ll stick to the Chronograph timers 😉
