Skip to content

Instantly share code, notes, and snippets.

@marcelrv
Created December 21, 2016 16:49
Show Gist options
  • Save marcelrv/ee9a7cf97c227d069e4ee88d26691019 to your computer and use it in GitHub Desktop.
Save marcelrv/ee9a7cf97c227d069e4ee88d26691019 to your computer and use it in GitHub Desktop.
Working commands 55PUS7181
http://192.168.3.51:1925/system
{"menulanguage":"Dutch","name":"55PUS7181\/12","country":"Netherlands","serialnumber_encrypted":"F6905Z+vyquNhZoXegQ1DzZXCqMIcjJpkzy3LsiPac=\n","softwareversion_encrypted":"1YWR42sjQ6xdjuyIXWZbyPnoRswLoRswLmKtAhR9GRsBx1qY=\n","model_encrypted":"jGNvXDerdJoWjOpwh\/n0gw2MgM7oRswLoRswLKC73wfMgra3S62c4=\n","deviceid_encrypted":"7mv3ZEtMH8oRswL0RoRswLISTn38FN8HAqfmSF95qoaiRsuukSraQ=\n","nettvversion":"6.0.2","epgsource":"one","api_version":{"Major":6,"Minor":2,"Patch":0},"featuring":{"jsonfeatures":{"editfavorites":["TVChannels","SatChannels"],"recordings":["List","Schedule","Manage"],"ambilight":["LoungeLight","Hue","Ambilight"],"menuitems":["Setup_Menu"],"textentry":["context_based","initial_string_available","editor_info_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","dms_tad"],"tvsearch":"intent","pairing_type":"digest_auth_pairing","secured_transport":"true"}}}
Seems to support all ambilight commands from http://jointspace.sourceforge.net/projectdata/documentation/jasonApi/1/doc/API.html
Extra/undocumented:
http://192.168.3.51:1925/ambilight/currentconfiguration
{"styleName":"FOLLOW_VIDEO","isExpert":false,"menuSetting":"STANDARD"}
http://192.168.3.51:1925/ambilight/lounge
{"color":{"hue":0,"saturation":0,"brightness":0},"colordelta":{"hue":0,"saturation":0,"brightness":0},"speed":0,"mode":"Default"}
http://192.168.3.51:1925/ambilight/power
{"power":"On"}
http://192.168.3.51:1925/ambilight/supportedstyles
{"supportedStyles":[{"styleName":"OFF"},{"styleName":"FOLLOW_VIDEO"},{"styleName":"FOLLOW_AUDIO","algorithms":["ENERGY_ADAPTIVE_BRIGHTNESS","ENERGY_ADAPTIVE_COLORS","VU_METER","SPECTRUM_ANALYZER","KNIGHT_RIDER_CLOCKWISE","KNIGHT_RIDER_ALTERNATING","RANDOM_PIXEL_FLASH","STROBO","PARTY"],"maxTuning":2},{"styleName":"FOLLOW_COLOR","algorithms":["MANUAL_HUE","AUTOMATIC_HUE"],"maxSpeed":255},{"styleName":"LOUNGE"},{"styleName":"MANUAL"},{"styleName":"EXPERT"},{"styleName":"GRID"}]}
regular:
http://192.168.3.51:1925/ambilight/mode
{"current":"internal"}
http://192.168.3.51:1925/ambilight/cached
{"layer1":{"left":{"0":{"r":0,"g":0,"b":0},"1":{"r":0,"g":0,"b":0},"2":{"r":0,"g":0,"b":0},"3":{"r":0,"g":0,"b":0}},"top":{"0":{"r":0,"g":0,"b":0},"1":{"r":0,"g":0,"b":0},"2":{"r":0,"g":0,"b":0},"3":{"r":0,"g":0,"b":0},"4":{"r":0,"g":0,"b":0},"5":{"r":0,"g":0,"b":0},"6":{"r":0,"g":0,"b":0},"7":{"r":0,"g":0,"b":0}},"right":{"0":{"r":0,"g":0,"b":0},"1":{"r":0,"g":0,"b":0},"2":{"r":0,"g":0,"b":0},"3":{"r":0,"g":0,"b":0}}}}
http://192.168.3.51:1925/ambilight/topology
{"layers":"1","left":4,"top":8,"bottom":0,"right":4}
http://192.168.3.51:1925/ambilight/measured
{"layer1":{"left":{"0":{"r":43,"g":18,"b":24},"1":{"r":122,"g":79,"b":84},"2":{"r":114,"g":154,"b":130},"3":{"r":164,"g":189,"b":191}},"top":{"0":{"r":173,"g":189,"b":191},"1":{"r":178,"g":186,"b":186},"2":{"r":186,"g":180,"b":172},"3":{"r":192,"g":186,"b":172},"4":{"r":196,"g":192,"b":181},"5":{"r":193,"g":187,"b":173},"6":{"r":192,"g":186,"b":172},"7":{"r":196,"g":188,"b":179}},"right":{"0":{"r":196,"g":191,"b":185},"1":{"r":113,"g":108,"b":115},"2":{"r":69,"g":75,"b":88},"3":{"r":56,"g":51,"b":23}}}}
http://192.168.3.51:1925/ambilight/processed
{"layer1":{"left":{"0":{"r":145,"g":7,"b":32},"1":{"r":254,"g":75,"b":92},"2":{"r":102,"g":255,"b":158},"3":{"r":162,"g":245,"b":254}},"top":{"0":{"r":188,"g":247,"b":254},"1":{"r":222,"g":255,"b":254},"2":{"r":254,"g":231,"b":202},"3":{"r":254,"g":233,"b":186},"4":{"r":254,"g":240,"b":203},"5":{"r":254,"g":235,"b":184},"6":{"r":254,"g":234,"b":186},"7":{"r":254,"g":226,"b":197}},"right":{"0":{"r":254,"g":234,"b":213},"1":{"r":243,"g":213,"b":254},"2":{"r":133,"g":164,"b":254},"3":{"r":201,"g":164,"b":29}}}}
@SchmuFoo
Copy link

