Triggering Rule With Mode Change OR Virtual Switch?

I am new to Hubitat - currently migrating everything over from Vera Plus. I'm at the stage of re-building my scenes in Hubitat, and am setting up the scene I use to shutdown my house when I leave for an extended period (to go to my other home). I'm using the "AWAY" mode for this and have setup a trigger for this rule using the System Mode Change, but I ALSO want to be able to run the rule using a voice command with Google, which therefore requires a virtual switch. Here's my question/concern...

If I setup this rule with both triggers - one is the mode change if I were to simply do it through a dashboard, and the other is a virtual switch which triggers a mode change - will that end up running the rule twice when I use a voice command (i.e. virtual switch). In other words, if I say "Hey Google, shut down the house" which triggers the virtual switch, which in turn changes my mode to Away, will the action on the virtual switch run the rule once, and then the mode change resulting from the virtual switch run the rule a second time? Hopefully I'm making sense. While the rule running twice wouldn't necessarily do anything bad (it's just shutting a bunch of things off), it doesn't seem terribly efficient.

Is there a best practice for doing what I'm describing that doesn't result in the rule being triggered twice (first trigger virtual switch, second trigger is mode change to "AWAY")?

Appreciate the guidance - will follow your "recommended" first approach with the booleans. Thank you!

If the virtual switch causes a mode change and the mode change triggers the rule, why not just leave the rule triggered with only the mode change and not the virtual switch? That's another way to avoid this issue.

1 Like

Appreciate all the information. So, regarding your second-to-last post - why not just let the Mode Change trigger the rule, and the virtual switch trigger the mode change...excellent point!!!

I had stuck in my head that I needed a virtual switch to be able to use Google Voice (which I do), but that I also needed to be able to select a mode from a dashboard using the Mode tile. But now that I'm thinking about it (thanks to you), I can simply only use the virtual switch on the dashboard to change mode, rather than a mode tile...duh! I'll get the hang of this - I've been a Vera user for 14 years, it'll take a while to adjust :slight_smile:

Now, if I could just get my stupid virtual switches to show up in Google Assistant. I've set them up all up as recommended (virtual switches, not buttons, with auto-off after 500ms), but everytime I select the switches when re-linking, they still won't show up in Google. I'll keep plugging away on that one, but would appreciate knowing if there are any tricks I may have missed there.

Thanks again.

1 Like

Fellow former Vera user here as well.

I haven't run into this with virtual switches yet, but with other devices (RGBW bulbs and thermostats) I've found that Google Home will reject devices that don't have all the attributes it expects for the device type. So if you compare a switch that is syncing to one that isn't are there any attributes missing from the latter?

For example with my RGBW bulbs, I had to run them through various commands (set white temp, set color RGB, on, off, etc) so that all the device attributes would show up.

It looks like the only required attribute for a switch is "Switch" on or off, and I think that appears as soon as you make a virtual switch, so I doubt that is the issue here.

The only other idea I have is that I once had issues with Vera/Google Home integration due to special characters in the device name. If you have any, it might be worth trying a simple alphanumeric device name to see if that fixes it.

1 Like

I found my problem - I originally set them up as Virtual Buttons. When I read that virtual buttons were not supported by Google, I changed them to Virtual Switches, just by flipping the pull-down selector, but I don't think that quite cuts it with Google - there must be some residual somewhere in the object that makes Google not like it. So, I just deleted them, re-defined them from the start as virtual switches, and they're coming over now.

Thank you.

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.