Android Notifications with URL Image - Cant get to Work

Hi,

I am really missing something here. I followed this, get a notification, but no image ever

https://companion.home-assistant.io/en/notifications/attachments

And within automations.yaml we have

  - data:
      data:
        attachment:
          content-type: png
          hide-thumbnail: false
          url: https://github.com/home-assistant/home-assistant-assets/blob/dfd755bd8fb86dc2fdde1c70a8fc2fbcbec8a6da/logo-round-192x192.png?raw=true
      message: Something happened at home!
      title: Motion Detected
    service: notify.notify

is this for home assistant android app? I think you need to use it like the way mentioned here Push Notifications now available!

message: "text"
data:
  android:
    notification:
      image: https://i.pinimg.com/originals/0f/7b/fa/0f7bfa4e6775b5977694a6036fc85b48.png

Yes its the HA App from Play Store.

I did see and try suggestion, so did another attempt and it fails with.

voluptuous.error.MultipleInvalid: extra keys not allowed @ data['android']

Maybe once before, but seems deprecated.

The automations.yaml I tested looked like this.

  - data:
      android:
        notification:
          image: https://i.pinimg.com/originals/0f/7b/fa/0f7bfa4e6775b5977694a6036fc85b48.png
      message: Camera 192.168.1.41
      title: Motion Detected
    service: notify.notify

you need to select another service I think. android app creates a new service. mine is notify.mobile_app_pixel_3. do you see something like this in the available services?

image

You’ve got the syntax slightly wrong, try to work things out in Developer Tools / services, like so :

Thanks that got me a long way to actually getting it to work.

I think my main problem seems to be a quirk in android/HA Companion

If HA Companion is running, no image. If I kill the app, it works.

There is no way to expand the image either, just jumps into HA. Is there anyway of jumping to the image URL?

I don’t have that behaviour.

Same here…

Have you ever been successful getting images to work? I am having the same issues, and there appear to be multiple descriptions here for the syntax for the notify message. I am using the following format and cannot get an image to display. I can access the image from Google Chrome on my phone (without wifi running), so I know the image is accessible from the internet.

    - service: notify.mobile_app_xxxxxxx
      data:
        title: Test Message at {{ now().strftime('%I:%M %p') }}
        message: "Snapshot of Sunroom!"
        data:
          attachment:
            url: "https://xxxxxxx.xxxxxxxx.org:8123/local/cam_captures/sunroom.jpg"

Anyone see a problem with my syntax or have any suggestions?

NOTE: Problem solved, I was looking at the IOS instead of the android example.

1 Like

What was the actual fix?

I think I have the path to the image wrong? I put it in a subfolder in ‘www’

edit: never mind I got it. needs to be /local/path.jpg

Ok everyone, i finally got it to work. you need to do

data:
  image: https://i.pinimg.com/originals/88/82/bc/8882bcf327896ab79fb97e85ae63a002.gif

they might’ve changed something, but this is what works now. I found it on https://companion.home-assistant.io/docs/notifications/notification-attachments/

1 Like

This was always the format, most of the confusion amongst users is when they follow iOS format or are following the format of a different integration. The docs always had this example too.

1 Like