Closed freaktechnik closed 5 years ago
Actually, the fix seems to be to add another ZoneGroupState
.
From the release version (await Helpers.ParseXml(state.ZoneGroupState))
is logged as { ZoneGroupState: { ZoneGroups: { ZoneGroup: [Array] }, VanishedDevices: '' }
.
But not always, for some players it's { ZoneGroups: { ZoneGroup: [ [Object], [Object], [Object], [Object], [Object] ] } }
There's a second related error in the event parser (the logged object is eventData
):
2019-04-04 20:10:33.053 INFO : sonos: { ZoneGroupState:
2019-04-04 20:10:33.053 INFO : sonos: { ZoneGroupState: { ZoneGroups: [Object], VanishedDevices: '' } },
2019-04-04 20:10:33.053 INFO : sonos: AvailableSoftwareUpdate:
2019-04-04 20:10:33.053 INFO : sonos: { UpdateItem:
2019-04-04 20:10:33.053 INFO : sonos: { xmlns: 'urn:schemas-rinconnetworks-com:update-1-0',
2019-04-04 20:10:33.053 INFO : sonos: Type: 'Software',
2019-04-04 20:10:33.054 INFO : sonos: Version: '49.2-63270',
2019-04-04 20:10:33.054 INFO : sonos: UpdateURL:
2019-04-04 20:10:33.054 INFO : sonos: 'http://update-firmware.sonos.com/firmware/Prod/49.2-63270-v10.1-kcxxjh-GA-1/^49.2-63270',
2019-04-04 20:10:33.054 INFO : sonos: DownloadSize: '0',
2019-04-04 20:10:33.054 INFO : sonos: ManifestURL:
2019-04-04 20:10:33.054 INFO : sonos: 'http://update-firmware.sonos.com/firmware/Prod/49.2-63270-v10.1-kcxxjh-GA-1/update_1553855194.upm' } },
2019-04-04 20:10:33.054 INFO : sonos: AlarmRunSequence: 'RINCON_B8E937EC581E01400:55:0',
2019-04-04 20:10:33.054 INFO : sonos: ZoneGroupName: 'Schlafzimmer',
2019-04-04 20:10:33.054 INFO : sonos: ZoneGroupID: 'RINCON_B8E937EC581E01400:27',
2019-04-04 20:10:33.055 INFO : sonos: ZonePlayerUUIDsInGroup: 'RINCON_B8E937EC581E01400',
2019-04-04 20:10:33.055 INFO : sonos: MuseHouseholdId: 'Sonos_FanndGyYGPZRvxF1uO1SuWA4YV.dcK0ToIpbQbr1v6oI1aZ',
2019-04-04 20:10:33.055 INFO : sonos: AreasUpdateID: '47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=' }
2019-04-04 20:10:33.055 INFO : sonos: Unhandled Rejection
2019-04-04 20:10:33.055 ERROR : sonos: TypeError: Cannot read property 'ZoneGroup' of undefined
2019-04-04 20:10:33.055 ERROR : sonos: at Object.EventParser._parseZoneGroupTopologyEvent (/home/martin/dev/sonos-adapter/node_modules/sonos/lib/events/eventParser.js:126:59)
2019-04-04 20:10:33.056 ERROR : sonos: at processTicksAndRejections (internal/process/next_tick.js:81:5)
I can confirm this issue. After upgrading to Sonos 10.1 the grouping function does not work anylonger. The error message is ”cannot read property ZoneGroup of undefned”. I would be very happy for a quick fix on this. Thanks in advance. /Magnus
This is indeed confirmed that the Sonos API changed. I had the same issues with using the unofficial sonos app and noson... which are build on the same sonos-node code...
The same happened in September last year. The node-sonos guys came up with a fix very fast and everything went back to normal. Hopefully this time only a minor change is required on this great API
While waiting for a new node-sonos release replace line 46 in ZoneGroupTopology.js with this row: let groups = (await Helpers.ParseXml(state.ZoneGroupState)).ZoneGroupState.ZoneGroups.ZoneGroup That worked for me! The grouping function works again.
As I said, that won't work in every case, for me not all players have that format, even though all of them claim to be on the same patch level. Plus there's also a problem with an event.
Understood but that could be a good enough workaround while waiting for a new release
I got caught by this issue a few days ago but am away now so can't work on this personally. Thanks for investigating and your partial fix mention @magnlund & @freaktechnik. If you're able to fix it yourselves a pull request would be much appreciated as I'm unsure any of the team will be able to put time into this for a while.
:tada: This issue has been resolved in version 1.10.1 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
Brilliant! Thanks guys;)
Expected Behavior
getAllGroups
should resolve and not raise any errors.Current Behavior
Raises a type error (as far as I can see three times, though that may just be three players):
Possible Solution
Properly check for the property, probably. Not sure if that problem is new or not.
Sample code or executed example
As far as I can tell these errors happen when calling
getAllGroups
on a speaker. In my case https://github.com/freaktechnik/sonos-adapter/blob/97a4bfe828ee420e056dd12dc70c16ed995a711f/speaker.js#L224Versions (and Environment)
Node version: v8.15.0 and v11.* node-sonos version: 1.10.0 OS: Debian (likes)