Variables and tiles


#1

How can I display a global variable on a tile and create a tile to update global variable from a tile.

The set tile only need constants they do not need to accept input.

I have a global variable that is the duration of time to run sprinklers. currently if i want to manually water I need to first check/update the duration variable in rule machine. then hit a dashboard button. I'd like to display the current value of duration and have a few preset buttons that set the duration to say 3, 5 or 10.


#2

The short answer is that you can't do that with native things from Hubitat.

The only thing that can be displayed in a tile is something tied to a device. I have it set to display custom attributes for some custom virtual devices I've created. But getting a value from a variable into a virtual device isn't all that easy. The easiest thing to do would be to create a virtual dimmer and use that value to update your global variable hen it changes and then use that in a dashboard. That would give you values from 0-100.


#3

Well, I settled on a bunch of rules to setup switches to 'inch' and set the variable to the correct state.
if one turns on turn the others off and set variable. if all are off set variable to 0

just has to wrap my head around it. I had done this before for the sprinklers as only one sprinkler area can be on at a time due to water pressure. and inching on the sonoff i could not get to report back to hubitat when it was done on the hardware.


#4

Wait...what? I don't understand how getting your Sonoff to report to hubitat will help get a value onto a tile.


#5

controlling the sprinklers i could only allow one to be on at a time. sonoff has an inching feature that does not allow but one relay to be on at a time. with it enabled hubitat didn't get updates

just used same pattern for setting the timer variable.


#6

Your question wasn't about setting the variable it was about displaying that variable on a tile.

So, are you trying to set it from a tile or not?!?


#7

first sentence

How can I display a global variable on a tile and create a tile to update global variable from a tile.

so i created switches that trigger rules to set global variable. whichever switch is on is the value. dashboard requirement is met. then rules to turn off the other switches when one turns on. simulating inching.

heres the working dashboard


split this topic #8

2 posts were split to a new topic: Global Variables


#9

thank you frits.

I was feeling a little attacked. I know 99% of the community is not this way. unfortunately there still are the 1% :grinning: I'm not the most effective communicating via text and do get misunderstood. I appreciate your stepping in and commenting.


#10

I don't thinks this is unique to one person. Even when in the same room as my wife I have this problem. Though maybe that is because she doesn't talk "nerd" :smile:

But to get back on topic. Do I understand it right like this:

  • You have a set of rules together playing like an inching device would.

  • You have a global variable which hold the current state of that "inching" device.

  • You have a tile displaying the current state.

  • You want another tile to force an update of the value displayed on the other tile?
    If this is your question, the answer would be that the tile displaying the current state should update on it's own, as far as I know.


#11

My first thoughts were to have a tile display the current value and buttons to change it. after figuring out I could not display a global var on a tile easily, I decided on the inching approach. and having the switch state be the indicator of the value. so I have 4 switches that have corresponding rules to update the GV to 3,5,10,15. then I used an inching pattern I used before on the sonoff to only allow one relay at a time.

and I even got a bonus feature, if all 4 switches are off the sprinklers will not start at all or make completely manual depending on the logic i apply to the sprinkler rules. I have not decided which way I'm going to go on that. I'm leaning toward disabled as not to accidentally bump a button and weate water and drowned my lawn.

Thank you again for jumping into the conversation. you restored my faith in the community!!


#12

I thought your work around was obvious. Lol


#13

Don't get discouraged. 99.9% on here are extremely helpful but there is the odd one that can start an argument in an empty room!


#14

Ok, so you actually solved your own "problem" / "challange" :slight_smile: Those are the best!

You like to through gasoline on a fire don't you... :wink::joy:


#15

agreed the community is very friendly and helpful. life's too short to be an angry person. I try to just let negative comments go, I have no idea where a person's head is, why they are rude and have compassion for their unhappy life..