svrooij / node-sonos-ts

:speaker: Sonos control library, use this library in your own appliction.
https://sonos-ts.svrooij.io/
MIT License
84 stars 18 forks source link

GroupID in ZoneGroupEvent missing #132

Closed hklages closed 3 years ago

hklages commented 3 years ago

Is your feature request related to a problem? Please describe

No

Describe the solution you'd like

Get GroupID in ZoneGroup event and what would even better get the raw data in any Service event. Then I can parse/tranform as I need it.

Describe alternatives you've considered

Additional context

Low priority - GroupID is useful to sort players by group.

svrooij commented 3 years ago

The Unprocessed event on each service should do just that. That way you can parse the data if you think this library does it incorrectly.

https://github.com/svrooij/node-sonos-ts/blob/08198914ab7b09eec2350c59a3bf08cd8e207c03/src/services/base-service.ts#L502-L522

svrooij commented 3 years ago

You're probably looking for something like this:

const XmlHelper = require('../lib/helpers/xml-helper').default;
const SonosDevice = require('../lib/').SonosDevice
const ServiceEvents = require('../lib/models/service-event').ServiceEvents;
const device = new SonosDevice('192.168.x.x');
device.ZoneGroupTopologyService.Events.on(ServiceEvents.Unprocessed, data => {
  //console.log('ZoneGroupTopology data %s', JSON.stringify(data))
  console.log('ZoneGroupState from event', JSON.stringify(XmlHelper.DecodeAndParseXml(data[0].ZoneGroupState, ''), null, 2))
})

but I would rather see that this isn't needed, and just have the library provide the needed information.

what would even better get the raw data in any Service event. Then I can parse/tranform as I need it.

github-actions[bot] commented 3 years ago

:tada: This issue has been resolved in version 2.4.1-beta.4 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

github-actions[bot] commented 3 years ago

:tada: This issue has been resolved in version 2.4.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket: