Lights on if motion already active when mode changes

I have 4 Motion Lighting apps, all very similar. They are only active during Evening mode which itself is triggered by lux level going below a certain level. So far so good, but if motion is already active in any of the rooms when the mode changes the lights don't trigger until motion is cleared and then triggered again. This is all expected behaviour, but I would prefer it if the lights came on as mode changed if Motion is already active. I could add another RM rule for each room to check for existing motion at mode change, but I just wondered if anyone can think of a neater way to do it?

There was a request made some time ago to do this in Mode Lighting (it was done). So this could be added as an option to Motion Lighting as well: Adjust when mode changes.

1 Like

That would be perfect.

It will be in 2.0.3, not the pending release of 2.0.2.

2 Likes

Thanks Bruce. Superb customer service yet again. :clap:

Gonna pipe in on this. Until the enhancement is added, couldn't you just set a rule in rule machine for the time being that would trigger the light to turn on? If mode changes to - and kitchen motion sensor is active then turn on light. Just for now? Just kind've thinking out loud. That's what happens with our bedroom lamps when mode changes. Works very well for us. Just a suggestion. I'm sure you already thought of it though.

Thanks April, I did mention that option in my original post.

This feature made it into the hot fix release we did today. Available now if you update to 2.0.2.108.

2 Likes

OOPS Sorry I didn't see that. But, It's nice to know that there'll be a fix sometime soon for you. That's great news.

1 Like

Thanks Bruce. I've updated and activated the change level on mode change option on one of my ML apps to test it.

Just to be clear, as the terminology doesn't seem to exactly relate to Motion Lighting, now if motion is active when the mode changes to one of the ones active in the ML app, the lights will come on as if motion had just been detected?

Answering my own question having tested it and that is exactly how it works, which is perfect.

12 hours from a user request to it being incorporated in the production software must be some sort of record even for the Hubitat team!!! Incredible :+1: :grinning:

Can you guys come over to the UK and sort Brexit out for us, I reckon you'd have it done in a day.

1 Like

I noticed today that when mode changed to Evening, all 4 of my Motion Lighting lights came on, even though motion was not active in those rooms. I have the new "adjust levels when mode changes" option active in Motion Lighting but I thought this didn't happen when I first tested it - that the lights only came on if motion was already active when mode changed.

Is this how it is designed to work, that the lights come on at Mode change regardless of motion being active or not?

No, that's not supposed to happen. I'm not able to reproduce the failure.

I wonder if you could do a small test for me. With one of those rooms off, manually do a mode change (Settings / Location & Modes page). But, before you do that, please take a screenshot of the app status page for the room you're going to test. If it comes on with the mode change, I'd really want to see that 'before' app state. You can put the mode back after the test, I need to catch this failure, and it would be reflected in the app state.

That's annoying - I just prepared all the screenshots, changed modes back to day, and then back to evening which is the active mode for the lights, and none of the ML lights came on this time. I will post the screenshots anyway, but I guess that won't help much if it's all working fine now.

These are the logs from the original problem.

My ML apps are for Study, Kitchen, Bed1 & Bed2.

The mode changed at 3.09PM. The logs show that none of the sensors were active, yet 3 off the 4 switch on (I thought it was all of them but the kitchen actually only switched on correctly later when tripped). I don't know if it's related but the kitchen is the only one of the 4 that doesn't have the "don't turn off if already on" option active.

I believe you that it happened, but why is a mystery. It is possible that there is a race condition somewhere in Motion Lighting. I'm going to put in a fix for that possibility.

I do have a lot of lights come on at that mode change and it was a bit sluggish today to switch them all on, so maybe it is a race condition as you say. I'll try to monitor it over the next few days and, if I'm around, I'll take a screenshot of one of the app status pages just before it's due to change in case it does it again.

It happened again today with 2 of my 4 ML apps. Unfortunately I hadn't done any screenshots beforehand, but the one I would have done wasn't one of the 2 that misbehaved anyway, which would have been annoying!

The random nature of which ones come on wrongly does suggest that it may well be a race condition.

It's actually fairly doubtful that it is a race condition. That would only arise if there was a lot going on. Do you have logs that show that it was Motion Lighting that is turning on these lights? Do you have logging enabled in Motion Lighting?

I do have a fair amount going on at that mode change. Around 10 zwave switches going on and a few internal commands like thermostat setpoint changed as well. When I manually switched modes back and forth yesterday to test it and it worked fine, most of the lights were actually still on from the previous mode change, so there was less happening then. I might re do that test and manually switch all the lights off beforehand so it's a more accurate repeat of the automatic mode change.

I can't be sure it's ML turning them on, but I can't think of anything else that would turn those lights on at the exact time of the mode change.

I haven't got logging enabled, but I will.