Combine Rules question

I created 5 text variables to show specific light levels. These are placed on a dashboard. I have 5 rules using $runRule hyperlink that sets light level when dashboard tile is pushed.

(Sorry, it displays better on tablets)

What I’m wondering is if there is a way to combine the 5 rules into one rule? I tried using context variables but probably wasn’t using the correct option.

My 5 rules all look like this with various set levels

Yes, you could do it with Context Variables. Since you’re already using the $.runRule() hyperlink syntax, you could update that to pass a variable to your rule:

This is where I got stuck. I won’t be able to use rule ID because they would all have the same ID so would I replace “button 1” with my variable name {“$lightOne10”}?

I would effectively treat the variables as ‘labels’. Then have a single rule setup that does your setLevel command and customize the Hyperlink Action on each of the 10, 25, 50, 75, 100 tiles to point to the same rule, but with a parameter that matches their value:

For the 10 tile:

$.runRule("RULEID", {"level": 10})

For the 25 tile:

$.runRule("RULEID", {"level": 25})

…and so on. Then your rule would look something like the following:

1 Like