Cleanest way to program a virtual switch?


Hi guys,

Very simple question really - i’m using a lot of virtual switches and I want to program different things for off and on, here is my example piston. I just wondered is there a cleaner simpler shorter way to program the logic? I know it doesn’t really matter, but by ADHD is wondered if I can do it a better way.

(By the way I realise the web request is the same on both, it’s just my example)


It looks good to me. I will mention that I have had inconsistent results with programmatically and physically changes. Just food for thought.


Just to add, virtual switches cannot be physically switched?


I presume that Simulated and Virtual switches are the same?


LOL… Good call!

They may be similar, but they use different Device Handlers, so they are not identical.
(for the record, I only recommend Simulated Switches)


Just wanted to warn you about one thing, IF you use these switches with alexa by any chance. They have a switch limit that litteraly no one in their tech support is aware. I was just keep creating new ones (called working sloppy) and after a certain number alexa stopped accepting new virtual switches.


Do you know the limit? I have a bunch…


If memory serves me correctly, if a SimSwitch is created in the IDE, that limit does not exist.
(I think it is only encountered when using the wizard to do so)

Please correct me if I am wrong, Ike.


no sorry haven’t counted them BUT i’d say i was a little short of 100 maybe?


Even though they use different DH, I presumed that essentially they are identical for our purposes. Correct?


No no no problem yet with ST IDE… My problems started when I was trying to add them to Alexa App…
I started erasing some old ones and it allowed me to add new ones.


In the past, I have seen many strange things with Virtual Switches, that did not happen with Simulated Switches. I cannot remember specifically, but it was dozens of differences over many months from multiple clients.

Long story short, I will never use Virtual Switches, or recommend them to others.


This makes me think that Alexa has a limit on the number of devices… not necessarily Simulated devices.


How do you manage voice commands then??
As you know my triggers are mainly variables but when it comes to alexa integration???


I will have to ask Michael Struck, author of Alexa_Virtual_Device_Creator.


I manually create a SimSwitch using the IDE.

(I do not create Virtual Switches, nor use some Wizard to create them)


Oh ok ok i get it know… Sim switch vs virtual switch and where you create them.
I never used switch creators. I also always create them in ST IDE.


Haha I didn’t expect this to become a virtual vs simulated switch debate. I seem to have multiple device handlers for both and i’m never sure which to use - plus I use a lot of momentary (virtual/simulated) switches for things.

I’ve started using ADT Tools as a push switch which apparently works with the new Smartthings App and V3 hub (neither of which i’ve got but thought I might as well future proof)

I will try to swap to simulated switches working on the above - funnily enough I use SmartThings to create fake switches for Homekit too and have a lot of automation done over there now as well (especially as there are many things added to Homebridge that don’t exist in SmartThings unfortunately) - i’d love a plug that would sync my Homekit only stuff with SmartThings, so I could use Webcore for more advanced stuff (without having to use simulated switches like I do)

As for simulated/virtual switches being physically switched - it seems to work ok for me, that’s how i’ve always done it?


Now I have to do some testing :slight_smile:


MichaelSMicheal SmartThings Published Contributor - author of Alexa Virtual Device Creator

“I am not aware of any limit, but was surprised there is a physical limit to devices so being a limit on virtual ones doesn’t surprise me.”