# Activate/desactivate flows with virtual switch

**URL:** <https://community.homey.app/t/activate-desactivate-flows-with-virtual-switch/26903>\
**Category:** Questions & Help\
**Created:** [March 9, 2020, 1:18am UTC](https://community.homey.app/t/activate-desactivate-flows-with-virtual-switch/26903 "2020-03-09T01:18:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pilou](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/pilou/32/13385_2.png) [@Pilou](https://community.homey.app/u/Pilou)\
**Post date:** [March 9, 2020, 1:18am UTC](https://community.homey.app/t/activate-desactivate-flows-with-virtual-switch/26903/1 "2020-03-09T01:18:28Z")

</div>

Hi everone,

I have created a flow to activate the light when I’m entering in my dressing and another one to turn off the light when there is no moving detected.  
I want to add a virtual switch to turn off those flows (light stays on) when the virtuel button is OFF. This part of the game is working but when I activate the virtual button the light doesn’t goes off… What am I doing wrong?

flow Précense dressing: when mouvement dressing activé then activer lumière dressing  
flow Absence dressing: when mouvement dressing desactivé then desactiver lumière  
flow Lumière auto OFF: when virtual switch off then desactiver flow absence dressing  
flow Lumière auto ON: when virtual switch ON then redémarrer flow absence dressing

Almost all lights at home are working this way. I just want to desactivate this fonction when needed…  
Many thanks for your tips

---

<div class="post-metadata">

**Author:** ![Pilou](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/pilou/32/13385_2.png) [@Pilou](https://community.homey.app/u/Pilou)\
**Post date:** [March 9, 2020, 2:32am UTC](https://community.homey.app/t/activate-desactivate-flows-with-virtual-switch/26903/2 "2020-03-09T02:32:46Z")

</div>

I tried something else…

I simply added a rule in absence dressing:  
when mouvement désactive AND virtual switch activé then desactiver lumière. So the light is staying on. Yessss!

But when I put the virtual switch back ON the light doesn’t go off unless I trigger de mouvement detector again… How can I solve this issue?

---

<div class="post-metadata">

**Author:** ![Shakesbeard](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/shakesbeard/32/15112_2.png) [@Shakesbeard](https://community.homey.app/u/Shakesbeard)\
**Post date:** [March 9, 2020, 6:13am UTC](https://community.homey.app/t/activate-desactivate-flows-with-virtual-switch/26903/3 "2020-03-09T06:13:01Z")

</div>

Add a second flow executing when you turn the vritual switch on, add a condition (if room not active & light on) then (turn off). The problem is, if you re-enable the flow and the room condition already is inactive by then, your flow will never run.

---

<div class="post-metadata">

**Author:** ![Pilou](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/pilou/32/13385_2.png) [@Pilou](https://community.homey.app/u/Pilou)\
**Post date:** [March 9, 2020, 11:10pm UTC](https://community.homey.app/t/activate-desactivate-flows-with-virtual-switch/26903/4 "2020-03-09T23:10:04Z")

</div>

I’m sorry, I don’t understand what you’re saying. Did you answer on my first topic or the second one? I’m still searching…

---

<div class="post-metadata">

**Author:** ![Shakesbeard](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/shakesbeard/32/15112_2.png) [@Shakesbeard](https://community.homey.app/u/Shakesbeard)\
**Post date:** [March 10, 2020, 6:10am UTC](https://community.homey.app/t/activate-desactivate-flows-with-virtual-switch/26903/5 "2020-03-10T06:10:27Z")

</div>

The 2nd one. I was a little confused why you turn the switch on to make the light go off too. Maybe something got lost in translation?
