Variable image not working for Android notification

Hi, i want to store snapshots of images from the doorbell in a folder so i can view them later. As well as sending them in a notification to my android phone.

The following code is working and overwrites each time the image (which i don’t want :slight_smile: )

      - service: camera.snapshot
        data_template:
          entity_id: camera.deur
          filename: "www/tmp/doorbell_snapshot.jpg"
      - delay: '00:00:01'
      - service: notify.all_phones
        data:
          title: "Ding Dong!"
          message: |
            {{now().strftime("%H:%M:%S")}} Er staat iemand voor de deur!
          data:
            image: "https://xxx/local/tmp/doorbell_snapshot.jpg"

The following code is correctly storing my images with a time behind it. But they never are send in the notification (probably because the url isn’t correct?)

      - service: camera.snapshot
        data_template:
          entity_id: camera.deur
          filename: "www/tmp/doorbell_snapshot_{{ trigger.to_state.last_changed.strftime('%Y%m%d%H%M') }}.jpg"
      - delay: '00:00:01'
      - service: notify.all_phones
        data:
          title: "Ding Dong!"
          message: |
            {{now().strftime("%H:%M:%S")}} Er staat iemand voor de deur!
          data:
            image: "https://xxx/local/tmp/doorbell_snapshot_{{ trigger.to_state.last_changed.strftime('%Y%m%d%H%M') }}.jpg"

Anybody has an idea what i am doing wrong?

You need data template, all templates for service data require data_template for the data section field.

      - service: camera.snapshot
        data_template:
          entity_id: camera.deur
          filename: "www/tmp/doorbell_snapshot.jpg"
      - delay: '00:00:01'
      - service: notify.all_phones
        data_template: #<----------------------THIS.
          title: "Ding Dong!"
          message: |
            {{now().strftime("%H:%M:%S")}} Er staat iemand voor de deur!
          data: #<-------------------NOT THIS.
            image: "https://xxx/local/tmp/doorbell_snapshot_{{ trigger.to_state.last_changed.strftime('%Y%m%d%H%M') }}.jpg"
2 Likes

you are my new hero :slight_smile: