I have a camera integration to Home Assistant with Frigate.
I want to turn on the light when motion is detected after sunset and turn off the light after no motion for 1 minute.
The automation itself works well. The problem is that when the light is turned off, the camera detects motion. So the light is turned on again. And the infinite loop begins.
I have already tried delays and durations but without any luck. The light is turn on again however I configure the automation.
Can anybody suggest me solution for this problem? I couldn’t find any option to set dependency between automation. And the other question, is it normal that an easy task becomes so complicated?
If the camera detects motion than probably this is your I assume frigate setup. You should configure your camera to be less sensitive on motion because it will detect everything. I mean bug is flying near camera or wind is blowing, or shadow is moving and camera will detect motion. You will have to experiment a bit before you find settings that suit your needs.
The setting you are looking for is threshold. This is camera sensitivity. I use in frigate
Thank you! I will try to adjust. But based on the frigate debug view, the motion box is huge when the light is turned off. Lot of pixels are turned from white to black. My fear is, if I would set the sensitivity to low enough it wouldn’t also recognize a person moving there.
I think I would go for the other way. I would block the light from being turned on again for say 5 seconds after the light has turned off. The CCTV will trigger but the automation will not trigger. I am no automation expert but perhaps a delay helper as a condition. I realise this is a problem I need to resolve! My next job.
I had a similar situation with my garage lights (which are pretty much the only lights that I automated with a camera motion for a long time) and the only way I could solve it was to put as the first action of the turn off automation to turn off the on automation then turn it on after the lights turned off.
so the action becomes:
action:
- service: automation.turn_off
entity_id: automation.motion_on
- delay:
seconds: 2 # just to make sure the automation gets disabled in time
- type: turn_off
device_id: yyyy
entity_id: switch.sonoff_yyyy
domain: switch
- delay:
seconds: 5 # you need to set this long enough so that the camera motion trigger has already happened before you re-enable
- service: automation.turn_on
entity_id: automation.motion_on
But I don’t need it anymore since I transitioned to using a real PIR motion sensor instead of a camera based motion sensor.