Is there any way to have a multi-line message in the Persistent Notification card? I have tried using the new line character \n but it is interpreted by HA as a space and everything is still displayed on a single line message.
The new line character is \n
Does that make a difference?
Sorry, that was a mistype on my part, I meant to type \n in this post. It does not work and is seen as a space by HA.
Tried, does not work.
Yeah, that doesn’t work either. In a YAML file it would seem to work, but if I’m not mistaken, all of your YAML data is turned into JSON in the backend, so ultimately I thinking this is a bug in HA that needs to be fixed in the code itself to look for either the YAML literal or the \n character and interpret it correctly before being displayed.
This is frustrating because without this simple, and what I consider a basic necessity feature for a message card, the Persistent Notifications become rather useless other than for a simple one line piece of info.
Did you find a solution?
I tried the suggestion from @sffjunkie and it works for my telegram bot
action:
- service: notify.notification_telegram
data:
message: |
Welcome to the Telegram bot!
Test, second line.
Test, third line.
Nice.
It seems to work for SMTP, but unfortunately not when including images.
You can try <br>
{{ '\n' -}}
That works, thanks!
I just found this thread while trying to use new lines in my Anrdoid notifications. I had tried the |
method and it didn’t work, I tried the '\n'
method and it also didn’t work, even with templating! However, the <br>
suggestion works like a charm! I guess that Android uses HTML for their notification rendering.
Thank you for this post @Dejvic
Out of everything above, this was the only one that worked for my Android notification with the Home Assistant app, thanks!
Can confirm another success here as well! Thanks everyone