I like the idea of the Required Expression 'cause in my head it takes some of the load of the HE, the motion sensor can send inactive events all day long and it won't even touch this rule if the light is off. Dunno if that is true or not.
I think it's still missing something, but how about this?
Trigger Event
[your switch] turns ON Select Actions to Run -
Wait for expression : [your motion sensor] NOT Active --> duration : [your delay time]
Off: [your switch]
This should cover the event the the switch was turned ON not by motion but rather manually or by an App.
Well this is fun... The rule we tried was conflicting with my back door button --> flash kitchen nook light all day/turn on dining room light after sunset. So I deleted it. I also did the update to 2.3.0.124 after deleting it.
There is currently no rule installed that would turn the light off. But this keeps happening.
Turned off (physical) implies someone turned it off, or maybe a misbehaving switch. One of my Zen77s started sending button 1 pushed (physical) every minute a few weeks ago. Hitting configure fixed it, but very strange.
It is in use by other rules, but none that coulda/shoulda/woulda been triggered in a way to turn off the light. The other two rules flash that light for notifications: dogs are outside, heat is on and a window is open.
Sorry for the late reply, I haven’t visited in a few days.
So let me see if I have this right…
You want the light to turn on when somebody flips the switch.
You want the light to turn off ten minutes after motion stops.
Not in the description: Should the light also turn on with only motion and optionally turn off with the switch?
In any case the first two conditions are easy. If the switch is controlling the light then let it do its job. You will only need a rule to turn the light off ten minutes after motion stops. That’s it. If the light isn’t connected to the switch then you will need a second rule to turn the light on when the switch is thrown.
The key is that when motion is detected you need to cancel the delayed actions. Then setup a new delayed action when the motion stops.
If you want the optional conditions listed above then it is still easy with the two rules above. The switch just turns the light on and off with no special logic. For the motion rule you just need to add turning on the light when motion is detected.
The two don’t need to be tied together in a rule. If you flip the switch to turn on the light and then trigger the motion sensor it will just turn on the light again. No harm as it is already on. The same is true for turning off the light. If you turn it off manually then the motion rule will just turn it off again.
I use the same basic logic in my bathrooms. There’s no reason to use the switch but it is there to be a UI element for guests. The only edge case this doesn’t catch is if somebody turns off the light manually and somebody walks in before the 30 inactivity reset then they will have to manually turn on the light. This isn’t a problem as the normal reaction is to reach for the switch anyway. It would typically only happen when several guests are here. Day to day the switch is never touched.
Here you go. So, in evening i expect the lights to turn on automatically and turn off, which is working fine. But, on other modes, such as day and night, I just need that in case somebody turned the lights on physically from switch....then they should turn off after inactivity.
Have you tried setting up a new/separate rule to turn off the light when there is no motion for X minutes when in those modes? I suspect it would work better.
I have that (turn off after no motion for X minutes) setup in Rule Machine and also in the Lights On Motion Plus community app and it works well.
I already have motion app configured for that room, and hence wanted to keep it simple and just add that additional condition. If not needed, I do not want to add additional RM constructs making the Hubitat setup more complex. It "seems" the motion app should be doing it by face value... so not sure what I might be doing wrong here.
Unfortunately, I’m not familiar enough with the Motion app as I find Lights on Motion to work better, so I don’t use it…
I also initially wanted to have the least number of rules possible, but since found that adding more can sometimes reduce complexity or make things work better. It depends on the situation though!
In you rule for turning the main lights off, you should be able to add additional lights to turn off
Or try turning off that "do turn on if on" not sure what logic is behind that. Looking at it it should turn lights 3 and 3 off in all modes aft the times you have set