Flows for virtual switch

Hi all,
I want to create 2 virtual switches to control separately the 2 lights managed by my aqara wall switch ( 2 gang).
It’s quite tricky i think as the flows created should avoid generating an infinite loop, in order to get the switch state returned in homey when the switch is set on/off manually.
Any one who acheived this? Maybe through variables?
thanks in advance for your help.

I wrote some lines about how I deal with complex flows “how to structure your flows”

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.

When virtual pushbutton is pressed
AND light status is ON

When virtual pushbutton is pressed
ANd light status is OFF

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…

Thanks for your reply :slight_smile:
but my target is having the status of the light :frowning: so the push button won’t do the job
Thanks again

Ahh OK did not get that.
Does the aqarara wall switch not show its status in homey?

Oif you want to have a virtual switch showing the satus its nit too hard I think

WHEN aqara switch is turned ON
THEN set virtual switch to ON

WHEN aqara switch is turned OFF
THEN set virtual switch to OFF

do not really see a risk on loops.