Can an App set a RM Global Variable?

I really hate using virtual switches for things. Just my preference. I have several rules that I don't want to trigger on holidays - like the ones that wake me up in the morning. I know I could do this with a virtual switch but I feel like an isHoliday variable is a better route. Is there a way to set a global variable from app? Like using the RM API? Or am I just being stupid? @bravenel

1 Like

Yes, you can. If you use a Global Variable connector, the connector device is exposed to all other apps. You can change it the way you would any other attribute. In fact, if you use the boolean connector, it is exposed as a switch that can be turned on and off like a virtual switch. So, you get the best of both worlds.

here is another option. create a mode: holyday, then creat a rule to pause rule X,Y, if mode is holyday.

You would then have to add the mode HolyDay to all of your other automations that run off of mode. Adding a new mode is not an easy task if your system does anything by mode already.

Well, I wouldn't mind the work... but you're maybe right. It depends on how you use modes and stuff. In my case it's not that of an impact since holyday would just be just a stricter version of away

Why would it be a stricter version of away? You'd be home?

okay, got it. In my country we use the word holyday for vacation. And say we have free time, when we don't have to go to work... there's the confusion. sorry, my bad.

Ah...European? The OP was talking about what you would call bank holidays. :slight_smile:

yep.... the land of money, cheese and expensive watches.

Hmm a mode could work. The challenge is mode manager might mess it up because I already have it switching based on time of day and my alarm system being set as away.

About your answer to then question. You mentioned:
"Yes, you can. If you use a Global Variable connector, the connector device is exposed to all other apps"

My questions is How?
I am new in hubitat trying to code ...

I created the variable. I used the global variable connector in Rule Machine..

I know that I can for example reference a switch in my code like:

input "switches", "capability.switch", title: "Control these switches", multiple: true, required: false, submitOnChange: true

But what i need to write for the RM Connector Variable?

1 Like

I need to know this too :smiley: Should I choose the "child device" connectors in Preferences for the app or find them by code in the app? I am guessing it's probably more reliable to go via preferences.

You need to use a device selector in preferences to choose the device.

1 Like

Has something changed since this thread was started? I understood a boolean global variable would have capability.switch, but in fact it's not listed along with switches (for choosing in preferences), only with capability.sensor devices, like my string variable.

No, nothing has changed. When you create a Connector for a Boolean variable, switch is one of the choices. Without a Connector, no switch.

1 Like

Ah right I see, I should have picked "switch" at that stage. I picked "variable" when I created the connector so that must be why.