Extract automation trigger into notification

I have an automation that sends the following notification:

metadata: {}
data:
  title: Solar
  message: >
    "JK BMS alert detected for {{ trigger.entity_id }}, alert value: {{
    trigger.to_state }}"
action: persistent_notification.create

The trigger.to_state has the following value:

 <state sensor.jk_bms_errors=Cell Overvoltage; icon=mdi:alert-circle-outline, friendly_name=jk-bms errors @ 2024-08-20T18:55:35.682508+01:00>"

I want it to only display Cell Overvoltage from the value above.
What is the correct syntax to use in the notification, trigger.to_state displays the whole value which is not what I want.

Hi d_dracula,

Try trigger.to_state.state maybe.

1 Like

Will try it out and see how it goes, thanks

1 Like