Control boolean hub variable from a dashboard

I am trying to create a switch on a dashboard to toggle a "vacation mode" hub variable. The idea is that if vacation mode is true, a rule machine routine would or wouldn't run. I created a boolean hub variable with a switch connector. I added a switch to a dashboard to toggle the variable to true or false. Unfortunately, the switch on the dashboard seems to set the variable to "on" or "off" instead of true/false. Rule Engine is looking for the condition to be true or false and so the condition is never met. Anyway, I am getting really frustrated and I can't figure it out. Any help would be appreciated. Thank you.

1 Like

Change the RM condition to one that watches for the connector switch itself to be On or Off, instead of referencing the Hub Variable it is linked to.

1 Like

Add a tile to the Dashboard of type "Variable" rather than "Device":

Note that you will have to authorize the variable for use in the Dashboard via the Hubitat Dashboard child app for this Dashboard (separate from the Dashboard itself), the same way you have to do for devices.

This will show a tile with a dropdown you can chose values for the variable with, "true" or "false" since this is a Boolean and those are the valid values for one. If you want it to look like a switch, you'll have to use a connector (or create another automation that does the same, but why...). However, I would not suggest a connector unless you have a need, and just to change the value, you don't.

You might also have a problem with your rule, but without knowing how that is set up, it's hard to say more. Hopefully this helps!

3 Likes

Reading the OP, I had theorized that @user853 was more concerned by the mismatch of nomenclature (e.g. "on/off" vs "true/false"), but I would hasten to reassure that Rule Machine responds appropriately in all cases. That is to say, both of these Triggers work as expected in RM, even though one Hub Variable has a (Switch type) connector device, while the other one does not:


This rule fires whenever _TestBool transitions from on to off OR Enable_HENotices transitions from true to false:

Regardless, @bertabcd1234 is giving you the best advice with his reply above.

1 Like

I think this is where I was going wrong - Tile Type Variable. It's not the prettiest thing on the dashboard but it does seem to work. I appreciate everyone's response. It's nice to know that the Hubitat community is so helpful.

1 Like

FWIW I have a “vacation” virtual switch. Of course this very much predates hub variables, I’ve been a HE customer for 5 years and variables are somewhat new, but I went down this path because stock apps like Simple Automation Rules, Basic Rule, etc have restrictions to not process the rule based on a value of a switch. Then in Rule Machine you can also set the condition.

I’ve also automated the setting of my Vacation switch being on or off based on a calendar entry in my Google Calendar so I don’t have to remember to turn it on or off (I maintain a community app for Google integration). Benefits for this include house cooling down as we are traveling back from vacation without me having to do anything.

1 Like