Struggling to add a picture to a notification

I was trying to change the image that is shown within a Pushover notification by adding one I saved in HA’s “My media”–folder, but it didn’t work; the message arrives but I’m not seeing an image.

This is what my action looked like:

action: notify.pushover
data:
  message: test
  data:
    attachment: "/media/burger.jpg"

I’m using a Home Assistant Yellow, which by default has Home Assistant OS, so I thought /media should be the default folder for media. So, what am I missing here?

Try a different path

attachment: "/media/local/burger.jpg"

or copy to www folder?

attachment: "/local/burger.jpg"
1 Like

“/media/local/burger.jpg” didn’t work. I did, however just try it for the HA companion app’s notification-action though, just to make sure it’s not a Pushover-specific problem and it did actually work.

“/config/www/burger.jpg” neither worked for the HA companion app’s notification action, nor for that of Pushover.

You are misunderstanding @VietNgoc advice

www = /local

what is the hierarchy for the folder /media ?

is it local/media/burger.jpg?

You can control where the pics reside…

I’m not sure what folder you’re referring to. How do I open this local-folder you’re speaking of?
“local/media/burger.jpg” is definitely not the path to it, since with that path the picture isn’t displayed on my HA companion app’s notification.

Also, does it even matter? Why don’t we just go with “/media/local/burger.jpg”, which worked on the HA companion app’s notification action and figure out what Pushover’s specific issue is?

I mentioned it because the integration says different. The local file path means everything…

Image attachments can be added using the attachment parameter, which must be a local file reference (ex: /tmp/image.png ).

I’m more confused than before. What I used, “/media/local/burger.jpg”, which worked for the HA Companion App’s notification action, is a file inside a local folder.
If you’re saying I’m supposed to use a different folder for Pushover, then tell me how to find out its path and how to store things in it.

Listen, you are the one trying to switch the image, but you are being rude and combative. If the folder /media/local/ worked for you, dump your pics in that folder and use it.

You action: attachment code doesn’t match the folder you continue to reference

action: notify.pushover
data:
  message: test
  data:
    attachment: "/media/burger.jpg"

“/media/local/burger.jpg”

vs

"/media/burger.jpg"

I see where you’re coming from with the rudeness-claim, but the thing is: Your first 2 comments, to an extent, lack clarity and cohesiveness and it’s just annoying to me if a comment causes me to have multiple new questions but doesn’t answer any of the ones I had. Also, consider it’s not just your time being wasted, but also mine, so I don’t really feel like begging for clarification in this case. On top of that, your comments and me having to ask for what you mean repeatedly fill up the thread and might make other potential participants think that the thread’s question was already answered when they see it on the list of the latest threads. Plus if they open it they have to read through more which might also deter them. Or at least that’s what I assume. And that is also something that goes through my mind when I’m having this attitude.

Regarding the code from my first post not matching the folder I’m referring to: That is correct. I had used a wrong file path when I created the thread and because @VietNgoc suggested this other path that worked, at least for the HA Companion App’s notification action, I’ve been using that one instead.

Just chill, let’s try another way… do you have www folders in config directory? If not, create one. Restart HA … Upload the image to the www folder.
Check if the url works…

http://homeassistant.local:8123/local/image.jpg

If so, try with “/local/image.jpg” attachment

docs

1 Like

Well I’d suggest taking a minute and look how much time I have volunteered helping folks on this forum. (As well as the other contributors)
I’ll admit I don’t have all the answers so sometimes I need to ask questions about a user’s devices, setup and the integration.

Best of Luck

I have a single one.

Check if the url works…http://homeassistant.local:8123/local/image.jpg

In my case that would be https://homeassistant.local:8123/local/burger.jpg
The link works, i.e. it does show the image of the burger I just uploaded in my www folder and it also works within the notifications-action of the HA Companion app. It does, however, not work with the one from Pushover.

More obscure links that lack clarity and cohesiveness

Attachments

As of version 3.0 of our iOS, Android, and Desktop apps, Pushover messages can include an image attachment. When received by a device, it will attempt to download the image and display it with the notification. If this fails or takes too long, the notification will be displayed without it and the image download can be retried inside the Pushover app. Note that, like messages, once attachments are downloaded by the device, they are deleted from our servers and only stored on the device going forward. Attachments uploaded for devices that are not running at least version 3.0 of our apps will be discarded as they cannot be displayed by those devices.

Attachment files must be directly sent to our API with your other message parameters and cannot be included as a URL or other parameter that would instruct our servers or the device clients to download the file. This is done for efficiency and for the privacy of our users to avoid making requests to non-Pushover URLs without their knowledge.

Each message may only include one attachment, and attachments are currently limited to 5,242,880 bytes (5.0 megabytes). Attempting to send attachments larger than this size will be rejected with an API error (or server error for extremely large file attempts). Any resizing of images to fit under this limit must be done on the sending side before making the API request.

Attachment data may be sent in two different ways. For HTTP clients and libraries supporting multipart/form-data HTTP bodies, the attachment may be sent directly as binary data, including its content type in the parameter. See the Attachments - multipart/form-data section for instructions.

For HTTP clients that don’t support multipart/form-data but where Base64 encoding is available, the attachment may instead be sent as the attachment_base64 parameter. See the Attachments - Base64 section for instructions.

Attachments - multipart/form-data

While all other API parameters may be sent using standard application/x-www-form-urlencoded encoding (the default for most HTTP libraries), including an attachment this way requires sending parameters using multipart/form-data encoding which not all HTTP libraries support. Consult the documentation for your library to see whether it supports this and how to send parameters using this encoding. If it is not supported, see the Base64 option.

Python with Image Attachment

To send an image attachment, the 3rd party Requests library can be used. For example, to send the file “your_image.jpg”:

import requests r = requests.post(“https://api.pushover.net/1/messages.json”, data = { “token”: “APP_TOKEN”, “user”: “USER_KEY”, “message”: “hello world” }, files = { “attachment”: (“image.jpg”, open(“your_image.jpg”, “rb”), “image/jpeg”) }) print(r.text)

Thanks for pointing this out. I do, however, not see the images in the Pushover app either.

attachments are currently limited to (5.0 megabytes)

I made sure my file is smaller than that.

Aside from that, I barely understand anything from those pages you quoted.