Disable Motion Detection Hikvision Camera

Hello,
This is my first post, While setting an automation to turn light on when motion is detected by Hikvison cam, it works fine, but when I turn the light off after no motion for 2 min, the motion detection of the cam consider the light going off as another motion detected, so it turns light on again, then I will go into loop light on light off , light on light off etc.

My question is there a way to disable the binary sensor for the motion of the camera , then I turn the lights on and then turn the binary sensor on for motion again?

I home I made my question clear, thanks in advance for any help

You could include a condition in your light.turn_on automation that says the light must have been off for a few seconds. That way it won’t retrigger straight away.

automation:
  - alias: 'Hikvision controlled light'
    mode: restart
    trigger:
      - platform: state
        entity_id: binary_sensor.YOUR_CAMERA_SENSOR_ENTITY
        from: 'off'
        to: 'on'
    condition:
      - condition: state
        entity_id: binary_sensor.YOUR_CAMERA_SENSOR_ENTITY
        state: 'off'
        for: '00:00:02'
    action:
      - service: light.turn_on
        entity_id: light.YOUR_LIGHT
      - delay: '00:00:00'
      - service: light.turn_off
        entity_id: light.YOUR_LIGHT

thank you for the tip I will try to do it :wink:

I just edited my post with an example for you.

Oh, and welcome to the forum! :partying_face:

alias: 'Entrance Light on if motion01 ’
description: ‘’
trigger:

  • platform: state
    entity_id: binary_sensor.mymotiondetectorrule_cell_motion_detection_2
    to: ‘on’
    from: ‘off’
    condition:
  • condition: time
    before: ‘05:00:00’
    after: ‘01:05:00’
  • condition: state
    entity_id: binary_sensor.mymotiondetectorrule_cell_motion_detection_2
    state: ‘off’
    for: ‘00:00:02’
    action:
  • service: switch.turn_on
    entity_id: switch.entrance_53
  • delay: ‘00:00:00’
  • service: switch.turn_off
    entity_id: switch.entrance_53
    mode: single

thank you is my code correct?

Please edit your code using the </> icon so that it is formatted correctly.

alias: 'Entrance Light on if motion01 '
description: ''
trigger:
  - platform: state
    entity_id: binary_sensor.mymotiondetectorrule_cell_motion_detection_2
    to: 'on'
    from: 'off'
condition:
  - condition: time
    before: '05:00:00'
    after: '01:05:00'
  - condition: state
    entity_id: binary_sensor.mymotiondetectorrule_cell_motion_detection_2
    state: 'off'
    for: '00:00:02'
action:
  - service: switch.turn_on
    entity_id: switch.entrance_53
  - delay: '00:02:00'
  - service: switch.turn_off
    entity_id: switch.entrance_53
mode: single

Thank you very much for bearing with my ignorance :grinning:

I just tried the code, but unfortunately the same, any ideas please? or there might be something wrong with my code

What type of motion detection did you setup on your Hikvision ? I’m a little surprised it would consider a simple change of lighting as a motion event.

If your camera supports smart events (EasyIP 3.0 or higher), then I would highly recommend using those instead of normal motion detection. Especially the line crossing and field detection events work well. They’re a lot better in terms of false positives. EasyIP 4 adds a (pretrained) machine learning model to specifically detect humans and vehicles. So if your camera supports that, use it.

You could try playing with the delay time in the condition a little bit.

Also, if I remember correctly there is a setting in the Hikvision cameras regarding detection of light changes. If you can find that you should try reducing it’s sensitivity.

You should also change the mode: to restart as per my example.

Thank you very much for your feedback, it is not simple change of light, it is from compete light during the night to complete dark, Unfortunately I’m using a very basic hikvision IP cam which supports only basic motion detection through grid, no line crossing settings.
Again thank you for your suggestions.

I think I knew what is wrong with my code, you said in your first reply that I should

But in the code I used the binary sensor for the motion detection entity “binary_sensor.mymotiondetectorrule_cell_motion_detection_2”, not the light id “switch.entrance_53”

I think this is the problem, I will give it a try and let you know.

Thank you all for your help and support

Thank you , it works fine now :star_struck:

Good to hear

can you share the code? i am having the same problem

alias: “[motion] Garden02 Light on if motion”
description: “”
trigger:

  • platform: state
    to: “on”
    from: “off”
    entity_id:
    • binary_sensor.mymotiondetectorrule_cell_motion_detection_3
      condition:
  • condition: state
    state: “off”
    for: “00:00:05”
    entity_id: switch.1000785349
  • condition: time
    before: “00:00:00”
    after: “05:00:00”
    action:
  • service: switch.turn_on
    data: {}
    target:
    entity_id: switch.1000785349
  • delay: “00:02:00”
  • service: switch.turn_off
    data: {}
    target:
    entity_id: switch.1000785349
    mode: restart
1 Like