I’m using ST with Amazon Echo and have set up virtual switches and virtual dimmers for groups of lights. I’m using virtual switches because of the strange verbiage Alexa needs. I could create routines that turn on all lights and a separate routine to turn off all lights, but I have to name them different things, and then tell Alexa to “turn on” name of routine no matter if it’s turning lights on or off. So that just seems weird to me. So the virtual switches/dimmers work so that I can say “Alexa, turn on All Living Room Lights”, and “Alexa, turn off All Living Room Lights”, and all lights assigned to the group inside the virtual switch (using a Dim With Me SmartApp) will turn on and off. This is great except for one issue.
If a virtual switch is in the off position, and I turn on a light or a set of lights, specifically by name, without using the virtual switch, then if I want to use the virtual switch by saying, “Alexa, turn off All Living Room Lights” it doesn’t work because that virtual switch is already off.
Is there something I can do that would allow that virtual switch to still send a turn off command to all the lights in the group assigned to that virtual switch, even though that virtual switch is already in the off position?
It makes enormous sense. I just encountered this last week! The programming to get there, however, is significant. I have therefore decided that for any group-items that don’t need programming (for example, I can’t imagine ever needing SmartThings routines to, upon a particular sensed event, turn on/off the entire downstairs) the better solution is the Alexa groups.
The Alexa groups do not maintain any switch state; they simply apply your command to every item in the group whenever you utter the command. So “Alexa, turn downstairs off” sends the OFF command to any items that are included in that group. The spoken syntax is simple and direct, and the result is consistent.
One other benefit is dimming. Imagine you have a light fixture that holds three bulbs. Put three smart bulbs in, group them as a single unit in Alexa (say, ‘chandelier’) and then you can say “Alexa, turn the chandelier to 50 percent” and all three bulbs will obey. And if you later say “Alexa, dim the chandelier” ALL the bulbs in the chandelier will dim together. With zero complex programming.
@Triscuits, I have the same situation and there are a couple viable solutions for you:
Instead of using Dim With Me, you could use a synchronized dimming app. A synchronized dimmer would make it so that all lights were synchronized to the state of any light that sends an on/off/set level event.
This setup is extremely inflexible, since individual switches/lights cannot be controlled as individuals.
This setup results in a great deal of ping-ponging for states before all devices in the pool get to the correct state.
Setup triggers so that if any of the lights isturned on that it turns on the Virtual “master” switch.
This basically makes the Virtual “master” a slave to the On state of any of the real devices.
This ensures that the Virtual Switch is always switched to On, if any of the real devices it’s meant to control are switched to On.
You would not want to tether it to the slaves’ Off states though, since the objective is for it to be on if ANY of the slave devices are on.
Setup groups in Alexa that contain all the real switches/bulbs.
This would allow you to issue a “Alexa, turn off All Living Room Lights” command and have each real device receive the On/Off commands.
A Virtual Switch is not needed, since Alexa groups essentially function as Virtual Switches do.
Setup groups in Alexa that contain all real switches/bulbs AND the Virtual Switch.
This is beneficial if you have other Routines or watchers that monitor this switch for some reason or another.
Since all real devices are also part of the group, it will function the same as Option 3, whether the the Virtual Switch is on or off.
One thing I’ve noticed with dimmers is that Alexa groups cannot always dim properly. In those cases I’ve used a Virtual Dimmer as the master and the slaves are tethered to the master’s set level event state, but not vice versa.
Besides that issue, I think Alexa groups (Option 3 or Option 4) would be the best solution for you.
Well, there you go! I actually didn’t even know Alexa had groups like that. I just tested it out, and I think this might be a solution for me. Thank you!
Yep @anon36505037, that one gets a bit messy and requires a flag that differentiates the state change from a “normal” state change, but that’s the easy part. The PITA is making sure that all other watchers are aware of this flag and know to ignore those state changes.
Got my ST a couple weeks ago and this is the first thing I wanted to do. I really wanted something similar (using Google Home). I followed this thread and put lights into groups on Google Home. Problem was I eventually wanted some lights to appear in more than 1 group/room, so I came back to this thread.
I thought of creating a bunch of duplicate virtual switches that would mimic an actual switch, but that could get out of hand. Instead I did the following -
Create 2 virtual switches MasterOn/MasterOff. Along with a smart app to turn on/off a group of switches given one of these changing. After MasterOn turns on the smartapp turns it back off (vice versa for MasterOff). I could then add both of these to a different group in Google Home.
Fantasitc! Thanks defiante! This method worked perfectly, cleanly, and with little effort.
For those of you who might not completely understand at first…The virtual dimmer device handler that will work per definate’s solution can be found here. Before installing that device handler, just change the one line in the handler code to match what was provided.
Change line “sendEvent(name: “switch”, value: “off”)” in handler code to “sendEvent(name: “switch”, value: “off”, isStateChange: true, displayed: false)”
Install that modified code virtual dimmer and then use it as the virtual switch for all your light groupings. That’s it. Works like a charm.
Ok, please forgive my noobness, but how do I incorporate this? I’ve gotten to the point where I’ve successfully added the Virtual Dimmer virtual switch, and it shows up in my app now. Now how do I associate several physical switches with it? By “light groupings”, do you mean rooms? What if I want to control lights in more than one room.
Basically, here’s what I’m trying to accomplish: I’d like to use my Google Home and IFTTT to make smartthings turn off any downstairs lights that are on in a few rooms (kitchen, dining room, living room) when I say something like “Hey Google, Good night!”.
after the switch is added to smartthings, use automation “Smart Lightning” to turn on/off your desired lights when you turn on/off your “Virtual Dimmer”
i named my virtual dimmer switch as “Some Lights”. Had automation to turn on/off “Living Room Light” “Kitchen Light” “Hallway Light” etc when “Some Lights” is turned on/off.
Added the virtual switch “Some Lights” to Google Home. Try to discover again in Google Home once your automation is complete.
How do you use the virtual switches to set up groups? I’ve gotten up to the point of creating a virtual switch but don’t know where to go after that. I basically want to be able to turn of all downstairs lights even though my lights are currently designated to specific rooms.
@anon36505037 Great logic! Per my comments on the WebCore forums (and for the benefit of anyone else reading this), using the Global Variable was not effective for some reason (to be specific, the execute piston didn’t pick up the state of the global variable at the appropriate time). The logic/flow worked flawlessly with a 2nd virtual switch.
Also, the logic can be slightly simplified for the off sections:
Hold routine
BUT IF
All of XYZ switches is off
THEN
// Turn on ‘Hold’ switch
// Wait 3 seconds
Turn off ‘Master’ switch
// Wait 3 seconds
// Turn off ‘Hold’ switch
and execute routine
BUT IF
’Master’ switch changes to off
// AND
// ’Hold’ switch is off
THEN
execute routine ‘All Off’
It’s a minor item, but since all of the switches will already be off using the logic “ALL of the switches are off”, we can safely let the hold routine execute but save 6 seconds (for a more responsive experience). And the execute routine will also run when all switches are off but, again, because all switches are already off there won’t be any action taken by ST.
Now, if only we could hide the virtual hold switch… hmm.
Hello everyone! The google home app is great but one of the frustrating issues with it is the inability to create multiple lighting groups for the devices in the same room without moving those devices out of the room they are in and creating another room just to group them together. This is a headache for obvious reasons but the other issue is you then cant turn them all on or off together now.
I have created a way to fix this issue and it works flawlessly via the app and voice to control them On/Off, Dim level, and change the color. NO CODE REQUIRED. You don’t have to move them out of the room either so you can also control all of them together like you normally would.