Skip to content
This repository was archived by the owner on Jun 4, 2023. It is now read-only.

Fails to discover Sonos devices #79

Open
teamplayon opened this issue Dec 2, 2014 · 9 comments
Open

Fails to discover Sonos devices #79

teamplayon opened this issue Dec 2, 2014 · 9 comments

Comments

@teamplayon
Copy link

I have two PC's. Running it on one works great. On the other, it is failing to discover Sonos components. Here is the log of the diagnostic run below...it stays stuck there forever. Any idea what might be going on? Is there any pre-requisite besides Bonjour SDK? Maybe iTunes or some other Apple product? The PC that has the issue is pretty barebones Windows 7 with almost no other software installed on it (other than the stated prerequisites for AirSonos).

C:\Users\Jeff>airsonos --diagnostics
AirSonos Diagnostics
node version v0.10.33
operating sys win32 (ia32)

Searching for Sonos devices on network...

@teamplayon
Copy link
Author

Some additional info on this. When I run airsonos from the command line, and sniff the resulting traffic, I am seeing no M-SEARCH request make it out. On the flip side, if I run "Device Spy" on the same PC, it's M-SEARCH requests get out, and it discovers all Sonos devices on the network. So it is not a networking issue. For some reason, airsonos is failing to make the requests. Any idea how to troubleshoot further, besides posting the command output when running in diagnostic mode (as displayed in the OP)?

@stephen
Copy link
Owner

stephen commented Dec 3, 2014

@playonjeff - grasping here, is it possible that it's being blocked by Windows' firewall?

The Sonos-side networking is handled by one of the package dependencies: https://github.com/bencevans/node-sonos

@teamplayon
Copy link
Author

I checked the Windows Firewall theory...and actually totally disabled the service, to be extra double dog sure that was not it.

I installed the prebuilt AirSonos Windows package from here:

#59

That was done after installing nodejs (32 bit) and the Bonjour SDK

Shouldn’t that include everything necessary?

@stephen
Copy link
Owner

stephen commented Dec 3, 2014

Gotcha. Sorry, what I meant to say was that the networking code in question here isn't directly handled by the airsonos project, but rather, one of the dependencies (node-sonos). You're right in that it's directly included by the pre-built airsonos package.

Will look more into what that package is doing and see if I can come up with better theories for why this isn't going through. Can you clarify what device-spy is, when you're looking at the traffic? (I'm not much of a Windows user)

@teamplayon
Copy link
Author

Device Spy is an Intel developed diagnostic tool for UPnP:

https://software.intel.com/en-us/articles/intel-tools-for-upnp-technologies

Here is a prebuilt version in a zip file. Just extract it on Windows, run it, and it will show all detected running UPnP devices on the LAN, and allow youto invoke actions on them, etc.

www.playon.tv/online/DeviceSpy.zip http://www.playon.tv/online/DeviceSpy.zip

From: Stephen Wan [mailto:notifications@github.com]
Sent: Wednesday, December 03, 2014 5:40 PM
To: stephen/airsonos
Cc: playonjeff
Subject: Re: [airsonos] Fails to discover Sonos devices (#79)

Gotcha. Sorry, what I meant to say was that the networking code in question here isn't directly handled by the airsonos project, but rather, one of the dependencies (node-sonos). You're right in that it's directly included by the pre-built airsonos package.
Will look more into what that package is doing and see if I can come up with better theories for why this isn't going through. Can you clarify what device-spy is, when you're looking at the traffic? (I'm not much of a Windows user)

Reply to this email directly or view it on GitHub #79 (comment) .

@rhpijnacker
Copy link

Hi, I'm seeing a similar issue on a MacBook air. Funny thing is that in my home network it works correctly, but on my girlfriends home network it never finds her Sonos.

@iona5
Copy link

iona5 commented Jan 10, 2015

i have the same problem. When i start airsonos it fails to discover any sonos devices in about 3 of 4 startups. on my computer (Windows 8) the problem is exactly the same: The M-SEARCH is not being sent.

i guess that has something to do with the packet being broadcasted but i couldn't figure that out.

as the IP of my sonos is fixed, my workaround was to hack the IP into Search() of the sonos package, so it basically does no discovery at all but simply emits a "DeviceAvailable" event with a hard-coded IP.

var Search = function Search() {

  var _this = this;

  setTimeout(function() {
    _this.emit('DeviceAvailable', new Sonos('192.168.0.100'), "MySonos");
  }, 1000);

  return this;
};

i am thinking of putting together something that this can be exposed to the commandline like

node airsonos --devices 192.168.0.100,192.168.0.101:1401

which disables the discovery part and simply tries to setup the given devices from the list.

Edit: created pull request #88 for this

@teamplayon
Copy link
Author

Interesting...exactly what file/location did you make that change to? What would be the code to add multiple IPs (for multiple sonos units)?

From: iona5 [mailto:notifications@github.com]
Sent: Saturday, January 10, 2015 6:40 AM
To: stephen/airsonos
Cc: playonjeff
Subject: Re: [airsonos] Fails to discover Sonos devices (#79)

i have the same problem. When i start airsonos it fails to discover any sonos devices in about 3 of 4 startups. on my computer (Windows 8) the problem is exactly the same: The M-SEARCH is not being sent.
i guess that has something to do with the packet being broadcasted but i couldn't figure that out.
as the IP of my sonos is fixed, my workaround was to hack the IP into Search() of the sonos package, so it basically does no discovery at all but simply emits a "DeviceAvailable" event with a hard-coded IP.
var Search = function Search() {

var _this = this;

setTimeout(function() {
_this.emit('DeviceAvailable', new Sonos('192.168.0.100'), "MySonos");
}, 1000);

return this;
};
i am thinking of putting together something that this can be exposed to the commandline like
node airsonos --devices 192.168.0.100,192.168.0.101:1401
which disables the discovery part and simply tries to setup the given devices from the list.

Reply to this email directly or view it on GitHub #79 (comment) .

@iona5
Copy link

iona5 commented Jan 10, 2015

the mentioned hack replaces the lines 722-754 in node_modules/sonos/lib/sonos.js.

you should be able to register multiple IPs with

var Search = function Search() {

  var _this = this;

  setTimeout(function() {
    _this.emit('DeviceAvailable', new Sonos('192.168.0.100'), "MySonos");
    _this.emit('DeviceAvailable', new Sonos('192.168.0.101'), "MySonos");
    // ... etc...
  }, 1000);

  return this;
};

that should work, but i have no way to test this.

anyway i already created a pull request for doing this with command line arguments, see #88 .

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants