Simple toggle NFC tag


I’m trying to scan NFC tags with my iPhone with the use of a web hook and activate one of my Sonos speakers and play music. This work rather well, but I would like when your rescan the tag that the music pauses, if one would scan again the music should start playing again. I tried this with two different automations. Should be like a toggle I think?

But can’t seem to get it to work… any suggestions for this?

In your service call for the media player use:

service: media_player.play_pause
entity_id: media_player.YOUR_SONOS

The key is in the ‘play_pause’.