Stateless Virtual Switch

Is there a way to have a stateless switch? I have a Virtual Switch that turns on/off a group of switches. If one of the group is turned on or off, I might want to repeat turning the Virtual switch on or off. If the Virtual Switch is already in a specific state, it won't implement a change to that state again.

It wouldn't be that hard to do... My switch timer with reset does that, for instance (if I'm remembering correctly, lol). If not it would only take a minute or two to create.

The "Switch Timer with Reset" device doesn't work in my situation. I'll give a specific example of what I'd like to do:

A room is set up with six switches, all set up in one group.
A Virtual Switch is set up to control that group.
The Virtual Switch is turned on and all the devices turn on.
Someone turns off 2 of the physical switches.

Since the Virtual Switch is still in the On state, turning it on again (to turn on the 2 devices that are off) won't work.

I want to keep the Virtual Switch stateless (not On or Off), if possible.

I know I can use two Virtual Switches - one for on and one for off - but I would prefer the single virtual switch that does both.

Maybe a virtual button would do the trick. In RM machine make a rule that is triggered when button 1 of the virtual button is pushed that pushes button 2 of that switch. Then no matter how often that virtual button is pushed it will register as button 1 pushed.

Use the Hubitat Groups app. It will send on commands to all devices in a group even if some are off and others on.

That's probably the easiest way to do it.

I found this Device Driver that does the trick:

That is exactly what I mentioned above - a switch that just always sends the event regardless if it is already on/off. Since there are no Tiles in HE, it WILL show ON/OFF. It doesn't work the same as in ST.

But whatever. Convert it over to HE and use it, if that's what ya need. :+1:

Or just use a virtual button instead, which by definition is stateless.

A switch can't be turned on from a dashboard if it's already on only off. That is definitely one advantage to a momentary button.

1 Like

It could be that I'm not understanding how the virtual button or RM would help with a virtual switch. I tried both and they did not accomplish what I wanted to do.

I ultimately want to control the virtual switch (or button) via Alexa - ie; turn on or off. If using a virtual switch that was already turned on it cannot be turned on again without being turned off first (even through RM). With a button, I cannot specify on or off. The Stateless Device Driver code I posted above DID work for what I wanted to accomplish. However, there is a much simpler solution that also works. Placing my Devices into a Group and controlling that Group worked as well. If the Group is in the On state, turning it On again executed. (Same with Off).

I had the same problem with a Virtual Switch to turn on/off lights on an external Lutron Homeworks Illumination system (through Telnet). If the Lutron system turned the light off or on, the virtual switch could not turn it back on or off without manually turning it off or on first. I modified one of the Virtual Switch drivers to send an Off command before each On command, and send an On command before each Off command. This way the virtual switch executes the on or off command each time it is actuated.