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]Additional API calls #68

Closed AcuarioCat closed 3 years ago

AcuarioCat commented 4 years ago

I have been investigating controlling the TV and have discovered some extra API calls that are not in the list. On later models the tv uses API 6 so most calls are proceeded by this. i.e. http://:1925/6/[API call] http://:1925/6/system

It seems the /system call will return valid data when called with either /1/ or /6/ - presumably so the actual API can be determined from the returned JSON.

Here are the GET calls I have found. Get the channel logo for a channel from its ccid number. Returns a png image if there is one or a 404 not found if no logo is available. /6/channeldb/tv/channelLists/allcab//logo

Get the list of favorite channels took a while to resolve as it is different to the description in the api /6/channeldb/tv/favoriteLists/favcab Returns a json with the ccid number and preset number. Preset number is the channels position in the favorites list. For some reason it starts from 2 and not 1. favcab is the id from the favoriteLists entry from the /6/channeldb/tv call.

There are various calls that return xml files for dmr (Media Rendering?) There are not prefixed with the API version and are on http port 2870. /dmr.xml /dmr_avts.xml /dmr_cms.xml

Some POST calls /control/ConnectionManager /control/AVTransport These are SOAP calls and needs a SOAP payload.

AcuarioCat commented 4 years ago

Some more information after more investigation..

Changing channel is more efficiently performed using the /activities/tv API This is a POST. You need to post a JSON with the following format: {"channel":{"ccid":"100067"},"channelList":{"id":"favcab"}} ccid is the ccid for the channel you want, id is the channel list.

Using the ccid seems the way to change channel if you have downloaded the list of channel names as it seems there is another channel mapping on the tv that isn't exposed as the numbers used to change channel on the remote don't necessarily tie up with any reference in either of the channel lists. i.e. for me, sending keys '4' '2' either from my code or using the remote control for channel 42 gets me the same program as ccid 100067 which has preset: 45 in the favorites list and 67 in all channels list.

jonasstrehle commented 4 years ago

Hey AcuarioCat - good work. Trying to implement some of your investigation in my private home automation app.

How to use /6/channeldb/tv/channelLists/allcab//logo? Would you be so kind to translate this into a curl? I can't get it to work.

Regards Jonas