Blink Automation - motion detection setting

Hi, I am trying to make BLINK automation work. The automation should 30 mins after the sunset check if camera at garden is motion_enabled, if not, turn on the motion detection. Other cameras should inversely be checked id they have motion detection on, if so, switch it off and then arm the whole system.
I have put 10 s delay between the calls not to overwhelm BLINK server.
When I execute the automation, it shows triggered in Logs but nothing happens, no error :confused:

- id: '1608473836701'
  alias: Garden Cameras Armed
  description: ''
  trigger:
  - platform: sun
    event: sunset
    offset: 00:30
  condition: []
  action:
  - service_template: >
      {% if is_state ('binary_sensor.blink_garden_camera_armed' ,  'off') %} 
        camera.enable_motion_detection
        entity_id: camera.blink_garden
      {% else %}
        # Do Nothing
      {% endif %}
  - delay: '10'
  - service_template: >
      {% if is_state ('binary_sensor.blink_livingroom_camera_armed' ,  'on') %} 
        camera.disable_motion_detection
        entity_id: camera.blink_livingroom
      {% else %}
        # Do Nothing
      {% endif %}
  - delay: '10'
  - service_template: >
      {% if is_state ('binary_sensor.blink_office_camera_armed' ,  'on') %} 
        camera.disable_motion_detection
        entity_id: camera.blink_office
      {% else %}
        # Do Nothing
      {% endif %}
  - delay: '10'
  - service_template: >
      {% if is_state ('alarm_control_panel.blink_vp_home','disarmed') %}
        alarm_control_panel.alarm_arm_away
        entity_id: alarm_control_panel.blink_vp_home
      {% else %}
        # Do Nothing
      {% endif %}
  mode: single

I decided to simplify the code and do not check if the attribute is on or off and just send the service_call. It works well with XT2 camera, however with the new Outdoor Camera, it sets the motion detection off, however when armed, the camera actually once detects motion (BUT just once) and then it behaves as it should. I tested it in the original BLINK App and there everything is fine. I even prolonged the interval to 30 s between disabling motion and arming, I even tried blink_update service after all the calls…but nothing works.
Even if motion detection is disabled programatically and then the blink system is armed programatically, it fires once only detected motion on the new Blink Outdoor camera. In the orginial BLINK App on the phone the changes actually take place (!!!)
You see the motion detection disabled for the camera …weird … any suggestions?

UPDATE:

  • I also tested that if you first arm the system and then disable motion detection on a camera, it works fine. If you do it other way round, you get motion detection triggered :confused: -
  • Also when you disable motion detection from HASS and then arm the system from the BLINK App, you still get first motion detection triggered. :face_with_raised_eyebrow:
  alias: Garden Cameras Armed
  description: ''
  trigger:
  - platform: sun
    event: sunset
    offset: 00:30
  condition: []
  action:
  - service: camera.enable_motion_detection
    entity_id: camera.blink_garden
  - delay: '10'
  - service: camera.disable_motion_detection
    entity_id: camera.blink_office
  - delay: '10'
  - service: camera.disable_motion_detection
    entity_id: camera.blink_livingroom
  - delay: '30'
  - service: alarm_control_panel.alarm_arm_away
    entity_id: alarm_control_panel.blink_vp_home
  mode: single

I’m sorry I’m having a little trouble understanding the problem. Is the issue that the state is not being updated in home-assistant after calling the automation? If so, that is because the state cannot be updated until the next scheduled refresh if the system (dictated by your scan_interval setting). You can force a refresh of states by calling the blink.blink_update service about 10-30s after your automation service calls.

If I’m misunderstanding the problem, please let me know

Hi Kevin,
the problem is as follows:

  1. Initial state: Blink camera is DISARMED and Motion detection is ENABLED.
  2. I call the automation to DISABLE Motion detection for the camera and after that to ARM the system.
  3. After the scan_interval of the HA the motion detection is showing OFF in HA and also in the Blink Mobile App. The system shows ARMED again in both HA and Blink Mobile App. So everything pretends to be ok.
  4. Once there is a movement in front of the camera, it triggers and alarm (even though it should not - the motion detection is disabled!)

The weird thing is that it does so:

  • only on the New Blink Outdoor Camera (the other cameras on the system are XT2 and those behave correctly
  • only once (the first movement in front of the camera triggers alarm) - then the camera starts to behave as it should and does not detect any additional move.

Hope the problem is more clear now.

(Also I tried different scenarios, like disable motion on the HA and do the Arming on the Blink App and the problem is the same. If you do it otherway round - Arm camera and then disable motion detection, it works fine.)

Gotcha, thanks for clarifying. Is there any reason you can’t do arm system and then disable motion detection since that sequence works?

Regardless, I’m not sure why you’re seeing that behavior. There’s nothing in the code that would cause that, so maybe an API quirk. As a thought: you may want to try calling blink.blink_update in between disabling motion detection on the camera and arming the system. Not sure if that will work, but worth a shot

Well it is indoors camera that need to be switched off before armed. If it is done other way round, the camera is armed and then switched off, due to the time delay, there would be a 3 minute timeframe, when nobody should move in front of the camera not to set an alarm.

Yes I tried to put in the blink_update service call between motion detection and arming and even after arming, but it did not help :confused:

Guess it is something in the new generation camera firmware that does not refresh the settings until it is fired the first time. However when operating through the Blink App there is no problem. So presumably the Blink App calls some different / additional method in the API (?) …I am a technical NOOB so this is well over my skills :confused:

What time delay? Are you referring to the scan_interval? If so, the scan_interval stuff only applies to updating the states of sensors in home-assistant. You can arm the system and then 5-10s later disable motion detection and those settings will happen immediately with the camera (it’ll just not update in home-assistant until the next refresh).

Thanks, got confused with the scan_interval. I tried the ARM >> 5s >> DISABLE MOTION sequence and it works. So I guess this is the only way to go until it is fixed so that the sequence DISABLE MOTION >>> ARM would work for the new outdoor Blink cameras.

Hi Kevin, would you have any idea how to prolong the time when switch is active on the frontend?
I have the following switch defined for BLINK in configuration.yaml - it toggles the motion detection on the camera and after 6secs it calls blink update.

PROBLEM: on the frontend the when I turn on (or off) the switch, the toggle button changes for about 8 seconds and then returns to previous state and in about additional 3-6 seconds it goes back to the selected value. I suspect that there is some time for the toggle button to switch however in this time window the BLINK does not make the change and update, so it then switches back and forth again.
I tried to put the wait_template or delay template in the code but this does not effect the time of initial switch change.

Any ideas how to overcome this? (so that the toggle switch stays longer in the selected position, so that the called services have time to be executed)

Thanks for any thoughts.

  # Switches
switch:
  - platform: template
    switches:
      zahrada_motion:
        friendly_name: 'Motion detection - zahrada'
        value_template: "{{ is_state('binary_sensor.blink_zahrada_camera_armed', 'on') }}"   
        turn_on:
          - service: camera.enable_motion_detection
            data:
              entity_id: camera.blink_zahrada
          - delay: 6
          - service: blink.blink_update
          - delay: "{{ is_state('binary_sensor.blink_zahrada_camera_armed', 'on') }}"
          - service: notify.mobile_app_ihol
            data:
              message: Detekce pohybu zapnuta na kameře Zahrada.
        turn_off:
          - service: camera.disable_motion_detection
            data:
              entity_id: camera.blink_zahrada
          - delay: 6
          - service: blink.blink_update
          - delay: "{{ is_state('binary_sensor.blink_zahrada_camera_armed', 'off') }}"
          - service: notify.mobile_app_ihol
            data:
              message: Detekce pohybu vypnuta na kameře Zahrada.

I think that’s a front end display problem, I’m not sure how to prevent that from happening unfortunately