Rule Machine Global Variables

I had faith!

I attempted to create a variable trigger ... doesn't seem to be working...


Any idea what I may be doing wrong?

Also, can we display variables in dashboard?

I believe there is an issue with triggers. Investigating.

No way to use variables on Dashboard at this time.

I had the periodic trigger wrong. (duh)
This is working...

Now I need to figure out how to use the variable to track when temp is rising or falling. :thinking:

Haha, and I was referring to something else entirely...

@bravenel would something like {Random ( "good morning have a great day" ,"wakey wakey, rise and shine" ,"top of the morning to you")} work when setting up a global variable string in RM?

I use it for a greeting. I have triggers setup to change {Greeting} to either "Good Morning", "Good Afternoon" or "Good Evening." The rule below responds with the correct greeting and the associated random nonsense afterwards. The {PlaceHolder} is just a work around until the next update which should include some GV fixes.


Bruce, any chance of getting the GV status onto the dashboard?

Not a biggie.

Edit: i see that it cant be used on dashboard (above, in this very thread),.

But, @bravenel, I guess there is an issue with triggers and global variables, because one of my rules didnt trigger tonight. Is that correct - that it doesnt work. The rule is pretty simple, if GV turns true, then turn on two lights. This didnt occur, yet the GV turned true.

Edit2: here is the error.

groovy.lang.MissingPropertyException: No such property: id for class: java.lang.String (allHandler)

Using a variable as a trigger is a known problem that's on the fix list.

@bravenel Sorry to keep bugging you on this, but issues.

I've changed a significant number of rules over to use GV with triggers. FYI, I also tried triggered rules, and it's broken too. It's a serious time commitment now, given we have to create a new rule (cant simply change the trigger type any longer).

I was hoping for a release today, (Thursday here in Australia), but no. Any chance of a fix? I dont want to change all my rules back, then have to fix them when it does get fixed.

I do realise that GV are beta, and understand.

Our next release is coming soon. There are a lot of moving parts in these updates, and they can't really be rushed.


Hello, in future releases will there be functionality added to allow for expressions to set the global variable values along with ability to use expressions in comparisons to drive specific actions. An example I'm currently looking at...quick departure and return lets say to grocery store to grab something:
When leaving the house you capture the current state of multiple switches along with the date, time, and of the capture. Your usual departure actions then trigger to lock down the house and setup your normal configuration for the time of day and mode. You return 45 minutes later and would like the house to return to the state it was when you left.
With global variable and a few compares could be done to make this happen. Maybe your threshold is if you exit and return in less than an hour and the mode hasn't changed return house to state it was on departure using captured states. If greater than an hour or mode changed follow normal arrival flow for the time of day and mode.
I live alone so don't need to take too many variables into consideration accounting for other people.
Just started looking into the capturing functionality and the ability to make something along these lines happen. hit the breaks when not being able to figure out how to set and then compare the variables.
I'm very new to Hubitat and maybe this is something another App should be used for. I'm trying to stick with the built in apps and haven't found anything I can use to make this happen yet. I'm sure someone is probably doing this already somehow but wanted to ask about expressions and comparisons of global variables. As others have stated Global Variables are still in beta so just seeing if this may be in consideration for future functionality. Thank You!

1 Like

Messed around with this long enough and figure out how to make this happen Groups & Scenes, a virtual switch, and several rules. Would like to leave the question about expressions and evaluation of variables open. Thank You.

I would like to do something similar but with speakers, so how did you manage it?

Adding expressions of global variables is not planned for now.

How do you create a Global Variable? I've looked in Rule Machine, but I don't see the option. I'm running Hubitat version on my hub and there aren't any updates available. Are GV's available in the software version that is running on my hub? Thanks.

Bruce, I take it the gv fix didn't make it on 2.0.6?

If you mean triggers, that was fixed.

1 Like

I spoke a little too soon on this. It works on the room I tested with but have two issue that i haven't been able to resolve will set the devices back to the state they were when departing but have the to problems listed below.

  • Hue lights turned on or off with The Hue Dimmer Remote are not registering changes in Hubitat. If turned on with the remote the status in Hubitat remains as off. No actions initiated with the remote are registering.
  • When the scene is activated the log is showing contuse and repetitive activity from the affected devices and am only able to stop it by rebooting the hub.

This is what i've done:

  1. Created a virtual switch with three rules.
    • Trigger turns the switch on when Presence is changed to "not present"
    • Trigger turns switch off 60 minutes after it is turned on
    • Trigger turns switch off on mode change
  2. Created a Scene with devices to control / capture when departing
    • Scene name is "Capture at Time of Departure"
    • Selected color and color temperature bulbs, dimmers, and switches
    • Click to set: "Select button to push upon scene activation"
      • This is initially left with no selection. After creating the scene went back in and updated this option selecting the button named the same as the scene "Capture at Time of Departure". Button number then set to "1".
    • Set scene transition time to 5 seconds
    • "Ignore activate switch off?" is left Off
    • "Create capture device" is turned On
  3. Action created to push the capture button that is created by the scene: device name defaulted to "Capture at Time of Departure Capture". Device type shows as "Scene Activator" and the DNI is shown as "Capture_298". I left these exactly as they defaulted when created.
  4. Two Triggers run when departing.
    • The first runs with its action running item #3 above.
    • The second runs with a 15 second delay running my normal departure actions based on mode and time of day. 15 second delay is to give the actions in the first trigger time to complete.
  5. Trigger Rule created for Presence change to "present"
    • If the virtual switch in item #1 is "On" the button created in item #2 "Capture at Time of Departure" is pushed to activate the scene.
    • If the virtual switch in item #1 is "Off" the normal arrival process is followed for the mode and time of day.

I haven't found anything on why the hue dimmer changes are not registering in Hubitat. I hand't notice this issue until working on trying to make this process work. Regardless of making this rule happen I need to figure that one out.

Also have no idea what is causing the looping action, or what looks to be a looping problem, and haven't been able to find anything in the log to start narrowing the problem down. I've taken it down to a single device to capture and test with and only see the continual log update with the action that occurs with the selected device. IE. "Living Room Cans was turned off". Not sure if this is happening due to options I have setup wrong in one of the Rules / Triggers / Actions or if something needs to be turned off in the process and I'm missing it. The devices return back to the state they were in when departing and capturing, so seems like the process is close to working but am missing something to stop the looping / repetition.

I'm still very new to Hubitat so wouldn't doubt i'm missing something how Rules Machine and Scenes work. Hope this helps you and if you have any ideas or are able to get this working I'd appreciate any advice.

Thank You!

Was able to get the Hue Dimmers working with updating Hubitat correctly. Turned down logging on everything but a single light used in the capture process to so the log would have very little information other than records pertaining to the departure / capture / arrival processing. Found the button to activate the scene the captured device states are saved in his repeatedly pushed by the Trigger Rule for some reason. Not sure why this is happening yet but the culprit of the problem seem to reside in how the Trigger Rule when arriving back home is processing or it is in the action the Trigger Rule is running.

Download the Hubitat app