Skip to content

Instantly share code, notes, and snippets.

@luka6000
Last active January 1, 2026 18:48
Show Gist options
  • Select an option

  • Save luka6000/ec6406e44de3dff082dd7e22cedcff93 to your computer and use it in GitHub Desktop.

Select an option

Save luka6000/ec6406e44de3dff082dd7e22cedcff93 to your computer and use it in GitHub Desktop.
2023.8 breaking change needs upcase to work
blueprint:
name: Play Music Tag
description: Play music tag NDEF url
domain: automation
input:
reader_id:
name: ESPHome NFC reader device
description: This is your NFC reader
selector:
device:
integration: esphome
player:
name: Media Player
description: This is your media player for this reader
selector:
entity:
domain: media_player
variables:
device_id: !input reader_id
reader: '{{ device_attr(device_id, "name") }}'
trigger:
- platform: event
event_type: esphome.music_tag
condition:
- condition: template
value_template: '{{ (trigger.event.data.reader |upper) == (reader |upper) }}'
action:
- service: media_player.media_stop
target:
entity_id: !input player
- choose:
- conditions:
- condition: template
value_template: '{{ trigger.event.data.source == "sonos" }}'
sequence:
- service: media_player.select_source
data:
source: '{{ trigger.event.data.info }}'
target:
entity_id: !input player
default:
- service: media_player.play_media
data:
media_content_type: music
media_content_id: '{{ trigger.event.data.url }}'
target:
entity_id: !input player
mode: queued
max: 10
@cubertt
Copy link

cubertt commented Oct 14, 2022

Please delete line 12, (manufacturer: espressif). Great blueprint thanks!

@luka6000
Copy link
Author

Please delete line 12, (manufacturer: espressif). Great blueprint thanks!

ok

@PixelJonas
Copy link

With 2023.8.1 I had a bug, that the name of my tagreader was capitalized which broke the tagreader. I changed #28 to the following to make it case-insesitive:

    value_template: "{{ (trigger.event.data.reader | upper) == (reader | upper) }}"

@luka6000
Copy link
Author

With 2023.8.1 I had a bug, that the name of my tagreader was capitalized which broke the tagreader. I changed #28 to the following to make it case-insesitive:

    value_template: "{{ (trigger.event.data.reader | upper) == (reader | upper) }}"

thanks, works like a charm 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment