1) Give a description of the problem
Not so much a problem, I’m just looking for a more graceful/future proof approach.
I have a piston that cycles through a list of virtual switchs with the push of a remote button.
On push - If Virtual Switch 1 is on, turn on Virtual switch 2
On push - If Virtual Switch 2 is on, turn on Virtual switch 3
and so on…
Each Virtual switch runs a different Automation in Smartthings (triggering a specific scene), which includes turning off the other Virtual Switches. e.g. The Automation run by VS2, turns off VS1, VS3, VS4 etc.
I know I could use the piston to just run the Scenes I want to run, but I’m doing this way to help with integration in sharptools and Alexa. Switches seem to solve my problem.
So my question is basically, how do I do this more gracefully than just a series of nested If statements? I’m new to webcore, and have an extremely basic knowledge of coding.
But I’m looking for something along the lines of:
For each switch in the list; if previous switch is on, trigger the next switch.
With some kind of +1 incrementation so can easily add more Switches to the list, without keep creating more nested Ifs.
2) What is the expected behaviour?
It works, so just hoping to recreate what I’ve got.
3) What is happening/not happening?
**4) Post a Green Snapshot of the piston![image|45x37]
5) Attach logs after turning logging level to Full
Thanks in advance for any help.