This optional section concerns the interest of locally controlling music launch with NFC/objects. It is complementary to the possibility of installing the server part (1) on a Raspberry Pi, as discussed in the previous section.
We assume that a fresh Raspbian installation has been completed beforehand.
#Prepare Raspberry
sudo apt-get update
sudo apt-get upgrade
# Python
sudo apt-get install python3 python3-pip git python3-dev python3-pip build-essential libssl-dev libffi-dev libxml2-dev libxslt1-dev zlib1g-dev liblircclient-dev lirc
sudo python3 -m pip install --upgrade pip
# NFC
sudo apt-get install gcc swig pcsc-tools pcscd autoconf libtool libpcsclite-dev libusb-dev
# nfc tags
sudo python3 -m pip install pyscard
sudo nano /etc/modprobe.d/blacklist-libnfc.conf
blacklist nfc
blacklist pn533
blacklist pn533_usb
sudo modprobe -r pn533_usb
sudo modprobe -r pn533
sudo apt-get install csh gawk libblkid-dev libffi-dev libfl2 libglib2.0-bin libglib2.0-dev libglib2.0-dev-bin liblzma-dev libmount-dev libpcre16-3 libpcre3-dev libpcre32-3 libpcrecpp0v5 libselinux1-dev libsepol1-dev uuid-dev git binutils make csh g++ sed gawk autoconf automake autotools-dev libglib2.0-dev liblzma-dev libtool
git clone <https://github.com/jpwidera/libnfc.git>
cd libnfc
autoreconf -is
./configure --prefix=/usr --sysconfdir=/etc
make
sudo make install
cd /usr/lib
sudo cp -p libnfc.* arm-linux-gnueabihf/
sudo cp -p libnfc.* i386-linux-gnu/
#For testing your readers and your install :
sudo nfc-scan-device -v
#<https://www.latelierdugeek.fr/2019/09/30/acr122u-resoudre-lerreur-unable-to-set-alternate-setting-on-usb-interface/>
#configuration o2m_nfc
git clone [email protected]:object2music/o2m_nfc.git
cd o2m_nfc
sudo vi nfc.conf #if needed
#autorun o2m_nfc
sudo cp o2m_nfc.service /lib/systemd/system/o2m_nfc.service
sudo chmod 644 /lib/systemd/system/o2m_nfc.service
sudo vi lib/systemd/system/o2m_nfc.service #if needed
sudo systemctl enable o2m_nfc.service
sudo systemctl start o2m_nfc.service
The configuration file nfc.conf should specify the url and port from o2m api.
sudo apt-get install lirc
sudo cp samples/lirc/lirc_options.conf.dist /etc/lirc/lirc_options.conf
sudo cp samples/lirc/lircrc /etc/lirc/lircrc
sudo cp samples/lirc/irexec.service /lib/systemd/system/irexec.service
sudo systemctl enable lircd.service
Push as well as environement variables the folowing : MPD_HOST and MPD_PORT for connection to o2m/mopidy server (if not added to irexec.service file vim /lib/systemd/system/irexec.service)
export MPD_HOST=http://server_ip
export MPD_PORT=6600
Install snapclient following the procedure : https://github.com/skalavala/Multi-Room-Audio-Centralized-Audio-for-Home/blob/master/Install Snapcast Client.md
Add the snapserver address in the conf file :
sudo vim /etc/default/snapclient
SNAPCLIENT_OPTS = “-h [server_ip](<http://163.172.187.21/>)” #without http:// and default port 1780