How to control multiple lights with one tile

@dbaq welcome to the community. Well, I happen to have the exactly the same setup. :v:
See below for a quick galance that I use a True/False variable to aggregate my office lights’ status, and I can toggle this tile to turn both lights ON or OFF.

Here are the steps of my setup:

  1. Create a True/False variable in the Resource - Variables page. Mine is called $isOfficeLightOn. (You can use a Simulated Switch in SmartThings if you prefer.)

  2. Create a “Toggle Office Light” Rule. (This rule does NOT have any trigger, and will only be executed when I tap the Variable Tile from my first screenshot above.) This rule will toggle both my office lights and update the variable state accordingly.

  3. Create another rule to aggregate the lights’ status to the isOfficeLightOn variable. This rule will be trigger when either of the light is turned ON or OFF, and note that I have the IF Condition in the Rule Flow set to ANY (OR), not ALL (AND). So the variable isOfficeLightOn will be set to true if any of the light is turned on, and only set to false when both lights are off.

  4. Add this isOfficeLightOn variable to the dashboard as a Variable Tile, and configure its dimension, style, icon as desired. The key step here is to make sure the Action(tap) field is set to “Open Hyperlink”, and use the $.runRule("rule_id") syntax with the Rule ID from the rule created in step 2 in the Hyperlink field. So when this rule is tapped, it will execute the rule.

    Note: make sure the rule_id is wrapped within the double quotes, and the rule_id can be found from the URL in the rule editor page when editing the rule.

Feel free to let me know if any questions.

1 Like