Change LED color if door left open

I setup a rule where if any of my doors are open then it changes the LED color on my Inovelli light switch. This makes it so that as I'm going to bed I can see if any of my doors have been left open and I can go and shut them. However, I've run into the issue where if I open any of the doors it turns red and if I close said door it will turn back to green. However, if I open one door, let's call it door A, and then I open another door, call it door B, once I close one of the doors (A) it sets the LED to green even though door B is still open. I'm sure this has to do with setting up some sort of loop to make sure all conditions are met before changing it back to green. I'm just not sure how to do that.

Any help is appreciated.

We probably need to see the rule to advise, but generally speaking ..

Trigger on door open/close change of state

Conditionalize on any door open sets red, else sets green.

It would be best to see the rule you have already.
I have a similar rule here

The trigger for this is the mode changing to pre-sleep

I'm sure there are rules for this (see they beat me to it). Depending on how many doors and how much of this you want to do, you may want to use an app. @dman2306 has one available via package manager called Device Groups. It will let you add all the contact sensors and create 1 virtual device. If any door is open the VD is open. Then make the VD your trigger and your done. KISS approved rule!

Without seeing your rule, I'm going to guess, that it's built so that IF ANY Open, then Red. So the opposite is IF ANY closed, set to Green. What you want is IF ANY open, then set to Red, ELSE-IF ALL are close, set to Green.

Be sure to set your trigger to be any of your sensors, and set it to Contact becomes changed so that each time any one of the contacts change, the rule conditions will be re-evaluated.

1 Like

No need for the else-if. If the any open fails, then you don’t need to check for all are closed. You already know that.

The "opposite" (in terms of the Boolean-algebraic result) of "any open" is "all closed," so an IF ... ELSE there should actually work, but my suspicion is that maybe the "notification child switch" for one door gets turned on when that door opens, then off when that door closes, which causes the notification to just get cleared (even if one for another door was previously turned on). The Inovelli doesn't "remember" notifications at the device level (what's really happening is that it's just one Z-Wave parameter that's getting set), or does the driver remember/track these for you. They have indicated in their forums that they are open to exploring ways these could be cycled or prioritized or something, but the way that their custom Hubitat driver (and ST DTH) expose these might easily lead people to think this already exists. This is a common question from what I've seen.

But I suppose we're all just guessing without seeing how things are currently set up. :laughing:

:rofl: I'm so bad at RM4, even after all this time. Post updated.

Are there any applications that can be used to accomplish this? Would the notifications app be able to handle this?

I think @dman2306 has an app that will work for this called Device groups. HPM is the recommended way to get this.

There are my two rules. They are both incredibly simple. I'll have to look into Device groups, and maybe try to group the open and the closed to changed state.

Thanks for the suggestions.

Sounds like maybe your last rule should be "all closed" instead of "any closed," at least for the LED bar. Otherwise, you're turning it green when any door gets closed, not just when all of them do. But you might want to keep that chime there and keep the rest of that rule as-is, otherwise you won't get the chime as one door closes.

What you could just combine your LED actions into that first rule: change your trigger to "changed" instead of open, then your actions can do something like this:

IF (Door X, Y, Z any open) THEN
  Chime
  Set color red
ELSE
  Set color green
END-IF

This is not the only option; you could also add an IF to that second rule to only change the LED if they're all closed (but keep the chime as-is). And SAR could probably handle most of this without RM. But that's what I'd probably do.

OK, that's only going to indicate which happened last .. a door was opened or a door was closed. That's not what you want.

Understand that Rule Machine has the concept of a trigger, but also the concept of conditions. A trigger is something that happens. A condition is a state of being. "The door just opened" is a trigger. "The door is open" is a condition.

What you want to do is have a rule that triggers (i.e. runs) each time your door situation changes in any way. But within the rule, you want to have conditions.

If any door is open
turn light red
Else
turn light green
Endif

That's just pseudo logic. The way you actually put those conditions into the Actions part of Rule Manager is a little bizarre. You add conditional constructs such as If/Then/Else as if they were actions, which they are not. But that's the way the user interface works, unfortunately. It gets worse with terms thrown around like "Action Conditional" and "Conditional Action". Bear with it.

Here's a good start for grasping the conditionals: YouTube

1 Like

I don't have Inovelli, so I put a light behind a couple of my TV's that is turned on and set to an orange color when any door opens and stays on until all of the doors are closed. It works well. If anyone's interested, here it is:


Here is how I changed them. It seems to be working now just using simple conditions. I didn’t combine the two rules because it seemed the easiest to get the two chimes.

Anything I’m missing as to why this might not work?

Thank you all for your help, the community here is fantastic.

That looks good to me!

I would have used something like

Trigger: any door opened

Action:
Chime
Set switch to red
Wait for condition all doors closed
Set switch to green

Then make a second rule

Trigger: any door close
Action:
Chime 2

While its not huge it is less impact on the hub

Also you may want to look into this all [RELEASE] Switch Dashboard - "Turn your LED status switches into mini-dashboards""

I'm trying something similar with a Black Series Dimmer switch (LZW-31 - not the SN version). It seems to be working except the LED color shows WHITE and not RED when I specify RED. If I set it to BLUE it seems to be working. I'm on the latest firmware (1.47) and the latest drivers. Have you run into any anomalies with color settings from RM?

This is the link to the thread on the Inovelli community:

I got help on the forum before for creating this however i never managed to get it working 100% sounds like exactly what you are after.

IF (Front Door Lock unlocked(F) [FALSE]) THEN
IF (Office lamp(off) is on(F) [FALSE]) THEN
Set Was on to true
ELSE
Set Was on to false
On: Office lamp
END-IF
Capture: Office lamp
Delay 0:00:00.2
Set color: Office lamp ->Red ->Level: 50
ELSE
Restore: Office lamp
IF (Variable Was on(false) = false(T) [TRUE]) THEN
Off: Office lamp
END-IF
END-IF

For some reason it confuses itself and doesn't restore the lights to the colour they were before. Someone might be able to tweak it for your use. let me know if they do!

In my case, the colors are working. It's the dim level (and only if the switch is off) that is not working. It's a current limitation on the Inovelli switch but I've been told that they are going to add capability to be able to set the level through RM.