Connect Global Variables to Dashboards

Is there a way to allow rules or enumerations for the String (or number) editor with this Variable functionality @bravenel ?

My use case is the need to define a Dashboard control that allows the user to select from a custom set of modes. In this case, its the operating mode for a pool heater and the enumerations are dynamic based on the configuration fo a given installation.

I have these defined in an Attribute on the device and have code to limit what options are available, but there does not seem to be a way to allow the user to change this attribute directly from a Dashboard - those displays are all read only.

Absolutely Awesome!!! I am finally able to (in essence) create a password protected tile to disarm my alarm. It works great. I did not like the HSM tile that is built into Hubitat. Pressing it opened up a busy menu that was very hard to close because the [x] is so small. Now I have a simple tile where you enter the code and the alarm disarms. Awesome.

As you can see, 15 seconds after entering the alarm code the tile changes back to read: "Enter # - "
I did it in two rules cause I am no expert in RM and sometimes the logic is hard for me to work out. If anyone knows how to do this in one rule that would be great. Awesome, thank-you for this feature!!!
I just changed my first rule to deal with incorrect code entries, was worried that it would start an infinite loop but my logs look like everything is o.k.

All you need to do in your main rule is add cancel delayed actions to the 1st line under the IF then
Then before the else add the disarm to 'enter # with the delay but click the slider labelled cancel. Is the press to disarm doing anything else or is it linking the rules?

Dude, that is awesome.

What did you do to get the "Temp & Battery" multi-lines tile? :thinking:

I used a user created app called: "Supertile", the user that created it is called Cobra. He has removed access to his github repository, don't know if he will be bringing it back or where you could now find it. I think some other app developers were not respecting his work and possibly stealing his code.

I would try: TileMaster another user created app that I imagine could do the same thing.

I have a connector that will not stay synchronized. What do you need me to turn on in logging to show? I can toggle and sync from the device screen, but if I set using rules, all bets are off.

Can you show the whole edit device page?

The driver you are using is the VIrtual contact sensor. Not the Global Variable Connector. Did you change it? This is not what would have been set up when you created the connector.

image

Nope, that is what it came as when it was initialized, can't even change it.

1 Like

I just tried and it seems to be working. You know that the page won't update dynamically, right? You have to go out of the rule machine window and back in to pick up changes to the variable.

Yup, I know that, or refresh. If I toggle from the device screen it is fine, if I toggle from a rule, it doesn't always toggle. And that is in both directions.

If you toggle from a rule, the variable doesn't change within rule machine? Then you haven't actually changed the variable and I wouldn't expect the connector to change.

Or did you mean that when you toggle from a rule, the reverse is not true.....that Rule Machine DOES update but the connector does NOT? Because saying the same doesn't happen when you toggle from within rule machine would mean that the RM variable isn't updated either.

No, if I toggle the variable, it changes, but the connector doesn't.

How would I add two or more values together to get a total result in my dashboard.

For example, I have three IoTaWatts (Home Energy Monitoring) devices connected to my circuit breaker box and each shows certain values (Power, Amps, Volts, etc.) for sensors connected to my 40 circuits. If I wanted to display Watt totals of all light fixture circuits or all large appliances, how can I add up the totals of those circuits to display them on my dashboard.

I can do this on each IoTaWatt with ease, but I needed 3 IoTaWatts to cover all circuits and they don't allow adding between each device. They are all connected to my Hubitat and i wanted to do the calculations there..

You can use Rule Machine for that.

  • In Rule Machine create a global variable called "totalWatts" (or different as you like) and create a connector device that you can be shown on the dashboard

  • Create a new rule in Rule Machine and add a local variable "temp"

  • The rule trigger should be: IoTaWatt Device 1 changed, IoTaWatt Device 2 changed, IoTaWatt Device 3 changed

  • The rule actions should be:

Set variable totalWatts to power value of device "IoTaWatt Device 1"
Set variable temp to power value of device "IoTaWatt Device 2"
Set variable totalWatts to math of totalWatts + temp
Set variable temp to power value of device "IoTaWatt Device 3"
Set variable totalWatts to math of totalWatts + temp

1 Like

@dan.t You are a genius!! Thank you so much, worked perfectly!!

1 Like

Question, what is the difference with doing it that way to having say 3 local variables and setting there value to the device 1st. Then doing maths, adding them up at the end then sticking that in the GV?

Purely a efficiency question, as I'm not a developer the above is how I would have "just done it" thinking that would be the right way.

There really is no measurable difference from a performance view. Minds think differently and math/programming allows us to solve problems in different ways. It is all a matter of personal preference. I wouldn’t overthink it.

EDIT: There is on difference when it comes to the events for the virtual device, in my case, you will see a value in the event history for the interim steps while in your case you only see values for the final result. That might matter to you in case you use the values otherwise, e.g. triggering other rules based on the value

1 Like