[Solved] Need help with my template

I can’t get what not let this automation works. If I manually name the media_content_id it has no problem.

{{ trigger.event.data.name }} should be a valid template according to the docs

What I’m trying to achieve here is to play the playlist that has the same name of the nfc tag that triggered the automation, is that possible?

triggers:
  - trigger: event
    event_type: tag_scanned
conditions: []
actions:
  - action: input_select.select_option
    metadata: {}
    data:
      option: MPD
    target:
      entity_id: input_select.audio_source
  - action: media_player.play_media
    metadata: {}
    data:
      media:
        media_content_id: {{ trigger.event.data.name }}
        media_content_type: playlist
    target:
      device_id: e7d51a9d40b8cf1c8dad28ed5ac05fb1
mode: single

Wrap the template in quotes.

      media:
        media_content_id: '{{ trigger.event.data.name }}'
1 Like

I feel so dumb right now, thank you 123

1 Like