Help With Automation for Android App Notifications including an Image

Hi there, I am having some challenges with the code below - I have battled with this for hours (days if I’m to be honest :pensive:) and just can’t see what the issue is.

My goal is to use a timestamp as part of the name of the camera snapshot image and then add that to the android notification image address string.

I am using an input_text to create the timestamp (to ensure consistency between timestamp creation and its use in the camera.snapshot and notify.android_devices service calls.

I have a DDNS setup and can access from external as required - I’ve tested accessing the image directly (works) and I’ve tested the code below with the hardcode filename into the image address string (as per the comments rows -works).

BUT if I try to set the image string dynamically using “states(‘input_test.garage_photo’)”, the image isn’t loaded in the android notification.

I’m sure its a simple solution but it is just escaping me - I would really appreciate some help…

#Configuration for Garage Notifications
 - alias: Notify mobiles when the garage is open
     - platform: time_pattern
       minutes: '/10'
     - condition: state
       entity_id: binary_sensor.garage
       state: 'on'
     - condition: template
       value_template: '{{ ((as_timestamp(now()) - as_timestamp(states.binary_sensor.garage.last_changed) | default(0)) | int) > 600 }}'
     - service: input_text.set_value
       entity_id: input_text.garage_photo
         value: "camera_images/garage_{{ as_timestamp(now()) | timestamp_custom('%Y%m%d_%H%M_%S') }}.jpg"
     - service: camera.snapshot
         entity_id: camera.rear_driveway_camera
         filename: "/config/www/{{ states('input_text.garage_photo') }}"
#         filename: "/config/www/camera_images/garage_20200824_1035_30.jpg"
     - service: notify.android_devices
         message: "Garage door has been open for {{ relative_time(states.binary_sensor.garage.last_changed) }}"
           tag: garage_msg
           image: "https://<external_domain_ip>/local/{{ states('input_text.garage_photo') }}"
#           image: "https://<external_domain_ip>/local/camera_images/garage_20200824_1035_30.jpg"
           ttl: 0
           priority: high
           clickAction: '/lovelace/cameras'
           sticky: 'true'
             - action: "close_garage" 

You need to use data_template with the camera.snapshot service call.

You should probably use it with the notify.android_devices service call, too, but you’re “getting away” without using it because the notify service can render templates itself (which is uncommon as far as most services go.)

Thanks that worked.