supersaiyanmode / PyWebOSTV

Python API for controlling LG TVs (Web OS)
MIT License
261 stars 50 forks source link

Fix MediaControl subscribe_get_audio_output and TVControl subscribe_get_current_channel #95

Closed luskaner closed 9 months ago

luskaner commented 9 months ago

Hello:

This PR fixes the subscription to get_audio_output of MediaControl.

In the original code, these are always the values whenever the callback gets called:

This is because of the standard_validation checks for the key errorText that is never present as the TV returns a response like (so subscribed is checked instead) :

{"type":"response","id":"...","payload":{"soundOutput":"tv_speaker","subscribed":true}}

PS: While this was tested on the latest WebOS 2023, this should affect any WebOS version, since I checked the api version is still 1 for the audio endpoint

Thanks for the great project ;)

luskaner commented 9 months ago

Oh, let's mark this as draft, as I found that then it no longer works when calling get_audio_output directly

luskaner commented 9 months ago

Now it works, since the direct requests will still use the validation key (and subscriptions as a fallback for subscription_validation key). If this is the right direction to fix it I can make the tests and it's ready to merge :)

supersaiyanmode commented 9 months ago

One more request: Please bump the version in setup.py. I'll merge your PR, and get this published soon :)