Hi Everyone
I have a Hub Variable called DysonOnTime which is type DateTime. I've created a Connector for it.
Now I want a Rule Machine rule that says "If DysonOnTime is in the future, then do something".
I thought I'd be able to do something like If DysonOnTime is greater than current time, but I can't find a way to do this. Put simply, how do I compare a Time Variable to Now?
Any advice would be appreciated.
Cheers,
Will
Why did you create a connector? Do you need it for something else? If it's just for Rule Machine, you don't need it; you can -- and should -- use the variable directly (see the documentation for more).
I'd create a second variable -- a local variable would suffice for this -- that you set to the current time right before the comparison, them compare the two as needed in a condition that you might start writing something like this:
(Finish this by using your other variable as the other half of the comparison, and use "NOT" somewhere, either the option you'll see at the bottom of this page after you're almost done, or separately in your expression, if you're really looking for the opposite, as it sounds like you are.)
This is assuming you're looking to test this in a condition somewhere in the rule. If something else, you'll probably need to share more about exactly what that is. Good luck!
Ahhh, the lightbulb moment the second I read your reply. I hadn't considered using a Local Variable and then using an Action to set it to current time. Thanks so much.
PS, I created a Connector so that I could add it to my Dashboard. Then on the Dashboard, I can enter a time to update the Hub Variable.
You can put hub variables on a dashboard you don't need a connector.
In case that needs some explanation, since not all people realize, to add a hub variable to a dashboard you must open the Hubitat Dashboards App, and open the child app for the dashboard to get the option to add variables.
Just thought I would add that because it is not obvious where to do that, as it is not in the dashboard setup page like when adding devices.
3 Likes
Wow, the things I'm learning today. I didn't know about adding Variables to the Dashboard. It works so well. Thanks guys
1 Like
I could get hub variables on the dash board but when I wanted to change the tile colors based on a variable value I needed the connector. Is there an alternate way to change tile colors without the connector?
1 Like