# Keep lights on where motion was last detected?

**URL:** <https://community.homey.app/t/keep-lights-on-where-motion-was-last-detected/69147>\
**Category:** Questions & Help\
**Created:** [September 20, 2022, 4:01am UTC](https://community.homey.app/t/keep-lights-on-where-motion-was-last-detected/69147 "2022-09-20T04:01:38Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Branko\_Savic](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/branko_savic/32/34710_2.png) [@Branko\_Savic](https://community.homey.app/u/Branko_Savic)\
**Post date:** [September 20, 2022, 4:01am UTC](https://community.homey.app/t/keep-lights-on-where-motion-was-last-detected/69147/1 "2022-09-20T04:01:38Z")

</div>

As the title suggests, is it possible to keep light on where motion was last detected?

I live alone in my apartment and it is not necessary to keep the lights on in a room I am not in at the moment.

I have motion detectors in all rooms and currently I have set up timers to turn lights off when motion is not detected in a room.

This works well, however the lights can sometimes turn off in a room that I am in if the sensor doesn’t see any movement for a while.

So if I sit and watch TV for example I constantly have to wave my arms so that the lights turn on again.

So the solution would be to tell it to somehow keep the lights on where motion was last detected, so even if it doesn’t sense any movement it will assume I am still for example in the living room, since there was last movement there and no other room sensors have been triggered since then.

If however the last motion was sensed in the bedroom, the same rule will apply there. Last movement in bedroom, keep the lights on and turn off everything else after a few minutes.

---

<div class="post-metadata">

**Author:** ![Henk\_Renting](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/henk_renting/32/87634_2.png) [@Henk\_Renting](https://community.homey.app/u/Henk_Renting)\
**Post date:** [September 20, 2022, 5:59am UTC](https://community.homey.app/t/keep-lights-on-where-motion-was-last-detected/69147/2 "2022-09-20T05:59:57Z")

</div>

What if you made a flow which turns on the lights in a room where motion was detected, AND turn off all lights in other rooms (in the same flow). You have to do this for every room.  
Delete (or disable) all flows that turn off lights after a certain time in the same room where motion was detected.

When you leave home, go to sleep or it gets light, you have to switch off the lights manually in the room where you are then.

---

<div class="post-metadata">

**Author:** ![Branko\_Savic](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/branko_savic/32/34710_2.png) [@Branko\_Savic](https://community.homey.app/u/Branko_Savic)\
**Post date:** [September 20, 2022, 7:03am UTC](https://community.homey.app/t/keep-lights-on-where-motion-was-last-detected/69147/3 "2022-09-20T07:03:45Z")

</div>

I don’t want the lights to turn off immediately because sometimes maybe I am just passing by or going to the kitchen to get something, the bathroom etc. So I do want a small delay.

Also in the living room I have sat it to turn the power of to the TV and receiver as I don’t like having them on stand by. They also turn on when motion is detected, but I have set a longer timer so that they don’t turn off with the lights.

So when ever the light turns off and I have to wave to turn it on again, the timer for the TV and receiver resets.

I am probably making it more complicated than it should, but don’t know how else to do it.

---

<div class="post-metadata">

**Author:** ![Philip\_Montgomery](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/philip_montgomery/32/12434_2.png) [@Philip\_Montgomery](https://community.homey.app/u/Philip_Montgomery)\
**Post date:** [September 20, 2022, 7:40am UTC](https://community.homey.app/t/keep-lights-on-where-motion-was-last-detected/69147/4 "2022-09-20T07:40:56Z")

</div>

In your flow have a condition, an AND, set so that the lights turn off only if the TV is off

---

<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:** [September 20, 2022, 10:57am UTC](https://community.homey.app/t/keep-lights-on-where-motion-was-last-detected/69147/5 "2022-09-20T10:57:07Z")

</div>

It sounds like you’ll need occupancy sensors. They ‘see’ your presence, optional even your position in a room, and you don’t have to move at all.

Example: Aqara FP1 (not yet supported by the Homey [Aqara Xiaomi zigbee app](https://community.homey.app/t/aqara-xiaomi-smart-home-zigbee-app-v1-4-1-test-v1-4-2/156))

> **[49.99US $ 40% OFF|Aqara Body Human Presence Sensor Fp1 Spatial Positioning...](https://www.aliexpress.us/item/3256804169826053.html?srcSns=sns_Copy&spreadType=socialShare&bizType=ProductDetail&social_params=20649722254&aff_fcid=1cb4538b57024e679ccd43ee5e2f70e6-1663704651821-02971-_mNau6sM&tt=MG&aff_fsk=_mNau6sM&aff_platform=default&sk=_mNau6sM&aff_trace_key=1cb4538b57024e679ccd43ee5e2f70e6-1663704651821-02971-_mNau6sM&shareId=20649722254&businessType=ProductDetail&platform=AE&terminal_id=30ccac4c0ef844c2b66d20a9dee6d9c1&afSmartRedirect=y&gatewayAdapt=glo2usa&_randl_shipto=US)**
>
> Smarter Shopping, Better Living! Aliexpress.com

---

<div class="post-metadata">

**Author:** ![Branko\_Savic](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/branko_savic/32/34710_2.png) [@Branko\_Savic](https://community.homey.app/u/Branko_Savic)\
**Post date:** [September 20, 2022, 6:56pm UTC](https://community.homey.app/t/keep-lights-on-where-motion-was-last-detected/69147/6 "2022-09-20T18:56:41Z")

</div>

Interesting, and this works with homey pro? Have you or anyone tried it?

---

<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:** [September 20, 2022, 8:09pm UTC](https://community.homey.app/t/keep-lights-on-where-motion-was-last-detected/69147/7 "2022-09-20T20:09:57Z")

</div>

Well, this is why there’s the official app topic and the search function of the forum.  
But, while I’m here, here you go 🙃 This is from the app developer Ted:

> [@\[APP\] Aqara & Xiaomi Smart Home - A different kind of Smart Home solution (Zigbee App)](https://community.homey.app/t/app-aqara-xiaomi-smart-home-a-different-kind-of-smart-home-solution-zigbee-app/156/3931):
>
> I also need to take into account the large user base (25000+ Installs), expecting full functionality once support for a device is added. From that perspective it is one of my app development fundamentals to only add support for devices when I have tested the device myself…
> 
> I will add support for the FP1 (ordered), but to manage expectations it will be fourth in line: Aqara E1 roller shutter, P1 motion sensor, Aqara E1 curtain motor (all released in EU sales area) and then the FP1 motion sensor.
> 
> In the meantime I am following with other developers and Aqara development which FP1 features are considered stable enough to integrate in Homey’s app…

- How to find that info:  
[[HOWTO] Find app support topics or support links](https://community.homey.app/t/howto-find-app-support-topic-or-support-links/68698)

---

<div class="post-metadata">

**Author:** ![DirkG](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/dirkg/32/118897_2.png) [@DirkG](https://community.homey.app/u/DirkG)\
**Post date:** [September 21, 2022, 7:47am UTC](https://community.homey.app/t/keep-lights-on-where-motion-was-last-detected/69147/8 "2022-09-21T07:47:38Z")

</div>

Maybe this is a solution.  
As soon as you enter a room the light is switched on and the light in the previous room is switched off after a definable time. Because you live alone, you can configure each room this way. The light is always on in the room where you are.  
By using further conditions, e.g. brightness is lower than or TV is on, you can still change the behavior accordingly.

However, routines might need to be added when you go to bed and when you have guests so that this flow is stopped. For this I would use virtual switches. But this shouldn’t be a problem.

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/a/5/a528cbdd7fd8d987ce4c52a11a67d533013260e3.png)

Hope you understand the AF.

---

<div class="post-metadata">

**Author:** ![Branko\_Savic](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/branko_savic/32/34710_2.png) [@Branko\_Savic](https://community.homey.app/u/Branko_Savic)\
**Post date:** [September 22, 2022, 3:56am UTC](https://community.homey.app/t/keep-lights-on-where-motion-was-last-detected/69147/9 "2022-09-22T03:56:43Z")

</div>

This can be a solution, I will try it, thanks!

---

<div class="post-metadata">

**Author:** ![Arie\_J\_Godschalk](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/arie_j_godschalk/32/63027_2.png) [@Arie\_J\_Godschalk](https://community.homey.app/u/Arie_J_Godschalk)\
**Post date:** [September 22, 2022, 8:51pm UTC](https://community.homey.app/t/keep-lights-on-where-motion-was-last-detected/69147/10 "2022-09-22T20:51:57Z")

</div>

Please Share this flow?

> [@The Flow Exchange(r) - Exchange Your Flows with Others!](https://community.homey.app/t/the-flow-exchange-r-exchange-your-flows-with-others/68981):
>
> If you have questions about the App Device Capabilities or seek help with an Flow or with the Flow Exchanger, please see the [Device Capabilities Topic](https://community.homey.app/t/app-pro-device-capabilities-enhance-the-capabilities-of-devices/43287). [German](https://community.homey.app/t/the-flow-exchange-r-helfen-und-fragen-stellen/69807)[Another German topic](https://community.homey.app/t/device-capabilities/67934)[English](https://community.homey.app/t/app-pro-device-capabilities-enhance-the-capabilities-of-devices/43287) If you have questions about the Advanced Virtual Device or seek help with the Exchanger File, please see the [Advanced Virtual Devices Topic](https://community.homey.app/t/app-pro-device-capabilities-addendum-fully-customisable-advanced-virtual-device-with-unique-text-status-indicator/68198). [German](https://community.homey.app/t/teilen-sie-ihr-gerat-erweiterte-virtuelle-gerate-aus-den-geratefahigkeiten/69583)[English](https://community.homey.app/t/app-pro-device-capabilities-addendum-fully-customisable-advanced-virtual-device-with-unique-text-status-indicator/68198) If you want to post a AVD as a Template for others to use, please post it on [Share Your Device! - Advanced Virtual Devices](https://community.homey.app/t/share-your-device-advanced-virtual-devices-from-device-capabilities/68676). [German](https://community.homey.app/t/teilen-sie-ihr-gerat-erweiterte-virtuelle-gerate-aus-den-geratefahigkeiten/69583)[English](https://community.homey.app/t/share-your-device-advanced-virtual-devices-from-device-capabilities/68676)[Eng…](https://community.homey.app/t/share-your-device-hcs-edition-advanced-virtual-devices-from-device-capabilities/69558)

---

<div class="post-metadata">

**Author:** ![JMH](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jmh/32/29230_2.png) [@JMH](https://community.homey.app/u/JMH)\
**Post date:** [September 25, 2022, 5:47am UTC](https://community.homey.app/t/keep-lights-on-where-motion-was-last-detected/69147/11 "2022-09-25T05:47:07Z")

</div>

Just store the zone number in a variable. My living room is zone number 1, when I walk in the “last zone” is set to 1. In the lights off flow I check if the zone number is NOT 1, if it is, the flow will stop.  
Easy and effective…

---

<div class="post-metadata">

**Author:** ![Branko\_Savic](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/branko_savic/32/34710_2.png) [@Branko\_Savic](https://community.homey.app/u/Branko_Savic)\
**Post date:** [September 25, 2022, 6:16am UTC](https://community.homey.app/t/keep-lights-on-where-motion-was-last-detected/69147/12 "2022-09-25T06:16:24Z")

</div>

Could you please show me an example?

---

<div class="post-metadata">

**Author:** ![JMH](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jmh/32/29230_2.png) [@JMH](https://community.homey.app/u/JMH)\
**Post date:** [September 25, 2022, 6:44am UTC](https://community.homey.app/t/keep-lights-on-where-motion-was-last-detected/69147/13 "2022-09-25T06:44:37Z")

</div>

I’ve hoor it in advanced flows, so can’t copy on my phone. But it is really easy:

Create var “last zone”

IF zone gets active  
THEN set “last zone” to [zone number]  
(I do this in my lights flow, because this flow has already the if zone active card, but this can only be done in advanced, because you probably check your Lux before turning on the lights. If you don’t use advanced flows you’ll need to create a new flow)

IF zone is inactive for 1 (or 5, or…) minutes  
AND “last zone” is not [zone number]  
THNE turn off lights

---

<div class="post-metadata">

**Author:** ![Lammy](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/lammy/32/11436_2.png) [@Lammy](https://community.homey.app/u/Lammy)\
**Post date:** [September 26, 2022, 3:18pm UTC](https://community.homey.app/t/keep-lights-on-where-motion-was-last-detected/69147/14 "2022-09-26T15:18:44Z")

</div>

To remember the last triggered zone, you can use the “An alarm was set” card from the toplevel zone.  
Select motion as alarm type and store the zone tag in text variable.

---

<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:** [September 29, 2022, 10:07pm UTC](https://community.homey.app/t/keep-lights-on-where-motion-was-last-detected/69147/15 "2022-09-29T22:07:47Z")

</div>

Maybe this new flowcards help as well.  
App: Device Capabilities

> [@\[APP\]\[Pro\] Device Capabilities - Enhance the capabilities of devices](https://community.homey.app/t/app-pro-device-capabilities-enhance-the-capabilities-of-devices/43287/725):
>
> Okay, take a look at the [Test version](https://homey.app/nl-nl/app/nl.qluster-it.DeviceCapabilities/Device-Capabilities/test/): There is the new card: Zone became Active/inactive/both. [image] You can use the Set Capability Cards and place the Zone ID tag in the ZoneTag field.
