Open TefaTBob opened 6 years ago
@bencevans Is this a sonos-cli issue, or something in the way I have node setup?
I'm getting the same here. Shall take a look.
Were all your devices grouped? Think it's an issue where when all devices are in a single group the object returned from node-sonos is an object rather than array.
@bencevans Not all the devices are in a single group, but rather 4 of 5 different groups. (I've been using this in my office)
Hmmm, what version of firmware have you got on the devices? There's been some major breaking changes with Sonos v9.1.
All speakers are now on 9.2 (build 46357250), but CLI has been broken for me from 9.1 yeah.
I've pushed up a couple of fixes that's sorted things here but I think the issues I was having differ from your own. Could you npm i -g sonos-cli && sonos list-zones
and see if that works?
There's still issues with play functionality but tracking that in #20
Same issue still:
DEBUG=sonos* sonos list-zones
sonos:main Sonos.GetAllGroups() +0ms
sonos:service Service._request("GetZoneGroupState" {}) +0ms
(node:6227) UnhandledPromiseRejectionWarning: StatusCodeError: 500 - "<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">
@svrooij wondering if you might have any ideas here... Sonos.GetAllGroups()
is throwing a UPnPError 500
. It seems to be working fine for my setup. Both myself and @TefaTBob are on Sonos Firmware 9.2.
I get this:
bash-3.2$ DEBUG=sonos* sonos-cli list-zones
sonos:main Sonos.GetAllGroups() +0ms
sonos:service Service._request("GetZoneGroupState" {}) +0ms
sonos:helpers Helpers.ParseXml "<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"><s:Body><u:GetZoneGroupStateResponse xmlns:u=\"urn:schemas-upnp-org:service:ZoneGroupTopology:1\"><ZoneGroupState><ZoneGroups><ZoneGroup Coordinator="RINCON_000E58REDACTED" ID="RINCON_000E58REDACTED:3557387302"><ZoneGroupMember UUID="RINCON_000E58REDACTED" Location="http://10.0.10.81:1400/xml/device_description.xml" ZoneName="Tanzsaal" Icon="x-rincon-roomicon:living" Configuration="1" SoftwareVersion="47.2-59120" MinCompatibleVersion="46.0-00000" LegacyCompatibleVersion="36.0-00000" BootSeq="21" TVConfigurationError="0" HdmiCecAvailable="0" WirelessMode="1" WirelessLeafOnly="0" HasConfiguredSSID="1" ChannelFreq="2462" BehindWifiExtender="0" WifiEnabled="1" Orientation="0" RoomCalibrationState="4" SecureRegState="3" VoiceState="0" AirPlayEnabled="0" IdleState="0"/></ZoneGroup></ZoneGroups></ZoneGroupState></u:GetZoneGroupStateResponse></s:Body></s:Envelope>" +0ms
sonos:service Parsed service response as JSON
sonos:service {
"s:Envelope": {
"xmlns:s": "http://schemas.xmlsoap.org/soap/envelope/",
"s:encodingStyle": "http://schemas.xmlsoap.org/soap/encoding/",
"s:Body": {
"u:GetZoneGroupStateResponse": {
"xmlns:u": "urn:schemas-upnp-org:service:ZoneGroupTopology:1",
"ZoneGroupState": "<ZoneGroups><ZoneGroup Coordinator=\"RINCON_000E58REDACTED\" ID=\"RINCON_000E58REDACTED:3557387302\"><ZoneGroupMember UUID=\"RINCON_000E58REDACTED\" Location=\"http://10.0.10.81:1400/xml/device_description.xml\" ZoneName=\"Tanzsaal\" Icon=\"x-rincon-roomicon:living\" Configuration=\"1\" SoftwareVersion=\"47.2-59120\" MinCompatibleVersion=\"46.0-00000\" LegacyCompatibleVersion=\"36.0-00000\" BootSeq=\"21\" TVConfigurationError=\"0\" HdmiCecAvailable=\"0\" WirelessMode=\"1\" WirelessLeafOnly=\"0\" HasConfiguredSSID=\"1\" ChannelFreq=\"2462\" BehindWifiExtender=\"0\" WifiEnabled=\"1\" Orientation=\"0\" RoomCalibrationState=\"4\" SecureRegState=\"3\" VoiceState=\"0\" AirPlayEnabled=\"0\" IdleState=\"0\"/></ZoneGroup></ZoneGroups>"
}
}
}
} +40ms
sonos:helpers Helpers.ParseXml "<ZoneGroups><ZoneGroup Coordinator=\"RINCON_000E58REDACTED\" ID=\"RINCON_000E58REDACTED:35573-87302\"><ZoneGroupMember UUID=\"RINCON_000E58REDACTED\" Location=\"http://10.0.10.81:1400/xml/device_description.xml\" ZoneName=\"Tanzsaal\" Icon=\"x-rincon-roomicon:living\" Configuration=\"1\" SoftwareVersion=\"47.2-59120\" MinCompatibleVersion=\"46.0-00000\" LegacyCompatibleVersion=\"36.0-00000\" BootSeq=\"21\" TVConfigurationError=\"0\" HdmiCecAvailable=\"0\" WirelessMode=\"1\" WirelessLeafOnly=\"0\" HasConfiguredSSID=\"1\" ChannelFreq=\"2462\" BehindWifiExtender=\"0\" WifiEnabled=\"1\" Orientation=\"0\" RoomCalibrationState=\"4\" SecureRegState=\"3\" VoiceState=\"0\" AirPlayEnabled=\"0\" IdleState=\"0\"/></ZoneGroup></ZoneGroups>" +7ms
RINCON_000E58REDACTED:3557387302
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
and list-devices then fails with:
(node:25463) UnhandledPromiseRejectionWarning: TypeError: group.ZoneGroupMember.forEach is not a function
at groups.forEach.group (/usr/local/lib/node_modules/sonos-cli/cmds/listDevices.js:4:29)
at Array.forEach (<anonymous>)
at initDevice.getAllGroups.then.groups (/usr/local/lib/node_modules/sonos-cli/cmds/listDevices.js:3:12)
at process._tickCallback (internal/process/next_tick.js:68:7)
@bencevans Any new luck here?
Will check tomorrow, how many zones/players do you guys have? Might also been solved by some pr months ago on the sonos lib. That forced all the responses to be arrays...
I believe about 16 Zones. It's an office.
@TefaTBob could you let us know what version of sonos
you're using?
$ npm ls -g --depth=1
The following shows that I'm using sonos@1.9.0
which is working successfully for me (4 zones)
βββ¬ sonos-cli@0.5.2
β βββ minimist@1.2.0
β βββ sonos@1.9.0
β βββ underscore@1.9.1
@bencevans
sonos-cli@0.5.2 βββ minimist@1.2.0 βββ sonos@1.9.0 βββ underscore@1.9.1
Appears to be the same
@bencevans Is there anything else you can think of for me to check on my side as to why this still isn't working for me?
@TefaTBob identifying what sort of device it's communicating with might be useful. If you're able to load up Wireshark, then following what the Sonos app does and see if you can find where the difference is between sonos-cli/node-sonos should identify the issue.
@bencevans I can see Wireshark recording an HTTP/1.1 500 Internal Server Error\r\n, as well as a UPnP: Error 501 around urn:schemas-upnp-org:control-1-0 in the response. I'll bribe someone on our NW team with beers and see if they can't help me understand what's going on. Maybe some port forwarding got changed. Will report back.
@TefaTBob comparing the request between that of the Sonos app and node-sonos will probably give the biggest insight to what's being passed to the device wrong.
Opening this back up as it doesn't seem to be resolved for me?
Here is my output from "DEBUG=sonos* sonos list-zones":
sonos:main Sonos.GetAllGroups() +0ms sonos:service Service._request("GetZoneGroupState" {}) +0ms (node:92743) UnhandledPromiseRejectionWarning: StatusCodeError: 500 - "<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">s:Client UPnPError <UPnPError xmlns=\"urn:schemas-upnp-org:control-1-0\">501 </s:Fault></s:Body></s:Envelope>"
at new StatusCodeError (/usr/local/lib/node_modules/sonos-cli/node_modules/request-promise-core/lib/errors.js:32:15)
at Request.plumbing.callback (/usr/local/lib/node_modules/sonos-cli/node_modules/request-promise-core/lib/plumbing.js:104:33)
at Request.RP$callback [as _callback] (/usr/local/lib/node_modules/sonos-cli/node_modules/request-promise-core/lib/plumbing.js:46:31)
at Request.self.callback (/usr/local/lib/node_modules/sonos-cli/node_modules/request/request.js:185:22)
at Request.emit (events.js:182:13)
at Request. (/usr/local/lib/node_modules/sonos-cli/node_modules/request/request.js:1161:10)
at Request.emit (events.js:182:13)
at IncomingMessage. (/usr/local/lib/node_modules/sonos-cli/node_modules/request/request.js:1083:12)
at Object.onceWrapper (events.js:273:13)
at IncomingMessage.emit (events.js:187:15)
(node:92743) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:92743) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.