SchmuFoo commented Dec 25, 2019

@Stormbringer11

I have an 58PUS7304/12 (2019) Modell and 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/

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
Copy link

SchmuFoo commented Dec 25, 2019

P.S. with regard to the Ports and Protocols:

Luckily I was able to use the plain HTTP Socket at 1925 (For Ambilight ONLY) without any pairing or authentication on that AndroidTV Version 9.0 (!) - This confirms something I found on the web:

"That the API is on version 6 doesn’t necessarily mean that it uses port 1926 though. I’ve been in contact with someone else who has also been developing a Jointspace API client and has had contact with someone at Philips responsible for the API. What he says is that all Android TV’s should use port 1926 and all non-Android TV’s should use 1925. Also, apparently Android TV’s only support the /6/system endpoint on port 1925 to comply with older clients and should also work in 1926."

For most of the other stuff the API Level 6 with HTTPS and Authentication is needed :-/ I sniffed the connection between the official Philips TV Remote App, Decrypted the SSL and checked what the App is using when pressing Standby:

But this POST command is not working at plain 1925..

image

@marcelrv
Copy link
Author

thank @SchmuFoo
I did not know the Telerik Fiddler you use.... is very helpful in testing this stuff in windows

@skribb
Copy link

skribb commented Jan 5, 2020

after a few hours the TV's server refuses commands "No connection could be made because the target machine actively refused it"

if i kill the power to the TV (pull the cable) and restart the TV, it accepts commands again, for a while. does anyone know what this could be? I have a PUS6754 and i'm using Python to send commands
import httplib
key='{"key": "Standby"}'
h = httplib.HTTPConnection('192.168.0.xxx:1925')
h.request('POST','/6/input/key', key)

r = h.getresponse()

