Having problem creating an automation which reads the data from the scanned card and pass it on to media_player.spotify_poras_chaudhary to play the relevant song from Spotify URI.
I’m running the Magic Cards Project on a raspberry pi and using an RFID card scanner to scan the cards.
When I scan a card I get the following data in the “magic_card_scanned” event -
Whoever is seeing this please leave a comment so that I can post in this thread after some time to keep it alive. Home Assistant community is not what it used to be anymore. A lot of threads go uncommented and problems go unsolved. Please support!
Well, there are people that read your message, but not everyone can help with your case. I also want to enable playing spotify playlist on Sonos but by pressing a button as trigger. So far still searching
I’m not familiar with the Magic Cards process, but did find the following article on the GitHhub Magic Cards docs page on how to setup an automation once a card is scanned.
automation:
- alias: Play favorite from Magic Cards
trigger:
- platform: event
event_type: magic_card_scanned
event_data:
card_type: album
action:
- service: media_player.select_source
data_template:
entity_id: "media_player.{{ trigger.event.data.card_uri.split('|')[0] }}"
source: "{{ trigger.event.data.card_uri.split('|')[1] }}"
Something seems off about the trigger.event.data.card_uri.split lines in that example though. I don’t think there is an entity_id: value in the card_uri value of the data block. The source: value looks solid, as it is returning the the spotify URI value to select. You may have to reach out to the Magic Cards doc for an updated example.
cool. I’ve been playing around with this, as I was curious about event types. As it turns out, you can use the Events tab of developer tools to fire simulated events. So I setup the following: