simbaja / ha_oppoudp

Home Assistant Integration - Oppo UDP-20x
MIT License
8 stars 2 forks source link

Improvement: filter out input sources not available on Oppo 203 #4

Open 35gh opened 1 year ago

35gh commented 1 year ago

Hi

The following inputs are not available on Oppo UDP-203, only UDP-205. Would it be possible to filter them out in the integration based on the detected model?

Capture d’écran 2023-06-08 à 13 46 36

From the Oppo API documentation:

Capture d’écran 2023-06-08 à 13 59 55

Thanks

LeoeLeoeL commented 1 year ago

you are luckier than I. This integration doesn't work for my 205 under 6.0. Many problems with several integrations. Reverted to 5.4 that is OK.

35gh commented 1 year ago

Yup I've opened a bug for the compatibility issue with 2023.6.0: #3

simbaja commented 1 year ago

It's been a while, but I don't think that I had a way to detect the device type. I thought about firmware version, but it didn't look like it would work based on my device. I can probably filter it if I can get the device type reliably.

35gh commented 1 year ago

A first option could be to use "Server Name", as it contains the model name by default: Notify: OPPO Player Start Server IP: 192.168.0.2 Server Port: 23 Server Name: OPPO UDP-203 However the name can be changed by the user, so not 100% reliable.

Another - probably better - option could be to set up the source to a non-supported input on the UDP-203 during the initial configuration flow (such as USB AUDIO IN) and check if the device is returning an error.

Thanks!

simbaja commented 1 year ago

The server name is only available in a notify broadcast, so unfortunately that won't work. The other method could work, I'd have to look into it a bit. Happy to accept a PR if you have some time to implement it.

35gh commented 1 year ago

Thank you! I'm not really familiar with Python and HA coding, so it will take me some time to understand how to implement this.