On the above example, Test 1 sends the notification without the image while Test 2 sends the picture without any problem. Pathes seem to be resolved correctly.
I am trying to create an automation similar to yours. I’d like to take a “camera.snapshot” of my “entity_id: camera.generic_camera” with an individual timestamp of the last tripped time of my “states.binary_sensor.cctv_01_line_crossing”
I’d then like to include this image with my HTML5 notification “notify.google_notify_pixel3”
This is what I have so far…
action:
- data:
entity_id: camera.generic_camera
filename: /config/www/alerts/front_door_alert_{{ as_timestamp(states.binary_sensor.cctv_01_line_crossing.attributes.last_tripped_time)
| timestamp_custom('%Y-%m-%d_%H-%M-%S') }}.jpg
service: camera.snapshot
- data:
data:
image: /config/www/alerts/front_door_alert_{{ as_timestamp(states.binary_sensor.cctv_01_line_crossing.attributes.last_tripped_time) |
timestamp_custom('%Y-%m-%d_%H-%M-%S') }}.jpg
message: Someone is at the front door
target: Pixel3
service: notify.google_notify_pixel3
When I manually trigger the automation the camera snapshot image file is created in the desired location with filename “front_door_alert_2019-04-15_14-45-48.jpg”
The notification pops up on my phone without the image though?
If I use a static image “image: /config/www/alerts/front_door_alert.jpg” the notification includes the image file
I see, the image must be a URL not a relative path. Does anyone know how I can add an image to the notification using a wildcard or similar to populate the filename?
I decided I didn’t need to keep or timestamp each snapshot for archiving. My BlueIris install already records camera footage.
I added ?{{now().second}} to the url of my snapshot to stop the phone caching the image.
It is now working great. When my automation is triggered the first action runs the camera snapshot service and then sends the image in the notification.
This is my code for anyone who is interested
action:
- data:
entity_id: camera.cctv_01
filename: /config/www/camera/front_door_alert.jpg
service: camera.snapshot
- data_template:
message: "Someone is at the front door"
target: Pixel
data:
image: "https://mydomain.duckdns.org/local/camera/front_door_alert.jpg?{{now().second}}"
url: "https://mydomain.duckdns.org/local/camera/front_door_alert.jpg?{{now().second}}"
service: notify.google_pixel
The URL is so I can tap the notification on my phone to view the image full screen. My next step is going to be to try and send notification with the image and link to open the live camera feed.