Allow templating in in actionable notifications

Hey guys,

It would be good to be able to use templates in actionable notifications, so that only one action is sent depending on the state of a device.

For example, I can create a notification with a message that sends me the state of a temperature sensor and the state of the heating switch. It would be good to only send the action that is relevant, so if the heating is currently on, send a “heating off” action and vice versa.

The message attribute supports templates, it would be good if the action and title also supported it.

I tried this for example:

    - action: "heating_{{states.switch.heating.state}}"
      title: "Heating {{states.switch.heating.state}}"
message: >-
  The temp is {{ states.sensor.living_room_temperature.state }} and the heating
  is {{ "on" if is_state("switch.heating", "on") else "off" }}

But this just sends the notification literally i.e heating_{{states.switch.heating.state}} appears in the button.

I tried also using {% if states… %} also which gives the same result.

Hope that makes sense!

Are you sure you can not use “data_template” for this?
I have not tested it in “actions” but it works in other parts of the notification config:

    - service: notify.mobile_app
        title: "{{ }}"
        message: "{{ }}"

According to my testing, the action parameter supports templating, but the title parameter does not. @Olen’s proposal is related to a simple message notify, where templating can obviously be used for title and message paramter.

Even if it’s an old discussion I would like to add my request to the same topic. Background: I would like to build a dynamic menu to control many switches in an irrigation system. The title is supposed to inform about the current state and offers toggling.

Therefore, I would be glad as well, if also the title parameter supports templating in actionable notifications.