How to control multiple lights with one tile

Hi there,

I need some help figuring out something that I thought would be pretty straightforward. I am a smartthings user and I am trying to do the following:

  • (condition 1) one master switch (i.e. “Office Lights”) that would turn ON or OFF my 2 individual office lights
  • (condition 2) If any of the 2 office lights are turned ON via another tile or automation, the master switch should now be ON
  • (condition 3) If the 2 office lights are turned OFF, the master switch should be OFF

What I have tried so far:

  • I installed and used trendsetter but the master switch won’t be set to ON unless all lights in that group are ON. That’s breaking my 2nd condition.
  • I installed a virtual switch and set up the Smart Lighting SmartApp to “mirror behavior” but only condition 1 is met. If I turn on the 2 lights individually, the master switch remains off.
  • I also tried to add a bunch of automation within the smartthings app but I ended up with an infinite loop :man_facepalming:

My assumption is that I am clearly missing something, I can’t be the only one trying to have a “main dashboard” with a bunch of master switches to quickly turn on/off and view the lighting status of a room at a quick glance.

Any help is more than appreciated! Thank you.

@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

hey @James, thanks for the detailed explanation. The fact that the “Toggle Office lights” Rule has no trigger is what I was missing and why I ended with some infinite loop on smartthings (duh!)

I was able to make it work in SharpTools with a variable but not a virtual switch. Unless I am missing something, I can’t setup $.runRule(“ruleId”) from a virtual switch tile:

I don’t really need to use a virtual switch over a variable but I would like to have the glow effect to keep the style consistent across my dashboards. And as far as I can see, it is only available with switches/lights. There is no Enable Glow option for a variable tile, correct?

Do you have a workaround for that?

Thanks again for the assist!

You could use Custom CSS in a Theme to add a glow effect.

Note that any custom CSS snippets provided are not officially supported and may need to be adjusted with potential future changes to the SharpTools web app. :slight_smile:

All Active True/False Variables

For example, the following snippet would make the icon of any True/False variable tile glow when it is ‘active’ (eg. True)

.tile.variable-boolean.active .icon {
    -webkit-filter: drop-shadow(0 0 3px #ff0)drop-shadow(0 0 10px #ff0);
    filter: drop-shadow(0 0 3px yellow)drop-shadow(0 0 10px yellow);
}

Named Style

Alternatively, you could create a named style in your Theme, apply that style to your variable tile’s 'True' state, and use Custom CSS to target it:

.tile.--theme-style-variable-active .icon {
    -webkit-filter: drop-shadow(0 0 3px #ff0)drop-shadow(0 0 10px #ff0);
    filter: drop-shadow(0 0 3px yellow)drop-shadow(0 0 10px yellow);
}

Here’s a short video showing how things would look when all setup with the named style approach…
https://imgur.com/zAqpYZN

1 Like

Thank you so much, Josh! It works.

My last feedback (and maybe I should post it somewhere else) is that I cannot select outlined icons. Is there a way to update the tile configuration to select the outline version of that icon? I am looking at the DOM and the SVG is different.

image

Note that any custom CSS snippets provided are not officially supported and may need to be adjusted with potential future changes to the SharpTools web app. :slight_smile:

Noted and that’s understandable.

3 Likes

I was able to use this to add glow to icons in a Supertile. :laughing:

Hi James does this still work? I haven’t been able to get my rules working, seems like theres a few steps that may have been updated? Any ideas what I may be doing wrong?