How to synchronize a virtual switch state to a device that is triggered by that switch

There is a very good thread outlining the uses for a virtual switch and tying it to a “hello home” routine, for reference, that thread is here: Alexa FAQ.

I was able to create the virtual switches and tie their “transition” to ON or OFF to separate Hello Home Routines… This in itself works very well and I can then tell Alexa to discover my devices, then tell Alexa to “turn off Virtual Garage Door 1” and it will set the virtual switch to off, the transition from on to off will then trigger my hello home routine “Close Garage Door 1” and all is well. This is of course all to allow me to bypass Alexa’s inability to allow users to control doors and locks and other unsupported devices. I also add the virtual switch to the group “Garage” and not I can simply tell Alexa to “turn off the Garage” and it will close the garage door, turn off any lights in the garage etc… This is the ideal situation/command.

My Problem is that much like a Home entertainment system without discrete on/off switches, if the device I’m trying to close or open (garage door in this case) is opened or closed in a way OTHER than by setting the virtual switch state, then the switch and the door will be out of synch. For example:

So, in order to make virtual switches work with Alexa, I really need a mechanism to tie the current state of a device to the state of the virtual switch. Ideally, I do not want to do this with an external app, I would like all of the logic to be executed locally without having to go out to the Internet and it should be simple to configure, something like a “State Match App” which allows you to tie a device to a virtual switch and updates the state of the virtual switch to whatever the device being controlled is, or add this to the virtual switch itself as a configuration option.

Is there a way to do this with existing drivers and/or apps ?

One other comment… There has been some reference to using the lighting smart app and using the power allowance exceeded option and setting it to a small number so that when the virtual switch is set to “ON”, the smart app would then toggle it to off, but this just complicates it further since there is now a state where the door was opened using the virtual switch, the state is now off due to power allowance and then I go to close it using alexa, it will fail because the switch is off…

I thought about using momentary switches and creating 1 for each direction (close/open) but then it is not possible to integrate this easily with Alexa since the goal is to simply say “Alexa, turn off the garage”, this can’t be done with 2 push button switches. I suppose I could get creative and create a group called “Nighttime Garage” and “Daytime Garage” in Alexa and add the push button switch that triggers the close garage to nighttime and the one that triggers open garage to daytime, effectively doubling the number of any groups I have in Alexa and yes, this would work, but my wife would never find this easy to use and that is really the ultimate goal/test. I am trying to operate within a very simple framework of allowing anyone in the home to remember as few details as possible about HOW to execute commands “specific action” room names and just rely on the fact that if you tell alexa to turn off a room, everything in that room will transition to off (as long as it’s in the alexa group)

I’m open to suggestions.

Thanks…

Some additional summary details below, sorry for the long winded post.

I would like to be able to open or close the garage door in any of the following 4 ways:

Manually with the garage door switch (coded or otherwise)
Via the smart things app
Via Alexa by saying "Turn off ‘virtual switch 1’ "
Via Alexa by saying “turn off workshop” where the workshop group in alexa contains all of the lights, door locks, garage door openers etc…
I can accomplish items 1-3 just fine, item 4 is the problem. I am not able to control which method of “turning on” or “turning off” a room is executed (Wife and friends).

Sometimes I work with the door open. sometimes not. Another good example of this is as follows:

I tell alexa to turn off the Garage, Alexa togles virtual switch to off which triggers Linear to close the garage door. The state of the virtual switch is now “OFF”
Wife drives home afterward and opens the door with standard garage opener (I am not going to train the wife on proper garage door etiquette… )
Smarthings thinks virtual switch is “OFF”
Someone tells Alexa to “Turn off the Garage”. If the lights were on, they are now off since their state is known, if they were already off, that’s fine too. The virtual switch “VGarage” is now set to “Off”, no change occurs from it’s previous state, hence no trigger of the routine to close the Linear controller, garage door stays open all night, raccoons now have a home, wife is pissed, smarthome is disabled, all residents now have to get off their butts and manually turn off switches and close doors.
I think if I can trigger the state of the virtual switch by the position of the linear door opener, it will solve my problem. Ideally, I would prefer to do so without non-local device drivers or IFTT. Right now, the ONLY device that the virtual switch triggers is the linear controllers. I have 2 virtual switches:

VGarage
VWorkshop
I added VGarage to the group “Garage” in Alexa, this group now contains:

a. Garage Light Switch (GE)
b. garage overhead door 1 (Linear)
c. Garaget door lock (to be added later)
I added VWorkshop to the group “Workshop” in Alexa, this group now contains:
a. Workshop Light Switch (GE)
b. Workshop Overhead Door 1 (Linear)
c. Workshop Door Lock (Kwikset)

Routines:
“Close Workshop Overhead Door 1” will close the Linear controller in the workshop when the VWorkshop switch is set to “off”
“Open Workshop Overhead Door 1” will close the Linear controller in the workshop when the VWorkshop switch is set to “on”

