Coding Stephan

Sonos goodness

I’m a big fan of the sonos devices, but I’m not a big fan of the Sonos app (mac/windows/android/ios), it just isn’t that good. At least the following points should be fixed before I would consider changing my mind:

  1. Android/iOS -> Alarm settings are hidden to far in the application. (two clicks, a long scroll and another click).
  2. Slowly startup, they do device discovery even though all my speakers have a semi-static (dhcp reservation) ip.
  3. The playbar should rejoin the previous group after watching tv.
  4. Memory usage on mac
  5. No integration with other systems

Fix it myself

I decided it was time to do something about it, so I’ve developed several packages to make my Sonos experience better. Checkout the following libraries and send me a message on twitter if you like them.

node-sonos-ts (library)

node-sonos-ts is a library (written in typescript) that allows every developer to control the sonos speakers in the local network from node and typescript applications. Some really nice features are Automatically group updates, events, notifications, text-to-speech (see below). These features can be used by any developer using this library. The main services are automatically generated by a service generator, so this library should support everything the official app supports.

sonos2mqtt (control sonos from mqtt)

sonos2mqtt is a small app to link your local sonos system to a mqtt server. This is mostly used by smarthome enthusiasts like me. It depends completely on the functionality provided by the node-sonos-ts library. If you use this library a lot of the events from the sonos speaker are send to the mqtt server. And you can control the speakers by sending specific messages to the mqtt server. It can be run on a raspberry pi or even on your nas in a docker container.

node-sonos-tts (text-to-speech server)

node-sonos-tts-polly is a small server that is a (required) addition to the node-sonos-ts library to provide text-to-speech support. The library sends a request to this server to get the url for some text. It calls amazon polly to generate a mp3 based on the provided text. This mp3 file is then send to the sonos device to get played. The result, text based announcements on your speakers. My sponsors get access to my private hosted version of this server.

sonos-cli (command line interface)

sonos-cli is a command line application to control your sonos speakers right from the console. Current status is experimental, but I’m accepting PR’s and you can use it for a lot of stuff already. sonos control office next is one of my favorites.

Contribute or sponsor

Building this library and the applications cost a lot of time, I do this because I enjoy making my own smarthome better. I’m experimenting with the Github sponsor program to see if people are willing to sponsor me to continue developing open-source stuff. It would also be nice to have some other developers helping out, by contributing code or ideas or by writing documentation.