eslavnov / pylips

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

[FEAT] Volume Response & Changing when connected to Headphone Output #69

Closed lmpclk closed 4 years ago

lmpclk commented 4 years ago

First, thanks for the great script and API documentation, has really helped me out build some home automation stuff between the TV, Node-Red and Homekit!

I am using a 50PUS6703/12 TV operating a Linux OS, I am however using the headphone output of the TV to output audio to external speakers. When running the command python3 pylips.py volume it returns the same values regardless of the mute status or volume level of the TV at the time. I have since discovered that this is returning the settings for the volume of the internal speakers; when unplugging the 3.5mm jack from the headphone output and adjusting the volume/mute status with the remote, this then is reflected in the response from the API and subsequently the pylips script. It is therefore clear that the data for the internal speakers and headphone output are stored separately, and could be accessible from alternative endpoints?

It would be great if an API endpoint was documented (if it exists) and a command added to the pylips script to return the volume of the headphone output instead of the internal output. Subsequently it may also become prudent to document the API endpoint (if it exists) and have a command that returns which output is currently active so that the appropriate request can then be made to find the current TV volume (headphones or internal)

Note, when making post requests to the http://ip-address:1925/6/audio/volume endpoint, sending {"muted": false} or {"muted": true} DOES change the muted status for the active output (headphones or internal speakers), but sending {"current": 18} ONLY changes the volume of the internal TV speakers so in the case headphones are connected makes no audible change. Of course using the https://ip-address:1926/6/input/key endpoint, and sending {"key": "VolumeUp"}, {"key": "VolumeDown"}, or {"key": "Mute"} does reflect changes to whichever output is currently active (headphones or internal speakers) as it is just the same as if the TV remote was to be used directly. It is therefore requested that consideration be made for documentation of the API endpoint (again if it exists) that will work to set the volume of the headphone output as in the http://ip-address:1925/6/audio/volume endpoint, which as above only works for the internal speakers.

Note there also appears to be an option in the settings to output audio over HDMI, this may prove a similar issue to the above, so may require further API endpoints for access to that data?

eslavnov commented 4 years ago

Hey @lmpclk, thanks for your post! I output my TVs audio over HDMI and the volume works as expected for me. I've also never seen any alternative audio endpoints, so unfortunately this looks like a Philips bug or something. There is nothing I can do, but I'll keep my eye on this one and will re-open it if I find any new info.