WTH - Why don’t persistent Notifications support Media_source?
Do you mean like why can’t you make a persistent notification with an image? If so, agreed.
oh wait, I do that all the time…
currently you can expose an image via the following syntax:
[image-name](http://your-IP-Address:8123/local/images/image.png)
in this example the www folder in home assistant = /local/
this is not efficient, secure or as performant as storing your Images in the Media folder where you can manage them from the UI and you have access to the media_source feature in Home Assistant. I use the media_source method with many other notification methods like HASS.Agent in Windows and the Home Assistant Companion for Android.
Media source is a significant upgrade from all of the other methods available to insert static images in alerts. For dynamic Images the Camera_Proxy feature is amazing.
Here is the link to the Docs for Media Source
Yea makes sense. I did kind of forget you could include images in markdown tbh. But either way media source is definitely better.
Would be great if it worked just like the mobile app. Include the image or camera in data
in the service call in the exact same way.
I am both surprised and not surprised at all that the new cool feature like media_sources didn’t get added to Persistent Notifications which has not seen any love in a really long time. There is just a ton of other priorities right now.
That’s so damn annoying…
Code that does NOT work.
alias: PIR-Test
description: ""
trigger:
- type: motion
platform: device
device_id: 813eb0f6a885ce7eded92200b60c3821
entity_id: f1f8893ea52c5bc85b15c987f2b80a5e
domain: binary_sensor
condition: []
action:
- service: camera.snapshot
data:
filename: /config/www/images/briefkasten_{{ now().strftime("%Y%m%d-%H%M") }}.jpg
target:
entity_id: camera.esphome_web_454f70_ttgocam2_video
- service: notify.persistent_notification
data:
message: >-
<b>Briefkasten Voll
![Briefkasten](/config/www/images/briefkasten_{{now().strftime("%Y%m%d-%H%M")
}}.jpg)
title: Sie haben Post
mode: single
If you change that ONE line in Message to:
![Briefkasten](/local/images/briefkasten_{{now().strftime("%Y%m%d-%H%M")
you get a working notification with the image!
simply because images for notifications needs to be in the /www folder to be accessible.
Unfortunately, this is not safe. Because, as you noticed, in order for the camera screenshots to be “visible in notify.persistent_notification”, we save them, for example, in the “/www/images” directory, this is also confirmed by the documentation, but we may be exposing ourselves to unnecessary problems.
However, the documentation also forgot to add that “they can be used by almost anyone.”
Access to them is open, it is not verified by credentials (login, password, token). All you need to do is enter the link to the image correctly in the browser address bar. It is difficult to talk about any privacy when a properly configured resource scanner selects them.
In my opinion, this is a big mistake in the assumptions of the design of the HA application, which seems to be what the thread of this discussion originally indicates.
Notify.persistent_notification is available via credentials but cannot use custom attachments except in their open locations? Well, that’s bad.