Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 108407

Attach image to alert notifications?

$
0
0

Hi,

I have an alert set up for my camera that sends repeated notifications to my android phone if a person is detected. This has been working perfectly for me. However, I wanted to improve the notifications by adding a snapshot from the camera. I’ve tried adding the image field to the alert and the notify configs but neither seem to work. I do get the notification but it doesn’t contain any image.

Alert config (in alerts.yaml):

side_camera:
  name: "Alert Side Camera"
  message: "Person detected on side camera!"
  done_message: clear_notification
  title: "Alert!"
  entity_id: input_boolean.side_camera_alarm
  state: "on"
  repeat:
    - 0.1
  can_acknowledge: True
  skip_first: False
  notifiers:
    - notify_android_with_image
  data:
    tag: side_camera
    actions:
      - action: "acksidecameraalert"
        title: "Silence"

Notify config (in configuration.yaml):

notify:
  - platform: group
    name: "Notify Android With Image"
    services:
      - action: mobile_app_android
        data:
          data:
            ttl: 0
            visibility: public
            priority: high
            image: "/media/local/camera_snapshots/side/{{ states('input_datetime.side_last_event_timestamp') | as_timestamp | timestamp_custom('%Y-%m-%d_%H-%M-%S') }}.jpg"

I captured the service call using developer tools:

event_type: call_service
data:
  domain: notify
  service: mobile_app_android
  service_data:
    message: Person detected on side camera!
    title: Alert!
    data:
      image: >-
        /media/local/camera_snapshots/side/{{states('input_datetime.side_last_event_timestamp')
        | as_timestamp | timestamp_custom('%Y-%m-%d_%H-%M-%S') }}.jpg
      ttl: 0
      visibility: public
      priority: high
      tag: side_camera
      actions:
        - action: acksidecameraalert
          title: Silence
origin: LOCAL
time_fired: "2025-01-01T01:27:17.230755+00:00"
context:
  id: 01JGFQJSFE3SFRCQ24V47YXQ7E
  parent_id: null
  user_id: null

It seems like the issue is that the template expression is evaluated as a string?

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 108407

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>