Formatting persistent notification

  - service: notify.persistent_notification
    metadata: {}
    data:
      message: >
        {{ now().strftime("%H:%M:%S") ~ '\n' ~ states('sensor.temperature_and_humidity_alarm_humidity') ~ '%\n'}}
      title: veg_hum_on

I want the
sensor.temperature_and_humidity_alarm_humidity
displayed as bold text. Using ** around does not work.

title: veg_hum_on {{ now().strftime("%H:%M:%S")}} does work
but
title: {{ now().strftime("%H:%M:%S")}} veg_hum_on does not
(whole notification will not show up)

You need to quote single line templates that don’t start with strings (you should quote them too though). So:

title: "veg_hum_on {{ now().strftime('%H:%M:%S') }}"

or

title: "{{ now().strftime('%H:%M:%S') }} veg_hum_on"

1 Like

Try this:

      message: >
        {{ now().strftime("%H:%M:%S") ~ '\n <b>' ~ states('sensor.temperature_and_humidity_alarm_humidity') ~ '</b> %\n'}}
1 Like

The title can not be formatted?

You can format persistent notifications with html.

You didn’t ask for it to be. You only asked for: