Hi there, I have several motion sensors at the hallways of my flat. My problem is, if my kids are playing in the hallway for a certain time the motion sensor stops detecting them and the light switches off. I’m using hue motion sensors with a short cool down time but I saw if the sensor detects 3 - 4 times motion in a row, the cool down time seems to be expand and no new signal is generated.
I tried it with a timer which should hold the light on until the sensor is ready again but unfortunately that didn’t work well for me.
Now I have a new idea and want to hear your opinion if it’s possible to do so.
The sensor should detect motion as normal and start a timer, but every time a new motion is detected the timer should be expanded (maybe every time +30 sec) and if there is no more motion the timer should be stopped and reset.
Is that possible to achieve? Thanks for your help.
Thats pretty straightforward using ‘restart’ as the script mode.
However, it won’t totally solve the problem.
The way triggers work in HA is when a state changes. So if the kids are constantly running around in the hall, the motion sensor will never go to a clear state, which means eventually the timer runs out and the light goes off.
Yes and because of that circumstances (kids are playing constantly in the hallway) the timer wasn’t the solution for me.
Hmm any idea to get a solution, I understand the sensor doesn’t clear maybe the problem only could be handled with a presence sensor right (eg Aqara FP1 or something like that)?
i’m sad to hear this, I thought it would be a way to solve that issue without buying that expensive sensor only to stay lights on an hallway. I mean thats kind of wasting money for me.
You shouldn’t need to. I have motion sensors in my utility room and garage that work just fine. An automation switches the light on as soon as motion is detected, and a separate one (because there are some other considerations in my case like physical switches and ping sensors) switches them off if no motion has been detected for a minute.
Here’s an edited version of my off automation showing the key bits:
- alias: Lights - utility room light off
description: >-
Turns the utility room light off 60 seconds after last motion detected.
trigger:
- platform: state
entity_id: binary_sensor.utility_room_motion
from: 'on'
to: 'off'
for:
seconds: 60
action:
- service: light.turn_off
entity_id: light.utility_room_light
That seems like an obvious solution, which may solve the OP’s use case, given you’re talking about kids running around and moving alot.
I was thinking more about my own situation where I have the motion sensor in the kitchen. If you are sitting at the table, not moving much, then it does occasionally turn the lights off because no one is moving enough for it to sense you.
I combined the automations into one, so there are 2 triggers once motion is detected and once no motion is detected for 45 seconds. Then once a “light profile” for the day and once for the night. I think that seems to work too, but if I add an additional helper (brightness value of one of the motion detectors involved) as a condition, then the whole thing becomes unreliable. But I don’t know why. Here at least the automation WITHOUT the helper, does it look good so far?
This is why I prefer to use multiple, simpler automations — reading yours is hard work. I also avoid using the device notation if I can, which is messier for no good reason.
You could also use the custom component Entity Controller.
Which is very powerful for motion triggered lights and easier to configure that separate automations.
I’m not good in writing code so I prefer to use the automation editor. All seems to be properly there
Unfortunately in the editor view things look messy, sorry for that.
what do you mean with device notation? I used motion detected and no motion detected, exactly as you did.
Entity controller? How does it work? Is it an addon to setup the entitys?
I saw a blueprint especially for motion detection (YAMA), is that similar to that?
You used the device platform, with device_id, domain, type and so on. I used the state platform with entity_id. Both should work, it’s just that the device way ends up with a lot of cruft in the code.
but if both ways work, that should not be responsible for my issues, is getting the lux value of my motion sensor used for the automation too the problem? should I get the brightness from another device?
I don’t know: you’ve not explained the lux issue in much detail apart from “becomes unreliable”. Show the code with that bit included and explain in words what you’re trying to achieve.
I will try it again first and then I will show you the code. It’s the same code but with the addition of my helpfer for the nightmode which is ON if the lux value of my sensor is below XXX lux, only in that case, the automation should run. If not the lights have to stay off.
- choose:
- conditions:
- condition: trigger
id: motion detected
- condition: and
conditions:
- condition: state
entity_id: binary_sensor.nightmode
state: "off"
- condition: state
entity_id: binary_sensor.lights_active
state: "on"
enabled: true
No it’s not a blueprint, but an integration. You specify the motion sensor(s), the entities to control and the other options like overrides and night mode.
This is one complex config I use for my corridor, with a night mode, light transition time and backoff mode (to make the light stay on longer if I pass a sensor a couple of times in a short time)
Your first 2 actions have (as their second condition) an “And” that only has one condition. If you meant for both conditions to be required, they both need to be inside the “and” condition.
It doesn’t really matter because multiple conditions are already “and” by default, so it doesn’t change the way the automation works. It’s just something that doesn’t need to be there. But if you were to set up an “Or” condition the same way, it wouldn’t work.
Yes indeed. The delay option is the normal time the lights stay on after motion detected. The backoff_factor is the factor the delay gets multiplied with and added to the delay after a new motion detected (while the delay is not ended yet). backoff_max is the maximum time the lights may stay on, so the maximum delay.