Reolink cameras movement sensors to switch on lights

Hello “domoticators”.
Have any of you ever tried to use movement sensors of Reolink cameras (Mod. B400, linked to RLN8-410 NVR) with the scope to activate lights?
I am still fighting with the blueprint built for it because, still … lights switches on and off continuously after first successful activation of the blueprint.
The reason as far as I understand is that when the light switches off as per the sequence of the blueprint, it appears to the camera like something moving within its field and this restarts the loop with no end.

Here follows the ‘yaml’ created for it:


description: "Luci di cortesia_giardino"
mode: restart
triggers:
  - trigger: state
    entity_id:
      - binary_sensor.giardino_movimento
    from: "off"
    to: "on"
conditions:
  - type: is_illuminance
    condition: device
    device_id: c9f6fd7491a190715ddeac30a37995a7
    entity_id: a07caebbef7c81a26f4bb260a957a94c
    domain: sensor
    below: 10
  - condition: device
    type: is_off
    device_id: a1730b7b1edd72bd007f4eb6cacd1fed
    entity_id: af95bb1aa53c98faf3112650375961f4
    domain: light
    enabled: true
  - type: is_motion
    condition: device
    device_id: 338d5aefa58e23d78bcb39ecb8dd3682
    entity_id: 11e1d1961386db391ab16c58d4f882d5
    domain: binary_sensor
  - condition: not
    conditions:
      - condition: state
        entity_id: switch.sonoff_1001dc1c11_1
        state: "on"
        attribute: Automazioni in esecuzione
        enabled: true
      - condition: state
        entity_id: switch.sonoff_1001dc1c11_2
        state: "on"
        attribute: Automazioni in esecuzione
        enabled: true
    enabled: true
actions:
  - sequence:
      - type: turn_on
        device_id: a1730b7b1edd72bd007f4eb6cacd1fed
        entity_id: af95bb1aa53c98faf3112650375961f4
        domain: light
      - wait_for_trigger:
          - type: no_motion
            device_id: 338d5aefa58e23d78bcb39ecb8dd3682
            entity_id: 11e1d1961386db391ab16c58d4f882d5
            domain: binary_sensor
            trigger: device
            for:
              hours: 0
              minutes: 0
              seconds: 10
        continue_on_timeout: false
      - type: turn_off
        device_id: a1730b7b1edd72bd007f4eb6cacd1fed
        entity_id: af95bb1aa53c98faf3112650375961f4
        domain: light
        enabled: true

Few conditions are there to be satisfied before turning on lights and some of those comes from the meteo station on the roof, such as the environment light (less than 10 lux in my settings). Also none of the other blueprints that would switch on the same light should be already active.

I also tried to insert a delay of few seconds after lights switches off in order to let the camera “to forget” about the switch off event, but … no way.

Is there anybody able to suggest me how to solve the problem?

Thanks in advance!

Motion detection on camera is really pixel change detect.
For example
Camera takes image then takes second image
Let’s say first image was all black.
Second image is compared to first. If 20% of pixels in image become white it assumes something changed (move detected). There’s usually setting to change % pixels changes or how many successive frames change need to be detected but that’s basically it

You can likely fix this with time.
Add a condition in your automation that says light must be off 2seconds. You can adjust until it works acceptable for you

Yesssssss … You’ve got it!!!
I thought I’ve tried every kind of way to get out from that bloody problem, but it wasn’t :face_with_head_bandage:

Thanks a lot tmjpugh! now it works as it should me