Change LED color if door left open

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
  Set color red
  Set color green

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
turn light green

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

Set switch to red
Wait for condition all doors closed
Set switch to green

Then make a second rule

Trigger: any door close
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
Set Was on to false
On: Office lamp
Capture: Office lamp
Delay 0:00:00.2
Set color: Office lamp ->Red ->Level: 50
Restore: Office lamp
IF (Variable Was on(false) = false(T) [TRUE]) THEN
Off: Office lamp

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.

Thank you r.balneaves for your rule.

I spent some time trying to play around with this because I need something similar to let me know when the garage doors are open - i.e. turning lights on if off and setting them to 100% red, then when all garage doors close, turn the lights back to their original colour/brightness and turn them off if they were off or leave them on, if was on.

It isn't finished since I have to add more lights and the time (after 10pm), but I added a delay in certain places and was able to get my lights to restore to their original colour and brightness.

I think the Hubitat needs a few seconds to process the Capture and Restore functions before the light is turned off.

Note: when the light was on, without the delay the Capture and Restore worked for me

Could use some help with adding to the above rule.

I want to actually have multiple lights do the above:
If on: stay on and turn red, then turn back to original color and stay on.
If off: turn on, change to red, then turn back to original color and then turn off.

I've been trying this with groups but I cant make the variable part work (the if on, keep on/if off, turn on then change).

I think the rule above would get rather messy if i add 4 local variable for the 4 bulbs I want to control. But I will try this when i have some more time.

Hubitat will report only one current switch state for the group, on or off, depending on your settings in the Groups and Scenes "Group" app. From the release notes where this feature was introduced last fall:

There are now three choices available: (1) The group device on/off state reflects the most recent activity of the group device, and does not reflect anything about the actual state of the group members; (2) The group device will be on if any of the group members are on; and (3) The group device will be off if any of the group members are off.

If you want to remember the on/off state for each bulb within the group, you will have to use some workaround like your suggestion above (e..g, one variable per bulb). You will also run into the same problem for color and level--the group only reports one state.

An alternative to the above might be creating a scene with all of these bulbs. Select all relevant bulbs as belonging to the scene. "Initialize" the scene with whatever settings you want; it will soon not matter. Choose the option to create a "capture device" for this scene. Instead of all the capture/restore actions for the bulbs or groups in RM (and the extra "on/off" variable step), just activate the "scene capture" device before and the "scene activator" device afterwards. The only downside I see here is you have an "extra" device on your system that you are not using for any purpose besides this, but I'd say that's a good tradeoff if it makes everything easier.

Download the Hubitat app