Attach photo to notification

and here a webcam snapshot to IOS when motion is detected at the front door:

alias: Front Doorcam Send a doorcam snapshot on movement AceIndy
description: ""
trigger:
  - platform: state
    entity_id:
      - binary_sensor.frontdoormotion_sensor
    from: "off"
    to: "on"
    for:
      hours: 0
      minutes: 0
      seconds: 0
condition: []
action:
  - service: camera.snapshot
    entity_id: camera.doorcam
    data:
      filename: "{{ snapshot_create_file_path }}"
  - service: notify.mobile_app_aceindy_iphone
    data:
      title: "{{ notification_title }}"
      message: "{{ notification_message }}"
      data:
        attachment:
          content-type: jpeg
          url: /local/tmp/snapshot_doorcam.jpg
        push:
          sound:
            name: default
            critical: 1
            volume: 1
variables:
  binary_sensor: binary_sensor.frontdoormotion_sensor
  binary_sensor_name: "{{ states[binary_sensor].name }}"
  notification_title: Movement detected
  notification_message: "{{ binary_sensor_name }} was activated!"
  snapshot_create_file_path: /config/www/tmp/snapshot_{{ states[camera].object_id }}.jpg
  snapshot_access_file_path: "{{ snapshot_create_file_path | replace('/config/www','/local') }}"
6 Likes