print r.read()

@SchmuFoo
Copy link

after a few hours the TV's server refuses commands "No connection could be made because the target machine actively refused it"

if i kill the power to the TV (pull the cable) and restart the TV, it accepts commands again, for a while. does anyone know what this could be? I have a PUS6754 and i'm using Python to send commands
import httplib
key='{"key": "Standby"}'
h = httplib.HTTPConnection('192.168.0.xxx:1925')
h.request('POST','/6/input/key', key)

r = h.getresponse()

print r.read()

I have an similiar problem from time to time with my 58PUS7304/12 - Unfurtunately the PowerCord Off/On didnt solve it then. The only thing I can do is wait.

Verbose: Sometimes both API Ports are not open any more, then also the official Philips Remote App is not working any more. Didnt found a solution for that, only can wait then always until they are up again.

Working

On my 7304 from 2019 there IS an response (most of the time) on:
http://IP:1925/system
https://IP:1926/system
http://IP:1925/6/system
https://IP:1926/6/system

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

Non working

`loxberry@loxberry:~ $ nmap -sT -P0 philipstv
Starting Nmap 7.40 ( https://nmap.org ) at 2020-01-12 20:26 CET
Nmap scan report for philipstv (192.168.178.75)
Host is up (0.0019s latency).
rDNS record for 192.168.178.75: PhilipsTV.fritz.box
Not shown: 995 closed ports
PORT      STATE SERVICE
8008/tcp  open  http
8009/tcp  open  ajp13
8443/tcp  open  https-alt
9000/tcp  open  cslistener
49153/tcp open  unknown

Nmap done: 1 IP address (1 host up) scanned in 0.34 seconds
loxberry@loxberry:~ $ nmap -sT -P0 philipstv -p 1925,1926
loxberry@loxberry:~ $ nmap -sT -P0 philipstv -p 1925,1926

Starting Nmap 7.40 ( https://nmap.org ) at 2020-01-12 20:09 CET
Nmap scan report for philipstv (192.168.178.75)
Host is up (0.00053s latency).
rDNS record for 192.168.178.75: PhilipsTV.fritz.box
PORT     STATE  SERVICE
1925/tcp closed discovery-port
1926/tcp closed egs

Nmap done: 1 IP address (1 host up) scanned in 0.23 seconds

@stereodruid
Copy link

Is there a way to change the input source? My PhilipsTV is on Version 6.1, so this "/sources/current {"id":"hdm2"}" is not working for me. Any idea? Btw, on Port: https://IP:1926/6/, i can use some commands.

@stevefury
Copy link

i did write u tutorial to install and control it with domoticz
https://www.domoticz.com/forum/viewtopic.php?f=47&t=35475

@rhpijnacker
Copy link

Does anyone happen to know whether it is possible to control the volume of the headphone audio channel using the JointSpace API?
So far I haven't found anything.

(Context: we are using a sound system connected via the headphone jack. Controlling the volume works fine with an older firmware version, it picks up that it should control the headphones audio automatically. However after updating the firmware to the latest version, this stops working, even if we tell the TV not to send out audio over the internal boxes.)

@GustavoContreiras
Copy link

GustavoContreiras commented Mar 26, 2023

I'm trying to run this project https://github.com/suborb/philips_android_tv to do the pairing on my Philips Ambilight TV but I'm receiving:
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='192.168.X.X', port=1926): Max retries exceeded with url: /6/pair/request (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000001E17FF3D8D0>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it'))

Does anyone have any idea? It should trigger the activation code in the TV

@S474N
Copy link

S474N commented Apr 8, 2023

I have Philips TV (without android), but 6 commands works. But I have problem with turning off ambilight.

Payload {"styleName":"FOLLOW_VIDEO","isExpert":false,"menuSetting":"STANDARD"} to http://TV-IP:1925/6/ambilight/currentconfiguration works perfectly, but I don't know command to turn ambilight off.

Does anyone have any idea?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment