Connect Global Variables to Dashboards

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

How to set the temperature on multiple Thermostat at the same time

I want to share with you a usage of Global Variables and 4 Thermostat
Stelpro Ki STZB402+ with a Global Variable and a Dashboard
Drivers code 10 aug 2019 GitHub - Philippe-Charette/Hubitat-Stelpro-Ki-ZigBee-Thermostat
Hubitat Version 2.1.8.117

In my case i have 4 Thermostat in a close house for the winter, yes it's -14c inside.
I've created 2 GV because often, i need to change the temp on only 3 of them

Apps
Rule Machine
Create a global variable (GV)
name : 4Thermostat-setHeatingSetpointGv
Number value:20
Create New Connector
select the GV 4Thermostat-setHeatingSetpointGv
type = Variable NO DO NOT take temperature
Done
Done

Apps
Rules Machine
Create New Rule
Name : Thermostat_4_SetHeating

Trigger, Variable, 4Thermostat-setHeatingSetpointGv
changed
Done
Done

This part is for my Stelpro as i need to use a Custom Action to set Heating point. Maybe you can do it differently
Select Action to run
Set mode or Variables, Run Custom Action
Run Custom Action
Thermostat
Choose all my 4 thermostat
Select custom command : SetHeatingSetpoint
Parameter type : number
integer value : %4Thermostat-setHeatingSetpointGv%
Done with this action
Done with Actions
Logging, check the box you want
Done

Apps
Select the Dashboard you want to add the GV (Thermostat for me)
add the device 4Thermostat-setHeatingSetpointGv
done

Dashboards
Go in the Dashboard you added the device just above
+
Pick a device : 4Thermostat-setHeatingSetpointGv
Template : Variable Number
Add Tile

change the number in the 4Thermostat-setHeatingSetpointGv and hit save
et voilà!!!

image

connector created
image

image

image

image

I am unable to display value of the string variable "timeOfUse" (shows unknown or sending as above). I expect tile to show string value of the variable, which is set in rule app depending on the time

Hi Srephan, can you please tell where this cool tile comes from?
image
I have to use a tile per thermometer and would be good to combine all in one tile as on your dashboard to save space...

It was (is) called SuperTiles and was a user app developed by a user named @Cobra. I don't know if the app is available anymore. I believe some other users on this site where using his code for other things without permission or credit and this resulted (justifiable so) in him no longer making his custom apps available.

1 Like

My apps/drivers will all soon be available again on my new website

It is currently open for registration only
As soon as we open (soon) an email will be sent to all members and their accounts will be activated.

http://cobra-apps.co.uk

Andy

2 Likes

registration sent