Philips Android TV component


#245

@gyrga i got something with ip:1925/1/system:
{
“menulanguage”: “Slovenian”,
“name”: “55PUS6262/12”,
“country”: “Slovenia”,
“serialnumber_encrypted”: “xxxx”,
“softwareversion_encrypted”: “xxxx”,
“model_encrypted”: “xxxx”,
“deviceid_encrypted”: “xxxx”,
“nettvversion”: “4.6.0”,
“epgsource”: “broadcast”,
“api_version”: {
“Major”: 6,
“Minor”: 1,
“Patch”: 0
},
“featuring”: {
“jsonfeatures”: {
“recordings”: [
“List”,
“Schedule”,
“Manage”
],
“ambilight”: [
“LoungeLight”
],
“textentry”: [
“context_based”,
“initial_string_available”
],
“inputkey”: [
“key”,
“unicode”
],
“pointer”: [
“context_based”
],
“activities”: [
“browser”
]
},
“systemfeatures”: {
“tvtype”: “consumer”,
“content”: [
“dmr”
],
“pairing_type”: “none”,
“os_type”: “Linux”
}
}
}


#246

Thanks, this is useful! I see two major differences from my output:

  1. You are running API version 6.1, while I have a version 6.2. I would expect that since the major version is the same (6), everything should work, but it does not seem to be the case.
  2. Your “pairing_type” is “none”, while mine is “digest_auth_pairing” - that’s probably why the pairing script does not work for you.

So, right now it seems that your API behaves differently from the others. I have a theory to test: could you please go to http://ip:1925/1/audio and share the output? This does not work on API 6.2, but might work for you - then I will be able to help you…


#247

Isn’t there a setting to enable the use of the API?

@warcanoid What did you to to set up the Philips TV Remote App? Did you press Pair, and there was a PIN on the TV, which you put in the app?


#248

@gyrga again: Forbidden :frowning:
@nstrelow opened the app, select tv, find tv with ip adress, and tv control was there, without code/pin


#249

@warcanoid Now I am totally lost, this does not make any sense to me :frowning:

How comfortable are you with computers in general and how bad do you want to get this working? :slight_smile: I can potentially walk you through setting up a proxy to capture and decrypt the traffic between the iPhone app and the TV - then we’ll definitely know what’s going on and I’m 99% sure we’ll be able to solve your issue.

Besides that I’m all out of ideas… Maybe somebody else has any other thoughts?


#250

@gyrga I want it really much! Let’s do all what’s needed! I have few experiences with proxy, had to listen with Charles between sonoff device and mac, to get the key.
The ios app show json version is 5, maybe this is also problem?


#251

@warcanoid nice, I like your spirit! :slight_smile: Then I need you to do the following:

  1. Reinstall the iOS app (we need to start from scratch to figure out how it pairs to your TV)
  2. Connect your iPhone to Charles
  3. Pair the TV and the iOS app and press some random buttons (like changing the volume, for example)
  4. Save the captured traffic in Charles and share it with me

I’ll then analyze the traffic and we will know for sure what’s going on.


#252

@warcanoid Please also install Charles’s certificate on your iPhone (http://www.charlesproxy.com/getssl) and enable SSL proxying from all locations in SSL proxying location settings in Charles => we need these steps to decrypt the traffic between the iPhone and the TV.

EDIT: I’ve just realized something - your TV does not have Android, does it? It will explain why the pairing does not work. We still need to capture the traffic to get it working, but at least this starts to make some sense…


#253

@gyrga have sent you the data in personal message. I have deleted the app, and then when i started it, at bottom pop up windows, paired tv 55pus… I have also tried od ipad, same result. Tv has some weird version of android, can not find it to be sure.


#254

@warcanoid Thank you, this is really useful! Looking at your data now, I think I start to understand what’s going on. Can you please do two more things:

  1. Go to http://192.168.1.28:1925/6/audio/volume in your browser, do you get any response?
  2. If you go to settings on your TV do you see an item “Android settings”?

Thank you again for investing your time!


#255

@gyrga

  1. I get:
    {
    “muted”: false,
    “current”: 42,
    “min”: 0,
    “max”: 60
    }

  2. No android :slight_smile:, is it still possible to do it?


#256

@warcanoid Awesome, thank you a lot! Yeah, it seems that there are two versions of the API: 6.1 - (non-Android) and 6.2 (Android TVs). Good news: I can make it work for you. Bad news: since I don’t have this TV, you’ll have to test an updated tool and tell me which commands work and which do not => then I’ll make a public version for everybody. I’ll pm you a link with an updated test version later today.

UPDATE: Seems like 6.1 can be with Android too…


#257

@gyrga thank you very much!!! :partying_face:


#258

Ok, so I’ve updated my tool to support both Android and non-Android Philips TVs (thanks to @warcanoid) and I also continue to add new commands (70+ so far), as well as updating the API reference.

@nstrelow, could you perhaps update your component to add support for non-Android TVs? It would allow people like @warcanoid to also enjoy your component! The changes are minor:

  1. No pairing required
  2. No authentication when sending requests (so no username/password)
  3. Http instead of https
  4. Port 1925 instead of 1926

Alternatively, here is how you can use my tool with Home Assistant:

  1. Add this to your configuration.yaml (change the path to your actual path to the script):
    shell_command:
       mute: python /home/homeassistant/helper_scripts/pylips.py --host %tv_ip_address% --user %username% --pass %password% --command mute

  2. Add this to your scripts:
    mute:
      sequence:
        - service: shell_command.mute

  3. Add this to your switches:
    mute:
      turn_on:
        service: script.turn_on
        entity_id: script.mute
      turn_off:
        service: script.turn_off
        entity_id: script.mute

This will give you a “mute” switch and you can use the same approach for any command…

By the way, has anyone tested “Ambilight + Hue” command yet? I want to make sure that it works on all TVs and not only on mine.


#259

Hi @gyrga, I’ve tested “Ambilight+Hue” command and it works perfectly. There is only one question what would be the response that I need to include in the value template for command line switch if it is “on”, so it would be possible to have a real status for command line switch?


#260

Thanks for the feedback, glad to hear that it works!

I have future plans to implement an MQTT server support that will allow getting and storing real-time statuses to use in HA sensors and switches - that’s what I’ve been personally using for the last couple of years, but I need to rewrite it to generalize it and make it scalable. I would expect it to be ready some time mid-January.


#261

GREAT WORK @gyrga. THANK YOU!
@Molodax I made a sensor for power state:


#262

@warcanoid Oh, thanks for sharing this! I totally forgot about the command line sensor in HA! I’ll update the tool so it gives a clean response that is easy to use with the command line sensor - that would be faster than integrating MQTT…


#263

Actually, my question was about command_line SWITCH. There is a possibility to include status check and as far as I can see there is a command ambihue_satus. My question is what response provide this command in the command line in case of ambilight+hue is on. I use Hass.io and it makes it very complicated to see what is the response when I send ambihue_status


#264

Thanks, I get it! Right now my tool returns some feedback info like “sending a POST request” apart from the response itself, which will probably make the command line sensor a bit hard to setup (I’ll check it later). I’ll fix it in the coming days and then you’ll be able to use the command line sensor with my tool. I will also share an example of how to set it up!

(command line sensor/command line switch status are both affected by this)