Same for Garage.

Simplest thing to do is to use webCoRE to set the rules.

If switch is on
Turn using virtual Switch
Turn on
Else
Turn off

1 Like

Thank you for the reply, but as I understand it, Webcore is an external package and I must have Internet access in order for it to work. It also requires some form of programming expertise.

I have been working with Smarthings for several years now. I have to admit I was initially drawn to it because of the community, the ability to “play” with new IOT devices and the flexibility, but over the years I have become to rely on my smartthigns v2hub and various IOT devices as I would any other basic utility function in my home such as a light switch. Given that, any functionality in my home needs to be:

  1. easily used by every member.
    a. for those of you who are not married or have a significant other that just does not get as excited as we do by a smart home using voice commands, you wouldn’t understand.

  2. should not require any real programming skills

  3. Be 100% reliable and reproduce able. That is it can’t stop working because Samsung decided to do an upgrade without my permission and now automated lighting routines no longer work (pet peeve of mine)

  4. Should be 100% self contained for all major functions (No Internet Required)
    a. Local drivers as much as possible.

    So, yes, I’m sure webcore would provide 1 solution for this problem but it violates several basic tenants of a good product philosophy, at least in my world.

    Is there a “local” solution to synchronizing states of actual devices with virtual switches ? Or is there another solution to my problem I may be overlooking ?

BTW… any feature which allows the synchronization of a physical device with a virtual one “MUST NOT” cause routines to see a state change and hence trigger that routine or you end up in a loop.

Cheers…

virtual/simulated devices do not run local

Thanks for that info.

Anyone else out there have any feedback on how to synch the two devices ? I’ll lobby for more local processing in parallel.

To you garage door problem specifically, why not just install a device handler that has switch capability added? there are several floating around here. I use Rboy’s, but mainly because i already purchased access to his apps and handlers.

Thanks for that reference, after looking at the linear device hander it does sound like an elegant solution and I sent soom questions their way.

I’m assuming that the device hander would then be non local which is not optimal but might be a good workaround until the smart things staff can allow for the import of device handlers locally. In looking through these threads, I’ve seen many requests for this capability. That and smart apps.

Unless something has changed in ST that I’m unaware of, as long as a single part of an automation does not support local processing…then the ENTIRE automation is no longer local. The fact that you are using virtual switches makes the entire process cloud based, so unfortunately you are asking for the impossible.

So unless you are using “Z-Wave Garage Door Opener” as your garage’s Device type Handler, and something like Smart Lighting…there is no way to achieve local processing.

Things may have changed so I might be wrong. If you are willing to forgo the “Totally Local” there are options out there.

BTW, I once believed in this mantra, but after the second time the ST cloud went down and my “LOCAL” automations failed, I gave up on it and accepted that ST will always be cloud based in my mind. I always have a simple physical solution as a backup for my automations and use ST for convenience only…nothing critical.

Check out these links a well. I assume they are still relevant.

Below lists all your automations that are actually local right now. If it isn’t there, it’s because either the device or the smartApp are not part of the “allowed to run local” list.
https://graph.api.smartthings.com/localInstalledSmartApp/list

Below is the list of tested device types that CAN run locally.

Hellbent is perhaps a strong sentiment, but “ideologically directed” certainly. My thought is this… Many of the items in the home that “smart things”/Intelligent Home electronics in general are replacing or automating are devices that we have come to understand “just work”. If a smart controller is to manage devices like these, then it too should “just work” and it has to do so for people who are not nearly as tolerant as those on this thread. I’m fine with using some add-ons from 3rd parties which run in the cloud as an interim step and I recognize these as adding functionality more quickly then can be done internally using 100% Samsung employees, but the overall goal should be to have all of the primary functionality reside local to avoid network complexities, latency and security issues.

Non-interested, non-vested users in a smart home will want to rip out anything that causes them frustration. I see that frustration all the time in these threads as exemplified above when it was stated that his local routines did not run with the Internet down. I’m sure his wife was thrilled that the lights didn’t “just work”. This makes it harder for those of us who are willing to suffer through this to justify the added cost to those who aren’t (wives) which in turn lowers adoption rates and limits revenue for Samsung.

I don’t see any of the above sentiment regularly reflected in the posts from the smartthings staff but I am hopeful they will get there as I am fully vested in this technology, and even with the shortcomings, smartthings is by far the best solution out there today.

1 Like

You might want to look into OpenHab, rather than SmartThings. Or just accept that things can run in the cloud and that’s a good thing.

1 Like

well that just eliminated every home automation system LOL :wink:

If not then the solution was given to you on the 2nd post.

Simplest thing to do is to use webCoRE to set the rules.

If switch is on
Turn using virtual Switch
Turn on
Else
Turn off

There is no local solution. Virtual Switches are cloud based.