# Switching light ON & OFF in one single flow

**URL:** <https://community.homey.app/t/switching-light-on-off-in-one-single-flow/5747>\
**Category:** Questions & Help\
**Tags:** zigbee\
**Created:** [December 21, 2018, 6:20pm UTC](https://community.homey.app/t/switching-light-on-off-in-one-single-flow/5747 "2018-12-21T18:20:56Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jan\_Peeters](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jan_peeters/32/86660_2.png) [@Jan\_Peeters](https://community.homey.app/u/Jan_Peeters)\
**Post date:** [December 21, 2018, 6:20pm UTC](https://community.homey.app/t/switching-light-on-off-in-one-single-flow/5747/1 "2018-12-21T18:20:56Z")

</div>

Hi,

I would like to use one single flow to switch [my office] light on AND off, using the body sensor as a trigger.  
This is not really an absolute must; just going for effiency and trying to avoid a 2nd separate flow to switch the lights off again.

So:  
if the sensor goes on : lights on  
if the sensor goes off : lights off

How do I go about? In the below flow, the trigger doesn’t work. I have tried several variants, using the same Tag in the “AND” conditions as well, but to no avail.

Anyone?

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/9/9262c5a90e54bc1b7c75715765883bc616eec7b2.jpeg)

---

<div class="post-metadata">

**Author:** ![Jeroen\_Somhorst](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jeroen_somhorst/32/184_2.png) [@Jeroen\_Somhorst](https://community.homey.app/u/Jeroen_Somhorst)\
**Post date:** [December 21, 2018, 6:25pm UTC](https://community.homey.app/t/switching-light-on-off-in-one-single-flow/5747/2 "2018-12-21T18:25:48Z")

</div>

Body sensor? Do you mean a motion sensor such as from Neo coolcam or something similar? Why do you have a logic card as start and not the actual movement detected property of the device itself?

---

<div class="post-metadata">

**Author:** ![Jan\_Peeters](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jan_peeters/32/86660_2.png) [@Jan\_Peeters](https://community.homey.app/u/Jan_Peeters)\
**Post date:** [December 21, 2018, 6:28pm UTC](https://community.homey.app/t/switching-light-on-off-in-one-single-flow/5747/3 "2018-12-21T18:28:31Z")

</div>

> [@Jeroen\_Somhorst](#):
>
> olcam

Well, Aqara calls them “body sensor”. Probably a poor translation from Chinese to English…  
The sensor only has as triggers (amongst others):

- movement detection on
- movement detection off

… therefor, it will not suffice to turn the light on AND off using ONE trigger

---

<div class="post-metadata">

**Author:** ![Jan\_Peeters](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jan_peeters/32/86660_2.png) [@Jan\_Peeters](https://community.homey.app/u/Jan_Peeters)\
**Post date:** [December 21, 2018, 8:49pm UTC](https://community.homey.app/t/switching-light-on-off-in-one-single-flow/5747/5 "2018-12-21T20:49:55Z")

</div>

> [@RoyWissenburg](#):
>
> es on when there is a batt

🙂 True. that’s a mistake.  
Should have been, of course, “when sensor is ON”.  
Trust me, that isn’t the solution 🙂

Isn’t there anyone out there who understands the request?  
I’ll paste the flow in english tomorrow, after Homey’s midnight restart.

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/8/884dac981dc6a166459ad29b9174805787da72ea.jpeg)

---

<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:** [December 21, 2018, 9:26pm UTC](https://community.homey.app/t/switching-light-on-off-in-one-single-flow/5747/6 "2018-12-21T21:26:06Z")

</div>

Install the timer app!  
It works great:  
Motion sensor trigers the flow that contains the timer in the “then”  
The timer contains the lamp and a duration.  
if the motion sensors triggers again during the duration the flow will run again and restart the timer.  
If the motionsensor is not triggered the lamp will switch off at the end of the duration.

You can even set it to not trigger when the lamp is already on.

---

<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:** [December 21, 2018, 9:30pm UTC](https://community.homey.app/t/switching-light-on-off-in-one-single-flow/5747/7 "2018-12-21T21:30:34Z")

</div>

Example triggering multiple lamps  
(My motion sensor triggers a virtual device that is in the “when”)

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/0/0ba02f6e58c33f09f5926fa4d9b76439ec88e132.jpeg)

---

<div class="post-metadata">

**Author:** ![JPe4619](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jpe4619/32/9017_2.png) [@JPe4619](https://community.homey.app/u/JPe4619)\
**Post date:** [December 22, 2018, 11:52am UTC](https://community.homey.app/t/switching-light-on-off-in-one-single-flow/5747/9 "2018-12-22T11:52:36Z")

</div>

Your sensor is not a Variable but a Device.  
 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/6/6e7153ca07ad7c6b15f0a7903838ef231b0ecdc6.png)  
You need to use  
 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/1/1b9f53e07f3e3b6c7bd7970b593656847db3d87a.png)  
but this is not possible in 1 flow (as far as I can think of)

---

<div class="post-metadata">

**Author:** ![anon8748058](https://avatars.discourse-cdn.com/v4/letter/a/ebca7d/32.png) [@anon8748058](https://community.homey.app/u/anon8748058)\
**Post date:** [December 22, 2018, 12:26pm UTC](https://community.homey.app/t/switching-light-on-off-in-one-single-flow/5747/10 "2018-12-22T12:26:43Z")

</div>

Good find. This is a typical thing that should have been implemented in Homey core.  
To be able to trigger on changed tag (in your case a boolean tag) The annoying this is, is that is already a ‘known boolean’ in the Homey core system. (the brownish color is boolean, blue an integer, green is a text string)

Being able to do this would save a HUGE amount of flows to be created.
