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

BUG: New invisible property on ZoneGroup not parsed correctly #125

Closed hklages closed 3 years ago

hklages commented 3 years ago

What happened

I tested "Invisible" and it does not work. Please change in beta-3 in file zone-group-topology.service.extension.js from: Invisible: member.Invisible === 1, to Invisible: member.Invisible === '1',

With Invisible I followed your "MicEnabled" and tested on number but it seems to be string.

Invisible

I don't submit a PR as it is related to the beta and I suggest, that you check MicEnabled - in ZoneGroup! I tried to understand the logic but failed - sometimes boolean, then number and from SONOS it comes as string.

MicEnabled

What did you expect to happen

With that change - at least in ZoneGroup events - the Invisible is set to true for all invisible player. The property is missing for visible player.

svrooij commented 3 years ago

I don't have speakers with a microphone. So I'm flying blind here.

The type sometimes isn't correct. The fast-xml-parser package isn't typed, so it guesses how values should interpreted.

The definition in the device-properties service comes from the service documentation. So the service documentation says this field is transmitted as a number. For this library there are some overrides in place. Maybe we should also add something similar for MicEnabled. That would result in a line like "MicEnabled": "boolean".

https://github.com/svrooij/sonos-api-docs/blob/de1af3fa1f928672eed13b119e519f495de07f92/generator/sonos-docs/templates/ts/template.json#L42-L50

hklages commented 3 years ago

I can test it on my SONOS beam for your.

Currently for MicEnabled I get for the SONOS beam, microphone enabled:

device property event - MicEnabled has value 1 number

{ "AirPlayEnabled": true, "BehindWifiExtender": 0, "ChannelFreq": 2437, "Configuration": 1, "HasConfiguredSSID": true, "HdmiCecAvailable": true, "HTBondedZoneCommitState": 0, "HTFreq": 0, "Icon": "x-rincon-roomicon:living", "Invisible": false, "IsIdle": false, "IsZoneBridge": false, "LastChangedPlayState": "PLAYING,UNPLAYABLE,MEMBER,", "MicEnabled": 1, "Orientation": 0, "RoomCalibrationState": 4, "SecureRegState": 3, "SettingsReplicationState": "RINCON_5CAAFD00223601400,628,RINCON_FFFFFFFFFFFF99999,0,RINCON_5CAAFD00223601400,147,RINCON_949F3EC13B9901400,36,RINCON_949F3EC13B9901400,1723,RINCON_5CAAFD00223601400,22,RINCON_B8E9375831C001400,2157,RINCON_FFFFFFFFFFFF99999,0,RINCON_5CAAFD00223601400,8,RINCON_FFFFFFFFFFFF99999,0,RINCON_949F3EC13B9901400,71,RINCON_949F3EC13B9901400,23114,RINCON_949F3EC13B9901400,8,RINCON_949F3EC13B9901400,13,RINCON_949F3EC13B9901400,10,RINCON_5CAAFD00223601400,103,RINCON_000E58FE3AEA01400,0", "SupportsAudioClip": true, "SupportsAudioIn": false, "TVConfigurationError": false, "VoiceConfigState": 2, "WifiEnabled": true, "WirelessLeafOnly": false, "WirelessMode": 1, "ZoneName": "Wohnzimmer" }

and for ZONEGROUP event, MicEnabled false boolean.

{ "name": "Wohnzimmer", "uuid": "RINCON_949F3EC13B9901400", "host": "192.168.178.36", "port": 1400, "Icon": "x-rincon-roomicon:living", "MicEnabled": false, "Invisible": false, "SoftwareVersion": "61.1-83220", "SwGen": "2" }

github-actions[bot] commented 3 years ago

:tada: This issue has been resolved in version 2.4.0-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.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: