/songblocks

A python script to remotely control a Sonos music player with NFC tags. Based on

Primary LanguagePython

songblocks

Photos

A python script to remotely control a Sonos music player with NFC tags. Based on Songblocks.

I had to rewrite shawnrk's code as enough had changed in the intervening 3 years that I couldn't get it working.

Changes:

  • added a config file (songblocks.ini)
  • added support for playing a Sonos playlist in addition to individual tracks
  • added Chromecast support (using pychromecast)
  • removed Twitter support
  • removed time-of-day restrict
  • removed track seek and volume control

I used the FTDI Serial TTL-232 USB Cable initially so I could work on my laptop. I haven't bothered switching to I2C or SPI on the Raspberry Pi as the USB cable works fine :) However If you kill the process while it's talking to the NFC board, the board gets wedged and you have to power cycle it (pull the USB cable and replug).

Installation (WIP)

  1. sudo apt install pip
  2. sudo pip install -r requirements.txt
  3. $EDITOR songblocks.ini
    • set the player_name to the Sonos device you want to control
    • set the nfc_device_path as per nfcpy docs
  4. python songblocks.py

Hardware

Reader

Blocks

Tools

  • soldering iron + solder (to solder headers to PN532 board)
  • 1/2" and 1-1/8" Forstner drill bits (drill slots for magnets/tags in blocks and drawer)
  • cordless drill
  • dual edge pullsaw (cut 2x4 into kid-size blocks)
  • wood glue
  • sandpaper
  • various clamps