Notification to Mobile Phone Randomly Missing Picture

I have configured an automation that sends a notification - with a picture taken from my doorbell camera - to my mobile phone and my wifes (all_phones group) when motion is detected.

About 1-2 times per day I receive a notification with no picture, it contains only the title and message text. My wife always receives the picture in the notification sent to her phone. We both have Android phones with the latest version of the HA app.

I have looked through the logs and the automation trace, but do not see anything out of the ordinary. Any ideas of how to diagnose and fix this?

alias: Doorbell Motion
description: ''
trigger:
  - platform: state
    entity_id:
      - binary_sensor.doorbell_motion_detected
    from: 'off'
    to: 'on'
condition:
  - condition: template
    value_template: >-
      {{ (as_timestamp(now()) -
      as_timestamp(states.automation.doorbell_motion.attributes.last_triggered |
      default(0)) | int > 60)}}
  - condition: time
    before: '22:00:00'
    after: '06:00:00'
action:
  - service: notify.all_phones
    data:
      title: Motion Detected
      message: Front door
      data:
        channel: Doorbell
        importance: max
        group: Doorbell
        image: /api/camera_proxy/camera.doorbell_cropped
        ttl: 0
        priority: high
mode: single

I’m not sure if the notify runs parallel to the list of devices it contains. Who’s device is first in the notify list? Is it your wife’s? What happens if you add a small second delay (1 second?) Before the notify to let the snapshot finish before calling the notification.

Good questions! Thank you.

My wife’s phone is the first device listed in the group (all_phones). Thus I would assume that adding a delay will no have an impact as her device is first to get the notification (by a very small margin) and currently she always gets the picture.

For science, I will try adding a small delay and see how it goes tomorrow.

So I tried a few more things, but I am still getting a few notifications each day that are missing the picture.

Additional things I tried:

  • Reference each phone separately (with a separate action):
action:
  - service: camera.snapshot
    data:
      filename: /config/www/tmp/snapshot.jpg
    target:
      entity_id: camera.doorbell_cropped
  - service: notify.mobile_app_pixel_3a
    data:
      message: Front door
      title: Motion Detected
      data:
        channel: Doorbell
        importance: max
        group: Doorbell
        image: /local/tmp/snapshot.jpg
        ttl: 0
        priority: high
  - service: notify.mobile_app_pixel_4a
    data:
      title: Motion Detected
      message: Front door
      data:
        channel: Doorbell
        importance: max
        group: Doorbell
        image: /local/tmp/snapshot.jpg
        ttl: 0
        priority: high
mode: single
  • Add a 1 second delay between the notification action:
action:
  - service: camera.snapshot
    data:
      filename: /config/www/tmp/snapshot.jpg
    target:
      entity_id: camera.doorbell_cropped
  - service: notify.mobile_app_pixel_3a
    data:
      message: Front door
      title: Motion Detected
      data:
        channel: Doorbell
        importance: max
        group: Doorbell
        image: /local/tmp/snapshot.jpg
        ttl: 0
        priority: high
  - delay:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 0
  - service: notify.mobile_app_pixel_4a
    data:
      title: Motion Detected
      message: Front door
      data:
        channel: Doorbell
        importance: max
        group: Doorbell
        image: /local/tmp/snapshot.jpg
        ttl: 0
        priority: high
mode: single

The strange things is that after trying these two changes, it is now my wife’s phone that occasionally does not receive the picture. Her phone is the Pixel 3a and it has always been the first in the action list.

Any other ideas?

I also tried adding the delay after the snapshot and before the notifications are sent. Still getting a few notifications with no picture each day…

action:
  - service: camera.snapshot
    data:
      filename: /config/www/tmp/snapshot.jpg
    target:
      entity_id: camera.doorbell_cropped
  - delay:
      hours: 0
      minutes: 0
      seconds: 2
      milliseconds: 0
  - service: notify.mobile_app_pixel_3a
    data:
      message: Front door
      title: Motion Detected
      data:
        channel: Doorbell
        importance: max
        group: Doorbell
        image: /local/tmp/snapshot.jpg
        ttl: 0
        priority: high
  - service: notify.mobile_app_pixel_4a
    data:
      title: Motion Detected
      message: Front door
      data:
        channel: Doorbell
        importance: max
        group: Doorbell
        image: /local/tmp/snapshot.jpg
        ttl: 0
        priority: high
mode: single

Did you ever have any success with this? I also see randomly where the image does not appear in my notifications

Unfortunately I have not found a fix.

I got the same issue and fixed it by setting a 1 second duration in the trigger. Here is the full YAML:

alias: G4 Doorbell Pro Detection
description: ""
trigger:
  - type: turned_on
    platform: device
    device_id: xxx
    entity_id: xxx
    domain: binary_sensor
    for:
      hours: 0
      minutes: 0
      seconds: 1
condition: []
action:
  - variables:
      timestamp: "{{ now().strftime('%Y%m%d-%H%M%S.%f') }}"
  - action: camera.snapshot
    metadata: {}
    data:
      filename: /media/g4-doorbell/last-person-{{ timestamp }}.jpg
    target:
      entity_id: camera.g4_doorbell_pro_high_resolution_channel
  - action: notify.some_devices
    data:
      data:
        image: media/local/g4-doorbell/last-person-{{ timestamp }}.jpg
      message: Personne détectée!
      title: G4 Doorbell Pro
mode: single