svrooij / sonos2mqtt

:speaker: Sonos mqtt controller. Control your speakers from your mqtt server. mqtt-smarthome insprired.
https://sonos2mqtt.svrooij.io/
MIT License
76 stars 18 forks source link

[Feature] Support for audio formats on HDMI input #168

Closed bommelmutz closed 2 years ago

bommelmutz commented 2 years ago

For Soundbars with HDMI or optical input it is possible read out the audio format.

I think the Parameter is HTAudioIn and it will give back a number code.

For example:

audio format | code -- | -- Silence | 22 Silence 2.0 | 33554454 Stereo PCM 2.0 | 33554434 Dolby Digital 2.0 | 33554488 Dolby Digital 5.1 | 84934713 Dolby Digital Plus 5.1 | 84934714 DTS (unsupported) | 32

Is it possible to bring it to sonos2mqtt? Thank you!

svrooij commented 2 years ago

Where would you want to “integrate” this in sonos2mqtt? And what will you do with it? Not sure if we currently have a way of knowing which devices support the required service. Would it help it you can subscribe for updates for extra services?

so that you need to send a message to …/uuid/subscribeForUpdates with the service you want updates for in the body. Then it will subscribe for that extra service and emit the updates to mqtt.

bommelmutz commented 2 years ago

It seems like it is integrated in the Zone Player Info. You can see it at the Webinterface http://:1400/support/review (Go to device and then Zone Player Info). It looks like all devices/zone players have this HTAudioInCode Parameter and it is "0" if it is not supportet or used by the device. It is not necessary to know which device has the option

I just want to the HTAudioInCode Parameter on the mqttserver, That i can subscribe it from a client and get feedback when it is changed. It would fully help if i can subscribe for updates for extra services. Thank you!

svrooij commented 2 years ago

the HtAudioIn property is only available in the DevicePropertiesService.GetZoneInfo and according to the generated documentation it doesn't emit events.

Which I also confirmed by checking the raw event data. image

Implementing this would require making some kind of polling system, just for this item. All other properties work by using events and react instant. Conclusion this cannot be created by using events only, and I'm tempted to close this issue with the wont-fix label.

svrooij commented 2 years ago

@bommelmutz you can implement polling this information yourself with the help of an advanced command.

Send the following message to sonos/{uuid_of_speaker}/control:

{
  "command": "adv-command",
  "input": {
    "cmd": "DevicePropertiesService.GetZoneInfo",
     "reply": "DevicePropertiesResponse"
  }
}

And you'll get a response to sonos/{uuid_of_speaker}/DevicePropertiesResponse once the data is fetched. This way you can control how often you want this data to be refreshed, and this app doesn't need to implement polling for some really advanced data.