lucasvdh / codes.lucasvdh.philips-jointspace

A Jointspace connector for Philips TV's supporting models up to 2018
GNU General Public License v3.0
7 stars 9 forks source link

500 response on system endpoint #6

Open lucasvdh opened 4 years ago

lucasvdh commented 4 years ago

When trying to pair a Philips 55PUS7304 from 2019 the system info call to http://{ip}:1925/6/system returns a 500 error response.

Secure connection to the system endpoint does not work on any api version.

The error during pairing: image

Original report: https://community.athom.com/t/philips-tv-testing/14064/58

lucasvdh commented 4 years ago

I still haven't got any clue as to why this would happen...

Maybe ask if the original reporter is willing to try a system reset of their tv to test if the behavior is the same after a clean install. Because the only thing this points to so far is that there's something wrong with the tv.

mebe1012 commented 4 years ago

Hey @lucasvdh , I've stumbled over this repo and issue as I've searched myself for more info regarding this error. I'm the maintainer of a new philips tv binding for openHAB and people with tv models from 2019 seem to experience your described error. They're also not able to even use the Philips TV Remote App - looks like Philips has changed something at their APIs.

Cheers & happy coding

lucasvdh commented 4 years ago

Man that really sucks.. I wish there was someone at TP Vision who would just give us some answers.

Thanks for the heads up though!

lucasvdh commented 4 years ago

Closing this issues as there is nothing further to investigate.

SchmuFoo commented 4 years ago

I'm not an Homey User but maybe FYI:

That on my 7304 from 2019 on :192{5,6}/system and (only) :192{5,6}/6/system there IS an response

