node-sonos: Stuck Searching for Sonos devices on network...

So I started by trying to use the airsonos app, but it just gets stuck at

Searching for Sonos devices on network...

I’ve documented it more closely here https://github.com/stephen/airsonos/issues/135 I’ve not had any success finding anyone who can help guide me through debugging but it was suggested that someone here may know enough to help.

To summarise, I’ve got these installed:

sudo n 0.10.36
sudo npm install -g airsonos
sudo n 0.12.0
n use 0.10.36 /usr/local/bin/airsonos

Airsonos project uses this projects sonos.LogicalDevice.search feature to locate devices on the network, and its this bit thats not working for me. I really don’t know anything about node.js so I’m poking around in the dark here, but so far I’ve:

  • ensured that I’m not running a firewall
  • i have great connection with the sonos device
  • the sonos app can actually find and control the device

I’m not sure what to do to make any progress with this, but I’m really keen to be able to send music to my Sonos speaker without using the main app. I’ve just installed node-inspector and I’m trying to debug and step through the code but I’m really not sure what I’m looking for.

Any help would be great thanks…

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 41 (17 by maintainers)

Most upvoted comments

I hit the exact same issue today and I have a workaround/fix. It would need someone with more knowledge of how it all works to figure out why it works in some environments and not in others. My basic understanding is that the default broadcast that is used to search for Sonos devices fails. I have a theory that it might be due to the broadcast address being invalid.

Anyway if you located the following in the sonos.js file:

this.socket.bind(function() { _this.socket.setBroadcast(true); _this.socket.send(PLAYER_SEARCH, 0, PLAYER_SEARCH.length, 1900, ‘239.255.255.250’); });

and replace it with the broadcast address for your network, in my case it was 192.168.0.255, therefore it looks like:

this.socket.bind(function() { _this.socket.setBroadcast(true); _this.socket.send(PLAYER_SEARCH, 0, PLAYER_SEARCH.length, 1900, “192.168.0.255”); });

This should allow you to discover the devices automatically on the network segment.