Room Lightning won't turn on light when 1 condition is active when 2nd changes

I have Room Lighting app set so that if the motion sensor becomes active it turns on the light unless light level in the room is over 30. Normally when I enter the room and light level is low it works as expected. The problem is that if I enter the room while the light level is high, the app doesn't turn on the light if the light level later drops below the threshold while I am still in the room, probably because the 1st condition (motion becomes active) doesn't happen again if I am already in the room. If I exit the room and reenter, the light turns on. Is there a way to get it working so that even if I am already in the room, when the light level drops, the light will turn on?

You could add a Means to Activate of Illuminance Falls. But, then it would activate whenever that happens, not just on motion. So, you're going to have to use some external logic for that, such as a rule that handles that one case (motion is active AND illuminance falls).

You mean a rule that is completely independent and outside the Room Lighting app? What will happen in this case when I leave the room? Would the deactivation still be handled by the Room Lighting app?

Yeah, the Room Lighting app would work just as it does now, including turning off the lights when you leave the room. The extra app only turns them on in the sole case where motion is active and illuminance reports below some number.

For this all to work right, we need that external rule to activate the Room Lights app. To accomplish this, in Room Lights you give a name for the Activator Device on the main page, and hit Update. This creates a virtual switch by that name, and in Rule Machine we turn on that switch to activate Room Lights. A rule like this:

The activator device created by Room Lights is a special device (mine above is called ActivatorDev, but you can name it whatever). For one thing, it does not need to be turned off between on commands. Each on command will activate RL. Once activated this way, RL will wait for motion-inactive as usual to turn off the lights.

2 Likes

Wow! Much appreciated. Thank you very much for the detailed explanation. I will go ahead and "fix" my light activation using this method.

I created the Activator and populated it initially as you did with the ONLY IF(XXX active FALSE) and it didn't work. The RL stopped working. I then tried to change it to ONLY IF(XXX active TRUE) and it still doesn't work.

This is my 2nd attempt with TRUE instead of FALSE but as I said none of them allowed the RL to work properly:

I am also attaching a screenshot of my RL configuration because it has something to do with the interactions between them.

Turn on logging for both the rule and the RL instance, then use the filter in Live Logs to isolate to just those two. Post a screenshot of those logs.

TRUE and FALSE are merely present values displayed in the UI, and aren't part of the rule. But, what you show above is right.

Sometimes to test simply break down the parts. Test Room Lights by using the device page of OfficeLightActivator to turn it on, and see if that makes the lights turn on. If so, great; if not, need to find out why. Etc....

To aid in testing you can leave RL open, and Activate it or Turn Off from the UI.

Nothing shows up in the Live Log unless I manually activate and then it fills up the log.

How do I remove the Activator from RL so I can verify it is still working as before? I can't just erase the value of the field so how do I do this?

Edit: I deleted the auto generated device and then I was able to remove the activator from the RL. I tested it on its own and it works again. So now I'll go back to tackle the Activator.

So I removed the Activator and verified that the original RL works. It does. Then I went ahead and recreated the Activator and lo and behold the RL still works. The test will be tomorrow when the lumen level goes down whether the light will be activated when I am already in the room.

1 Like

It's working! As soon as the light level dropped to the preset level while I was in the office the light switched on.

Thank you Bruce for your help and for teaching me something new about Hubitat.

I'm sorry but I made this harder than it had to be. I forgot that Rule Machine has an action to activate Room Lights, without needing the activator device. Like this:

You can select the Room Lights app you want to activate from a pull down menu.

1 Like

Can you take a look at what I created in the rule machine and see if this is what you meant? I have it stopped right now.

That should work...

Thanks. I will give it a try tomorrow otherwise I will be playing with this half a night, I lack self control... :smiley: