I created an automation that creates a “persistent notification”, and then created a “template sensor” for the attribute > message as below, but the sensor displays “none” on the frontend, instead of the message, any ideas?
If I test the template in the dev tools, it displays the message as intended.
value_template: "{{ state_attr('persistent_notification.pri_msg', 'message') }}"
Works for me with your template.
1 Like
Mine still show none, I have no idea what the issue could be.
Do you know if states is limited to a certain number of characters?, I’m thinking my message may be too long.
Maximum is 255 characters, i think.
That’s what I thought, I reduced the message to test and it worked.
Thanks for all your assistance.
Any idea what other means I can use to display the full message on the frontpage?
I think this is something for @thomasloven’s useful-markdown-card.
You can fill it directly with the attribute from the notification without a sensor.
Played a bit, works!
- type: vertical-stack
cards:
- type: conditional
conditions:
- entity: persistent_notification.myha_tpad_os_updates
state: 'notifying'
card:
type: custom:useful-markdown-card
title: Notification
content: >
[[ persistent_notification.myha_tpad_os_updates.attributes.title ]]
[[ persistent_notification.myha_tpad_os_updates.attributes.message ]]
![Auswahl_194](https://community-assets.home-assistant.io/original/3X/f/5/f54f29892d9a9f92027654fa60f1beeb9f546e25.png)