Hi everyone, I’ve been experimenting with automating my outdoor lights using my HikVision camera and a motion sensor. The goal is to have the lights turn on when someone enters the camera’s field of view and stay on as long as motion is detected. I’ve set up the automation to turn off after 3 minutes of no motion, but I’m running into an issue where the lights sometimes turn off too early or stay on longer than expected.
Here’s what I’ve tried so far:
-
Turn on lights when field sensor is triggered
- I’ve set up an automation that activates when the camera’s field detection sensor goes from off to on. This works perfectly, and the lights come on as soon as someone enters the area.
-
Keep lights on during motion
- The challenge is ensuring the lights stay on as long as motion is detected. I’ve tried linking the motion sensor directly, but it seems to override the field sensor trigger. I want the lights to stay on only when motion is detected after the field sensor has been triggered.
-
Turn off lights after 3 minutes of inactivity
- I’ve set up another automation to turn off the lights after 3 minutes if there’s no motion. This works, but sometimes the lights turn off even if motion is still detected, which is frustrating.
I’ve shared my current automation setup below, and I’m wondering if there’s a better way to structure this. Maybe I need to adjust the conditions or timing. Any advice or suggestions would be greatly appreciated!
text
#Front Door Camera Motion Detection Lights Trigger
-
alias: Turn on front door lights when movement is detected
trigger:
platform: state
entity_id: binary_sensor.front_door_cam_sensors_field_detection
to: ‘on’
condition:
condition: state
entity_id: sun.sun
state: ‘below_horizon’
action:
service: homeassistant.turn_on
entity_id: switch.front_door_lights -
alias: Turn off front door lights 3 minutes after last movement
trigger:
platform: state
entity_id: binary_sensor.front_door_cam_sensors_field_detection
to: ‘off’
for:
minutes: 3
action:
service: homeassistant.turn_off
entity_id: switch.front_door_lights
I’m hoping to refine this setup so that it works seamlessly. Let me know if you’ve tackled a similar project or have any tips!