# Flows for virtual switch

**URL:** <https://community.homey.app/t/flows-for-virtual-switch/28928>\
**Category:** Questions & Help\
**Tags:** zigbee, devices, flow\
**Created:** [April 25, 2020, 5:50am UTC](https://community.homey.app/t/flows-for-virtual-switch/28928 "2020-04-25T05:50:11Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [April 25, 2020, 6:10am UTC](https://community.homey.app/t/flows-for-virtual-switch/28928/2 "2020-04-25T06:10:47Z")

</div>

> [@elyoussoufit](#):
>
> It’s quite tricky i think as the flows created should avoid generating an infinite loop

I wrote some lines about how I deal with complex flows [“how to structure your flows”](https://community.homey.app/t/how-to-structure-your-flows/25109)

What I do in the case you describe: do not create virtual switches. Create virtual pushbuttons. These do not have a status so you don’t need to return the status them.

So:  
When virtual pushbutton is pressed  
AND light status is ON  
THEN

When virtual pushbutton is pressed  
ANd light status is OFF  
THEN

PS: yes you can build the second flow i to the first flow in the ELSE section.  
Please read the “how to structure your flows” to understand why I do not do it…

---

_[View the full topic](https://community.homey.app/t/flows-for-virtual-switch/28928)._