root@loxberry:/opt/loxberry# nmap -sT -P0 philipstv -p 1925,1926
Starting Nmap 7.40 ( https://nmap.org ) at 2019-12-25 00:51 CET
Nmap scan report for philipstv (192.168.178.75)
Host is up (0.0026s latency).
rDNS record for 192.168.178.75: PhilipsTV.fritz.box
PORT     STATE SERVICE
1925/tcp open  discovery-port
1926/tcp open  egs
// 20191225010153
// http://philipstv:1925/6/system

{
  "notifyChange": "http",
  "menulanguage": "German",
  "name": "58PUS7304/12",
  "country": "Germany",
  "serialnumber_encrypted": "jr4ZwfkbO4+72qJ7myyZmFFNHBV8zPLQz1WysjAqUio=\n",
  "softwareversion_encrypted": "lhhhHuMvLA/1vGNXQIftYWEFflgOIzeWb9iWlVGtriVTE1w82OkWbmp+8xuvaw9T\n",
  "model_encrypted": "A8aDp3Pn1TDmf18e53F2Vx02NQzRafnNqRMey1BJnQ8=\n",
  "deviceid_encrypted": "CwMywQQpxuR4GVd30PexMVbEl0MS5T4rOTIYnnosdi8=\n",
  "nettvversion": "8.2.0",
  "epgsource": "no_epg",
  "api_version": {
    "Major": 6,
    "Minor": 1,
    "Patch": 0
  },
  "featuring": {
    "jsonfeatures": {
      "editfavorites": [
        "TVChannels",
        "SatChannels"
      ],
      "recordings": [
        "List",
        "Schedule",
        "Manage"
      ],
      "ambilight": [
        "LoungeLight",
        "Hue",
        "Ambilight",
        "HueStreaming"
      ],
      "menuitems": [
        "Setup_Menu"
      ],
      "textentry": [
        "not_available"
      ],
      "applications": [
        "TV_Apps",
        "TV_Games",
        "TV_Settings"
      ],
      "pointer": [
        "not_available"
      ],
      "inputkey": [
        "key"
      ],
      "activities": [
        "intent"
      ],
      "channels": [
        "preset_string"
      ],
      "mappings": [
        "server_mapping"
      ]
    },
    "systemfeatures": {
      "tvtype": "consumer",
      "content": [
        "dmr",
        "pvr"
      ],
      "tvsearch": "intent",
      "pairing_type": "digest_auth_pairing",
      "secured_transport": "true",
      "companion_screen": "true"
    }
  },
  "os_type": "MSAF_2019_P"
}`
SchmuFoo commented 4 years ago

TV Remote App is working on my previous mentioned 2019 TV. And it seems that I can also use HTTP POSTs by my own to directly control the TV! B889CB86-E08D-414B-BBEE-724DEB4BA5A1 49B37C6F-3107-404E-AE65-38AC8375C7D1 2AF2CC9F-906C-4047-87D1-39315F9E846E D4550238-B54D-44ED-AD4E-F4C7EECFA84E 3AAC500E-DBED-44AF-A255-A40847B3A843 82246AAA-DC0F-4E60-B048-F091B455A84B FC1244C0-F75A-4DF1-9DFB-1A3A48E2691B

SchmuFoo commented 4 years ago

TV Remote App is working on my previous mentioned 2019 TV. And it seems that I can also use HTTP POSTs by my own to directly control the TV!

YES, Thank to the following wiki I was able to create HTTP GET and POST commands to control my 2019 Android TV directly and without any pairing stuff :-)

https://github.com/eslavnov/pylips/wiki

mebe1012 commented 4 years ago

@SchmuFoo cool! Even though it is weird that you're owning the same model as the bug issuer and yet you can access the ip:1925/6/system endpoint. Is the newest tv software installed or did any new update happen lately?

SchmuFoo commented 4 years ago

@SchmuFoo cool! Even though it is weird that you're owning the same model as the bug issuer and yet you can access the ip:1925/6/system endpoint. Is the newest tv software installed or did any new update happen lately?

I have the 58" inch modell so slightly different, but the Firmware Versions are exactly the same in an major branch. I have installed the newest one which came a few days ago (!):

"2019er TVs mit Android TV 9 Pie (TPM191E: 1.2.173.7)" https://toengel.net/philipsblog/2019/12/18/philips-neue-firmware-fuer-2019er-tvs-mit-android-tv-9-pie-tpm191e-1-2-173-7/

P.S.: My focus is controlling the Ambilight which works fine, but what is not working is POST Standby and GETing Powerstate

Ambilight

loxberry@loxberry:~ $ curl -v -s -X POST -d {"power":"Off"} http://192.168.178.75:1925/6/ambilight/power
*   Trying 192.168.178.75...
* TCP_NODELAY set
* Connected to 192.168.178.75 (192.168.178.75) port 1925 (#0)
> POST /6/ambilight/power HTTP/1.1
> Host: 192.168.178.75:1925
> User-Agent: curl/7.52.1
> Accept: */*
> Content-Length: 11
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 11 out of 11 bytes
< HTTP/1.1 200 OK
< Date: Wed, 25 Dec 2019 22:03:49 GMT
< Accept-Ranges: bytes
< Server: Restlet-Framework/2.3.12
< Access-Control-Allow-Origin: *
< Content-Length: 0
<
* Curl_http_done: called premature == 0
* Connection #0 to host 192.168.178.75 left intact
loxberry@loxberry:~ $ curl -v -s -X POST -d {"power":"On"} http://192.168.178.75:1925/6/ambilight/power
*   Trying 192.168.178.75...
* TCP_NODELAY set
* Connected to 192.168.178.75 (192.168.178.75) port 1925 (#0)
> POST /6/ambilight/power HTTP/1.1
> Host: 192.168.178.75:1925
> User-Agent: curl/7.52.1
> Accept: */*
> Content-Length: 10
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 10 out of 10 bytes
< HTTP/1.1 200 OK
< Date: Wed, 25 Dec 2019 22:04:00 GMT
< Accept-Ranges: bytes
< Server: Restlet-Framework/2.3.12
< Access-Control-Allow-Origin: *
< Content-Length: 0
<
* Curl_http_done: called premature == 0
* Connection #0 to host 192.168.178.75 left intact
loxberry@loxberry:~ $

GETing Powerstate

loxberry@loxberry:~ $ curl -v -s http://192.168.178.75:1925/6/powerstate
*   Trying 192.168.178.75...
* TCP_NODELAY set
* Connected to 192.168.178.75 (192.168.178.75) port 1925 (#0)
> GET /6/powerstate HTTP/1.1
> Host: 192.168.178.75:1925
> User-Agent: curl/7.52.1
> Accept: */*
>
< HTTP/1.1 404 Not Found
< Date: Wed, 25 Dec 2019 22:05:45 GMT
< Accept-Ranges: bytes
< Server: Restlet-Framework/2.3.12
< Content-Length: 439
< Content-Type: text/html; charset=UTF-8
<
<html>
<head>
   <title>Status page</title>
</head>
<body style="font-family: sans-serif;">
<p style="font-size: 1.2em;font-weight: bold;margin: 1em 0px;">Not Found</p>
<p>The server has not found anything matching the request URI</p>
<p>You can get technical details <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5">here</a>.<br>
Please continue your visit at our <a href="/">home page</a>.
</p>
</body>
</html>
* Curl_http_done: called premature == 0
* Connection #0 to host 192.168.178.75 left intact

Standby

​​​​​​​loxberry@loxberry:~ $ curl -v -s -X POST -d {"key":"Standby"} http://192.168.178.75:1925/6/input/key
*   Trying 192.168.178.75...
* TCP_NODELAY set
* Connected to 192.168.178.75 (192.168.178.75) port 1925 (#0)
> POST /6/input/key HTTP/1.1
> Host: 192.168.178.75:1925
> User-Agent: curl/7.52.1
> Accept: */*
> Content-Length: 13
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 13 out of 13 bytes
< HTTP/1.1 404 Not Found
< Date: Wed, 25 Dec 2019 22:07:19 GMT
< Accept-Ranges: bytes
< Server: Restlet-Framework/2.3.12
< Content-Length: 439
< Content-Type: text/html; charset=UTF-8
<
<html>
<head>
   <title>Status page</title>
</head>
<body style="font-family: sans-serif;">
<p style="font-size: 1.2em;font-weight: bold;margin: 1em 0px;">Not Found</p>
<p>The server has not found anything matching the request URI</p>
<p>You can get technical details <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5">here</a>.<br>
Please continue your visit at our <a href="/">home page</a>.
</p>
</body>
</html>
* Curl_http_done: called premature == 0
* Connection #0 to host 192.168.178.75 left intact
SchmuFoo commented 4 years ago

P.S.: My focus is controlling the Ambilight which works fine, but what is not working is POST Standby and GETing Powerstate [..]

loxberry@loxberry:~ $ curl -v -s http://192.168.178.75:1925/6/powerstate
*   Trying 192.168.178.75...
* TCP_NODELAY set
* Connected to 192.168.178.75 (192.168.178.75) port 1925 (#0)
> GET /6/powerstate HTTP/1.1
> Host: 192.168.178.75:1925
> User-Agent: curl/7.52.1
> Accept: */*
>
< HTTP/1.1 404 Not Found
[..]

Idea: I will install an local MITM Proxy like https://www.telerik.com/fiddler on my PC to check what the official iPhone Philips TV Remote App is sending to the TV for the Standby stuff etc.

SchmuFoo commented 4 years ago

P.S.: My focus is controlling the Ambilight which works fine, but what is not working is POST Standby and GETing Powerstate [..]

> loxberry@loxberry:~ $ curl -v -s http://192.168.178.75:1925/6/powerstate
> *   Trying 192.168.178.75...
> * TCP_NODELAY set
> * Connected to 192.168.178.75 (192.168.178.75) port 1925 (#0)
> > GET /6/powerstate HTTP/1.1
> > Host: 192.168.178.75:1925
> > User-Agent: curl/7.52.1
> > Accept: */*
> >
> < HTTP/1.1 404 Not Found
> [..]

Idea: I will install an local MITM Proxy like https://www.telerik.com/fiddler on my PC to check what the official iPhone Philips TV Remote App is sending to the TV for the Standby stuff etc.

"Damn" ;-)

image

SchmuFoo commented 4 years ago

P.S.: My focus is controlling the Ambilight which works fine, but what is not working is POST Standby and GETing Powerstate [..]

> loxberry@loxberry:~ $ curl -v -s http://192.168.178.75:1925/6/powerstate
> *   Trying 192.168.178.75...
> * TCP_NODELAY set
> * Connected to 192.168.178.75 (192.168.178.75) port 1925 (#0)
> > GET /6/powerstate HTTP/1.1
> > Host: 192.168.178.75:1925
> > User-Agent: curl/7.52.1
> > Accept: */*
> >
> < HTTP/1.1 404 Not Found
> [..]

Idea: I will install an local MITM Proxy like https://www.telerik.com/fiddler on my PC to check what the official iPhone Philips TV Remote App is sending to the TV for the Standby stuff etc.

"Damn" ;-)

image

SSL-Inception activated and here we are (But not working at plain 1925..)

image

mebe1012 commented 4 years ago

Thanks for the insights. So after all the App is using credentials and the ip:1926/6 path for your tv? Weird that also the non-android API is available with the 1925 port for usage without credentials. Doesn't really make sense, but that fits to TPVision..

SchmuFoo commented 4 years ago

Thanks for the insights. So after all the App is using credentials and the ip:1926/6 path for your tv? Weird that also the non-android API is available with the 1925 port for usage without credentials. Doesn't really make sense, but that fits to TPVision..

Yes the Philips App is using ip:1926/6 and authentication digest stuff (after PIN pairing the App with the Android TV) D8DCDF10-DA93-4CA5-A0E6-7273216C029B

SchmuFoo commented 4 years ago

Do you know an tutorial how to pair an Android TV on Linux (with ADB Tools?) and use the generated credentials then with cURL f.e.?

mebe1012 commented 4 years ago

Sure, there ya go: https://github.com/suborb/philips_android_tv

Not a tutorial, but you can get the credentials with it. These can be passed to curl as parameters