Issue with using virtual switches for macros

i have one virtual switch called Downstairs. Created a group with 3 lights. Created rule that does the following

when Downstairs switched on, then turn on the group
When Downstairs switched off, then turn off the group.

It works well when I use the Downstairs switch manually via device list plus via google home voice. I can batch turn on/off the 3 lights.

Problem is this. I turn on the Downstairs switch, all 3 lights turn on. Now the state of Downstairs switch is in on position. So if i manually turn off 2 lights. And then ask google home to "turn on Downstairs", then nothing happens. I know it is because the Downstairs switch is already in On position. So it doesn't do anything. How do i work around this?

I want to be able to invoke Downstairs on or off position everytime. If there was a neutral position, that'll fix it. I can make the switch go back to neutral after on or off, then i can invoke ON everytime.

This is more of a Google issue than a Hubitat issue. If you configured this group into Room Lighting and used an Activator Device, it would be possible to send multiple On commands to get the group back to the desired state. You would just need the options "Activate if already partially activated" and "Turn off even if partially off". With these settings, from Hubitat, you could turn on and off the Activator Device and it will always send either an On or Off command regardless of which lights are on/off.

As for Google, that is going to be a trickier problem to solve. This came up in Fire an action when switch is turned on or off while already on or off - #7 by bertabcd1234 and seems to work for Alexa. You might want to try the virtual driver in this thread to see if it works for your virtual Downstairs switch.

You might look at the inbuilt Groups and Scenes app and it might solve your use case:
https://docs2.hubitat.com/apps/groups-and-scenes

I haven’t personally used this feature as my use of this app is simple, you should enable the “ Use group device to indicate if any members are off” option based in the docs this will turn the switch off if any of the group devices are off.

1 Like

thanks for the suggestions I'll try them out.

A really simple solution would be a virtual switch that has a "neutral" state. Right now only has On and Off.

eg, i use virtual switch to turn ON. it turns on all 3 lights. 2 seconds after that, the virtual switch enters "neutral" state.

So i can manually or by google voice turn off 2 lights. And can use the virtual switch again (since its in neutral state) to batch on or off the group. Simple solution.

Except it’s not a simple solution. The voice assistants treat switches as on/off. A neutral state would be a button in their world. So, while there are solutions in Hubitat that would work, it is much harder to go with something like Google Home.

What you could do is use a virtual dimmer with some rules. Every time a light turns off, the dimmer drops 33%. From there, to turn on everything, you just need to set the dimmer to 100%.

but that would still be problem for google home yea?

I would definitely try some of the other suggestions first before going the dimmer route. A dimmer would work because its brightness level would track how many bulbs are on. 100% = 3 bulbs, 66% = 2, 33% = 1, 0% = none. With the right rules, Hubitat could automatically update the virtual dimmer as bulbs turn on and off. Google could be used to set dimmer to 100 or 0 in order to get back to the base states of all on or off.

Use the Activator in Room Lighting. The Group indicator has 2 options: On when 'All Are On' or on when 'Any Are On'. Your use case should use the 'Any' setting.

2 Likes

I'm in a similar boat as the OP, and this is a Hubitat "issue" limitation, not Alexa or Google. For context, I'm brand new to Hubitat (just got everything moved over today), coming from HomeSeer. HomeSeer event triggers have multiple selections, but one that I used a lot and would be helpful here is:

  • This Device Had Its Value Set To....

So, if your Event's (aka, Rule in Hubitat) trigger was This Device Had Its Value Set To: On, it wouldn't matter what the switch's original status was, if you set it to On, the Event would trigger. There is a separate trigger in HomeSeer, This Device Changes and Becomes..., which more closely resembles Hubitat's current trigger in that it only triggers if the new value is different from the old value.