Control Sonos with a Spark (spark.io)
This is a little projekt to get my Spark control a Sonos speaker in the local network. There is no real error handling so far and it is not too well tested, but seems to work ;)
The idea is to control sonos with switches mounted on the wall like light switches. A friend of mine is working on the hardware, below pictures of its current progress. As you can see this module includes some LEDs which can be used to indicate the mute status of a speaker or something somiliar.
- Get Volume (Values from 0 to 100)
- Get Mute - Status (1 or 0)
- Set the Volume (Values from 0 to 100)
- Set Mute (0 or 1)
- Parse the Topology (returned by GET /status/topology)
- Find the group Master and then:
- Play / Pause
- Previous / Next
- ...
- Shuffle through the favorite Radio stations
To debug the functionality the Application will open a serial console and listen for keystrokes.
Here what will/shall happen:
- A: set the ip to Sonos A
- B: set the ip to Sonos B
- M: Toggle Mute for the selected Sonos
- U: Increase Volume for the selected Sonos
- J: Decrease Volume for the selected Sonos
The following little shell script keeps a screen ready as soon as /dev/tty.usbmodemXXXXX becomes available.
while true; do [ -e /dev/tty.usbmodemfa2121 ] && screen -h 500 /dev/tty.usbmodemfa2121 ; sleep 5; reset; echo "No tty available"; done