One rule for multiple rooms

I was wondering what the best way to do this is:

  • I have several rooms
    ** each room has a button / scene devices (usually 2) (innovelli red dimmer)
    ** each room also has lights, shades, color bulbs
  • In each room I would like to have a rule set up where
    ** one tap up - turns on just that light
    ** two taps up - turns on all of the lights
    ** three taps up - opens the shade
    ** same for down (etc. etc.)

The point is that there are identical or similar enough rules in each room but with different triggering and target devices.

So far I've gotten this to work with a bunch of cloned identical rules redone for each room, but it's hard to maintain as if I want to adds one more behavior, I have to do it multiple times.

Is there a better way? Can there be a rule hierarchy or some kind of use of variables?

I was thinking the same many, many, years ago when I did a room's based model for a large home. Each room has it's own set of variables and devices but many things are replicated such as scene names and button actions. I have yet to find a "hierarchical" method of doing this and have lived with this approach as is.

What I have found that any overlap can cause more issues than keeping everything separate. Tried to play tricks with variables and strings but then searching strings for array locations isn't something that is easily debugged.

This is WebCore territory :wink:
One piston can capture the event device(s), load a device var and the code can be "room agnostic" from there.
It's easily debugged as there is a GUI interface for programming and tracing with logs.
Only caveat is you need to have some desire to learn a foreign concept if you have never coded before. It can be daunting but rewarding.

Yeah. Might have to get into webcore. I’ve been getting by with regular rules but might not be enough.

In your opinion, how would webcore compare to something like node red?

I have only visited the Node Red site to Oooo and Awwwwe.
I am a old traditional programmer so I'm sticking where I feel comfortable.
Not sure of all the facts but NR required a Node.js service to run locally. I assume it will work under Win10 but I only read the Linux docs quickly.

Hi, is it still the case that this can't be accomplished with Rule Machine or another app? While I'd love to get comfortable with WebCore and/or Node Red, I'm not there yet. I'm hoping there's been some advancement since this thread was last active...

Welcome to the Hubitat forums!

I am assuming that "this" is referring to using the one rule for multiple rooms? I think even when the original post was written, you could theoretically do this within one rule. For example, use Rule Machine, have multiple button devices as the triggers, and the action of the rule would be to turn on a particular rooms light switches or bulbs or scenes.

While you can use one rule to do this, in my opinion you really want to keep these separate. Building, debugging, and maintenance are (again in my opinion) just easier with simpler and cleaner rules. I know some have OCD with seeing all these separate rules, but simpler is better in almost every case.

I think Ron was right above when he said this:

Cloning a rule and just changing out the device is a good workaround if you really don't want to do everything from scratch. Unless you are doing this dozens upon dozens of times, I don't think it is all that hard to just start with a fresh rule each time.

Maybe someone else has some further suggestions or ideas I may have missed...

1 Like

Yep, cloning was going to be my suggestion as well. You could treat one copy of the rule(s) like a template and any changes made to it then re-imported back over each rule (I assume that can be done).

1 Like

Correct--basically, I have the same situation/question as the original poster here, and was hoping the answer originally given was not the latest info. I understand the risk of "overlap," but really wish it was possible to define a rule in RM once per "desired behavior" and then have the rule applied to whatever device triggered it.

For example, hypothetical house with three rooms. Each room has an Inovelli Red dimmer switch to control the lights. I'd love to define these rules (just as an example):

  • double-tap UP turns lights ON to 100% brightness
  • triple-tap UP turns lights ON to 75%
  • double-tap DOWN turns lights ON to 50% brightness

I'd like to define those one time, and assign them to the switches in each of the three rooms. Whenever a switch in a room does one of those scenes, the lights in that room (only) should respond accordingly.

Currently, as has been suggested here and elsewhere, I have to define those rules 3x, for a total of 9 rules. I understand the point about easier debugging with separate rules, and we should absolutely be allowed to configure rules this way, it would be great if we could also do what the original poster and I are asking about here. As @dgrekov noted, later if you want to add a new behavior (e.g., maybe you installed a new device in each room), you have to create and clone your new rule for every room.

This won't do what I want. Doing this, all the switches would control one room's light. Or, if you add all the lights into the "actions..." section of the rule, pressing buttons on one switch would control all the lights in all the rooms. The concept I'm looking for was mentioned in this post (in the context of Mode Lighting, but I don't use Mode Lighting or modes in general):
hxxps:// (sorry, apparently I can't include links in my posts yet)

"Set only triggering light"

Note my example above with 3 rooms and 3 scenes is an oversimplification in my case. I have 5 rooms with 5 behaviors each, currently. That's 25 rules in RM, and will only grow as I add new scenes.

Yes, this works (and is what I'm doing currently), but is incredibly tedious to set up initially and maintain over time.

I can't edit posts yet--my "this works..." post above was in reference to the quoted post here

No, not true if structured correctly. You could or would use conditional statements in the action section. The below isn't necessarily the exact way you would write the rule, I just did this to show the logic.

  • If button 1 (bedroom) pressed, then turn on bedroom light.
  • If button 1 (dining room) pressed, turn on dining room light
  • If button 2 (dining room) pressed, then turn on dinner party scene

You can add infinite amount of If/then/else to get your desired action.

Triggers are just what sets off the rule to run, they aren't necessarily tied to a particular device or scene. You could press the bedroom light 3x and turn off the basement light if you want to.

Ah, yes, I now see where I can add the conditional logic. I do agree that this would get deep into the "overlap" territory and would be a nightmare to maintain and debug/troubleshoot when something goes wrong. I really feel like the "set only triggering light" concept from the thread I attempted to link to above would be a fantastic option.