sonos-cli icon indicating copy to clipboard operation
sonos-cli copied to clipboard

list-zones Not working with newest Sonos firmware 9.1

Open TefaTBob opened this issue 7 years ago • 19 comments

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:Body><s:Fault>s:ClientUPnPError<UPnPError xmlns="urn:schemas-upnp-org:control-1-0"><errorCode>501</errorCode></UPnPError></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.

TefaTBob avatar Sep 24 '18 15:09 TefaTBob

@bencevans Is this a sonos-cli issue, or something in the way I have node setup?

TefaTBob avatar Nov 05 '18 15:11 TefaTBob

I'm getting the same here. Shall take a look.

bencevans avatar Nov 05 '18 18:11 bencevans

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 avatar Nov 05 '18 18:11 bencevans

@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)

TefaTBob avatar Nov 05 '18 18:11 TefaTBob

Hmmm, what version of firmware have you got on the devices? There's been some major breaking changes with Sonos v9.1.

bencevans avatar Nov 05 '18 18:11 bencevans

All speakers are now on 9.2 (build 46357250), but CLI has been broken for me from 9.1 yeah.

TefaTBob avatar Nov 05 '18 18:11 TefaTBob

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

bencevans avatar Nov 05 '18 19:11 bencevans

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/"><s:Body><s:Fault>s:ClientUPnPError<UPnPError xmlns="urn:schemas-upnp-org:control-1-0"><errorCode>501</errorCode></UPnPError></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:6227) 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:6227) [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.

TefaTBob avatar Nov 05 '18 20:11 TefaTBob

@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.

bencevans avatar Nov 06 '18 14:11 bencevans

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>&lt;ZoneGroups&gt;&lt;ZoneGroup Coordinator=&quot;RINCON_000E58REDACTED&quot; ID=&quot;RINCON_000E58REDACTED:3557387302&quot;&gt;&lt;ZoneGroupMember UUID=&quot;RINCON_000E58REDACTED&quot; Location=&quot;http://10.0.10.81:1400/xml/device_description.xml&quot; ZoneName=&quot;Tanzsaal&quot; Icon=&quot;x-rincon-roomicon:living&quot; Configuration=&quot;1&quot; SoftwareVersion=&quot;47.2-59120&quot; MinCompatibleVersion=&quot;46.0-00000&quot; LegacyCompatibleVersion=&quot;36.0-00000&quot; BootSeq=&quot;21&quot; TVConfigurationError=&quot;0&quot; HdmiCecAvailable=&quot;0&quot; WirelessMode=&quot;1&quot; WirelessLeafOnly=&quot;0&quot; HasConfiguredSSID=&quot;1&quot; ChannelFreq=&quot;2462&quot; BehindWifiExtender=&quot;0&quot; WifiEnabled=&quot;1&quot; Orientation=&quot;0&quot; RoomCalibrationState=&quot;4&quot; SecureRegState=&quot;3&quot; VoiceState=&quot;0&quot; AirPlayEnabled=&quot;0&quot; IdleState=&quot;0&quot;/&gt;&lt;/ZoneGroup&gt;&lt;/ZoneGroups&gt;</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)

toabi avatar Dec 07 '18 07:12 toabi

@bencevans Any new luck here?

TefaTBob avatar Feb 04 '19 20:02 TefaTBob

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...

svrooij avatar Feb 04 '19 21:02 svrooij

I believe about 16 Zones. It's an office.

TefaTBob avatar Feb 04 '19 21:02 TefaTBob

@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 [email protected] which is working successfully for me (4 zones)

├─┬ [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ └── [email protected]

bencevans avatar Feb 05 '19 11:02 bencevans

@bencevans

[email protected] ├── [email protected] ├── [email protected] └── [email protected]

Appears to be the same

TefaTBob avatar Feb 05 '19 15:02 TefaTBob

@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 avatar Mar 06 '19 22:03 TefaTBob

@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 avatar Mar 10 '19 21:03 bencevans

@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 avatar Mar 11 '19 18:03 TefaTBob

@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.

bencevans avatar Mar 13 '19 14:03 bencevans