How to use attribute value in a message?

Hello, can someone please help me to include attribute value in a message? The message is like:

action:
  - service: notify.jan_b
    data:
      message: Block nr. mined

and after nr. I would like to insert attribute

    entity_id: sensor.btc_blocks_last
    attribute: height

How to do it please?

This is done with templating. You’ll want to use something like this:

{{ state_attr('sensor.btc_blocks_last', 'height') }}
action:
  - service: notify.jan_b
    data:
      message: "Block nr. {{ state_attr('sensor.btc_blocks_last', 'height') }} mined"
1 Like

Right, typed too quick. Thanks for the correction.