maddox / magic-cards

🎩 Queue music, play movies, or trigger events with RFID cards.
MIT License
566 stars 49 forks source link

Command for card to STOP playing in Home assistant #70

Open novitibo opened 4 years ago

novitibo commented 4 years ago

Hi, Is there a way to refer one card to send to home assistant command to stop playing: action:

What should be the trigger? tnx

tmanternach commented 4 years ago

I have a "next" card that I use, should work in a very similar way.

My card in magic-cards is Action: "Home Assistant" and the URI is just "next" (without quotes).

In Home Assistant, I have an Automation with a trigger type of Event. Event type is "magic_card_scanned". The event data is:

{ "card_type": "event", "card_uri": "next" }

The Action for this automation is pretty straight forward, but this is where yours would start to differ. My action type is "Call service", Service is "media_player.media_next_track. Service data is:

{ "entity_id": "media_player.spotify" }

I think you want "media_player.media_stop" for your Service. I hope this helps!