Mopidy Discourse

Getting NFC tag to play spotify uri in mopidy

Hi everyone,

Just got my RPI3 + adafruit pn532 using UART and libnfc. Tags are readable.
Mopidy has also been installed and connected to spotify
have the latest jessie, python, pip, etc installed.

My next hurdle is now linking everything together.

This seemed to be the most promising, https://github.com/gefangenimnetz/mopidy-nfcread but I’m not sure however, what exactly to do beyond the provided instructions.

All I’d like to do is have an album play when i put the nfc tag to the reader. When I take it off, it stops playing. Similar to the faux vinyl concept here (https://github.com/orestis/fauxvinyl).

The questions are:

  1. What’s the best way to write the spotify uri to the nfc tag?
  2. once you place the nfc tag to the reader, how to execute the command to play that uri in mopidy?

major thank you in advance!!

someone HAS to know something here or can point me in the right direction.

If this is absolutely impossible, i’d appreciate you just telling me. thank you.

Regarding 2 above, you could use MPC, you’ll need to install it I think.
Sudo apt-get update
sudo apt-get install mpc

Have a look here for the page of how to use it.

Attach something like this to execute ‘config = mpc stop; mpc clear; mpc load “Your playlist here”;mpc play;’

Look here to see how I use it with a remote control, you need to scroll down 3/4 of the way.

@Steve_Lambert thanks so much for responding!

took a quick look at the links. very cool that you used a remote.

do you know how to get the nfc tag execute ‘config = mpc …’?

no one else here has any experience with NFC and MOPIDY?? @kingosticks @jodal I got a lot of help from responses you guys made in these forums.

I made my own RFID mopidy player. I used a csv file where I saved the uris and the card id’s. then I just read them and used python to command OS to play them with mpc (IIRC), but I am pretty sure that this is not the best way to do it.

EDIT: no, actually I checked and in the code I used python-mpd

Hey there, I’m actually planning on the exact same project and just stumbled upon your thread. Did you have success in connecting NFC and Spotify? I’m looking for any advice where to start.

I found Nfc-eventd, a NFC monitor daemon which is able to launch modules (libraries) on action (tag entered in field or left field) and is an add-on for libnfc. But I have no idea how to connect all that… :slight_smile:


Edit: the right syntax is

mpc config = mpc stop; mpc clear; mpc add [your spotify uri read from th nbc tag]; mpc play;

I will update the post as soon as I got my NFC reader and I found a way to execute the command on read.

1 Like

@max sorry just seeing this now. I actually paused on the project bc reading the tags alone crashed mopidy.
were you successful with getting everything to work?

Thanks!

@splifoner Hi, it’s been a long time for this post, but I found this extension, that control Mopidy via RFID tags (play/pause, add track, stop).
Maybe it helps you or anyone else.

There’s been a lot of talk of using tags for automations using Home Assistant in the last year or so. If you’re already using Home Assistant, that is probably the way to go.