Hover + Spark = Sonos Remote

I finally put my hover board to good use! I modified some code for an arduino IR remote for the Sonos.

Its working intermittently at the moment, but it does work… no red flash or anything, but there are some huge delays when printing to the client and then i need to restart the core to make it work again. i think its to do with the TCPclient slowing down thing… there is currently a function ->

void out(const char *s) {
#ifdef DEBUG

how can i change it to a client.write easily? i don’t understand enough about the cont char* to work out how to get its length…

My Modified code here (uses hover library)

The original code here


Try this:

void out(const char *s) {
    client.write( (const uint8_t*)s, strlen(s) );

Thanks @bko, ill give it a go when i get home tonight.

I managed to get it working 99% by adding the magic delays between each client.println but would rather not use that approach!

Edit: decided to give it a quick go… even though i should be packing!

Needed to do a println after as it doesnt have the carriage return any more. and now the carriage return takes forever and doesnt work… any quick way to add a /r/n to “s” before doing the write?

Edit 2: WOW what a difference using write makes! its near instant control…
not sure where my brain was earlier… maybe trying to pack and programming at the same time isn’t possible by men? im a little embarrassed by the question above… oh well… its working perfect now!

Added a display and a big battery today :slight_smile: now to figure out how to retrieve song title to display on the screen


Here is a little video showing it working


Awesome! I was hoping to hookup something as a sonos remote at home as well, thanks for sharing! :slight_smile:


This is so great @Hootie81!

When I get the photon I will try and upgrade to show cover art, song/station name and all the other good bits of info on the digole display.

I have just started breaking the sonos part off into a library so anyone can use it with any type of input… like a touch screen display, buttons or capacitive touch sensors.

just trying to work out how to get now playing info :slight_smile:

Are you able to “Get Favorites” from your Sonos devices (or have you tried). I structured the command properly (tested with Fiddler). But the FV:2 command doesn’t return the entire envelope, only a portion. If you can successfully read the entire returned SOAP message, I’d love to see the code you used to do so.

I have noticed that some times the response is truncated… ill try and work it out sometime this week.

Then is it this that is happening?

Yep, i cant figure out why, maybe a buffer thing. the first part of the reply comes back but it is truncated so then the code gets confused. ill spend a bit more time on it tomorrow.


Have you made any progress receiving the longer responses? I believe I’ve tried every solution and example provided for reading data with TCPClient() on these forums. I can not get it to work for the longer messages…

Any suggestions would be appreciated.


I couldn’t work it out either… I’ll try and have more of a dig in the code next week. I think the cores buffer is filling up and then it gets truncated. I wonder I’d a spark.process just before the call would help clear anything already in the buffer