SonosRemote - A remote for Sonos installations running on an ESP8266 and using Sonos HTTP API

As I finally have fiddled something together myself that fits in this category... :wink:

I built a little something over the course of the last evenings to solve a problem I was having: A little remote control for my Sonos installation. ESP8266 in the shape of a Wemos D1 Mini, rotary encoder, Micropython (which I finally wanted to try out), Sonos HTTP API and a 3d printer for the case parts = win :sunglasses:

It's not much to look at, but it makes volume changes, play/pause toggling and track switches so bloody convenient. And I dimensioned it so I should hopefully also be able to build a waterproof-ish version to mount high up in the shower since it should fit run-of-the-mill rubber o-rings (in that case though I'll do the powering not through the exposed micro usb plug but rather a sealed in cable).

I've thrown firmware & STLs up on github here:

Should be enough documentation in the README to build one yourself if you need to :wink:

3 Likes

Really nice...and of course in python :slight_smile:
Inspired by Prusa?

I am also switching my ESP-Projects to micropython. One reason is that thread-handling is much easier. E.g. "breathing" led and listing for other events

C ya,
Olli

Nope. By my parts bin :wink:

1 Like

You might try wirelessly charging it. Those pairs are readily available these days.

Then I'd have to figure out how to make THAT waterproof however. Putting a rubber seal into a hole and threading a cable through (potentially with some silicone around if the fit isn't yet perfect) should be easier :wink:

"Easier...", said the geek... Neveh! :laughing:

Hi,
I'm completely new to Microphython and those http-APIs, so it might be a dumb question but I hope to get help anyway:

wifi_hostname = "sonos-remote-someroom" 
sonos_base = "http://sonosapi.example.com"
sonos_room = "some-room"
sonos_volume_step = 5

pin_rotary_clk = 12
pin_rotary_dt = 13
pin_rotary_sw = 14

syslog_enable = False
syslog_host = "syslog.example.com"

This is a part of foosel's code but I do not understand what I need to put in the "..." for the following lines:

wifi_hostname = "sonos-remote-someroom"
sonos_base = "http://sonosapi.example.com"
sonos_room = "some-room"
syslog_host = "syslog.example.com"

I would think, that for <sonos_base> I need to put in the address from the api like this "http://localhost:5005/" like it is written on this page: https://jishi.github.io/node-sonos-http-api/

But what do I need to put in for the rest? I have one Sonos Player in my "living room" or "Wohnzimmer" in my language.

In your case that will probably look somewhat like this:

wifi_hostname = "sonos-remote-wohnzimmer" 
sonos_base = "http://<ip of sonosapi>:5005"
sonos_room = "Wohnzimmer"
syslog_host = "<ip of syslog host>"

You can also just leave syslog_enable at False and ignore syslog_host. <ip of sonosapi> needs to be the IP of your Sonos API installation that's reachable from other devices on your LAN. Putting 127.0.0.1 won't work here, as that would make the ESP assume Sonos API is installed on itself, which doesn't make a whole lot of sense.

wifi-hostname is simply the hostname the ESP will assign to itself. Depending on your router configuration that will make the ESP available as something like sonos-remote-someroom.lan in the example above.

If you are unsure about what a room is called in Sonos API, take a look at http://<ip of sonosapi>:5005/zones.

Thanks, I will test it.

BTW, nice work, I'm using octoprint a while and it is so great to have it.