eslavnov / pylips

Control Philips TVs (2015+) and Ambilight (+ Hue) through their reverse-engineered API (+ MQTT support!)
MIT License
334 stars 58 forks source link

[FEAT] Controlling headphone volume #96

Open Julien-Decoen opened 3 years ago

Julien-Decoen commented 3 years ago

Thanks a lot for your job ! You make my tv smartest than ever !

Describe the solution you'd like To be able to control "headphones_volume".

This is a setting in my quick settings menu and i'd like to control it via pylips in order to link headphone volume to master volume.

I've got this setting on my 50PUS7354

Julien-Decoen commented 3 years ago

I tried to make a post request : python3 pylips.py --command post --path 'menuitems/settings/update' --body '{"values":[{"value":{"Nodeid":2131230913,"Controllable":"true","Available":"true","string_id":"Volume casque","data":{"value":15}}}]}'

It works but return a bad request...

eslavnov commented 3 years ago

Hi @lou-juicy,

I've spent a couple of hours looking into this and unfortunately, I don't have any good news:

  1. POST request returns "OK" for me, but does not change the volume (I also have a different "nodeid" for the headphones volume, but this is somewhat expected).
  2. Looking at the API source code I see some mentions of various audio input sources, but it's not really clear to me what's the logic there. So it might be possible to control it (or it might be something completely unrelated) - perhaps taking a closer look at /system/priv-app/xtv/oat/arm/xtv.odex could provide some answers.
  3. I've also checked the TV's syslog and it suggests that it might be possible to control it via sending an event to the settings.apk (which, in turn, if we are lucky, might be possible to wrap with the API's commands related to TV's activities), but I also was not able to fully figure it out.... Again, perhaps decompiling the settings app might provide some clues.

Unfortunately, since it's a rare request (you are the second person to ask this in 2+ years) and requires quite a lot of investigations that ultimately might lead to a dead-end, I am not really comfortable spending my time on this one.

I will keep the issue open though in case somebody from the community wants to take a stab at this one.

Sorry that I could not help you more!

Julien-Decoen commented 3 years ago

Hi @eslavnov,

Thanks a lot for your investigation on that feature and for your complete answer.

I just tried to learn more about the way to query Philips' API but I'm a bit lost. For now, i'm using the query above to make it works.

But i'v got other issue with the command current_app that return {"component":{"packageName":"NA","className":"NA"}}... Have you got some ressources about the api ? I'll try to get the sourcecode like you mention on Home.md.

eslavnov commented 3 years ago

The current_app endpoint seems to be broken for some people, see https://github.com/eslavnov/pylips/issues/86