Closed thehijacker closed 11 months ago
Hey there @elupus, mind taking a look at this issue as it has been labeled with an integration (philips_js
) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)
philips_js documentation philips_js source (message by IssueLinks)
I don't be able to figure this out myself. You or somebody else would need to try to find out why some modern os versions fail to pair.
Might be worth extracting the xtv
APK from the TV and disassembling that.
Where to start? What url should I check? And this is Improved OS, not Android. Not sure if there are APK files on it.
Oh right not Android. Then its trickier. You could set up a mitm proxy i suppose and look at what the official client does.
Its also possible to grab official android client and disassemble that. Maybe they have changed something in the sequence that we are missing.
mitm proxy? Android client? Can you point me please in right direction and I will take a look at it. Thank you.
Hello, Same with my 50PUS7608_12, cannot connect with API v6. I've install mitmproxy on my computer but cannot set proxy at all in the network settings of TV. i'll try to have a look in few days, if i can manage something with the mirror port of my switch.
The proxy should be on your android phone, not the tv.
Just tried official Smart TV app on my Phone. It too can not find the TV. Even using QR code or direct IP. I suspect this is a software issue on the TV itself.
flows.txt thanks for the advice with the android phone. Mine works with the Android app Phillips SmartTV Can you have a look to mitm file ?
Could any of you test out https://github.com/danielperna84/ha-philipsjs/pull/34. if you pip install that branch:
pip install git+https://github.com/elupus/ha-philipsjs@authfix
You should be able to use it's command line utility to try to pair with your tv.
python -m haphilipsjs -i HOSTNAME -a 6 pair
I have just tried it. Same error.
@thehijacker check if there is some setting on the tv that enable remote control.
@rommess can you also try? Did you also get the forbidden error in home assistant?
@thehijacker i just noticed its pairing on http, it should havetried https. Can you try to force it with:
python -m haphilipsjs -i HOSTNAME -a 6 -s pair
This is what I get with extra -s parameter.
➜ ~ python -m haphilipsjs -i 192.168.28.95 -a 6 -s pair INFO:httpx:HTTP Request: GET https://192.168.28.95:1926/6/system "HTTP/1.1 200 OK" INFO:haphilipsjs:Switching to unsecured transport INFO:httpx:HTTP Request: POST http://192.168.28.95:1925/6/pair/request "HTTP/1.1 403 Forbidden" Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "/usr/lib/python3.11/site-packages/haphilipsjs/__main__.py", line 342, in <module> asyncio.run(main()) File "/usr/lib/python3.11/asyncio/runners.py", line 190, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/asyncio/runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/haphilipsjs/__main__.py", line 210, in main await run(args, parser, tv) File "/usr/lib/python3.11/site-packages/haphilipsjs/__main__.py", line 296, in run state = await tv.pairRequest( ^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/haphilipsjs/__init__.py", line 660, in pairRequest raise NoneJsonData(resp.text) haphilipsjs.NoneJsonData: Non json data received: <html><head><title>Forbidden</title></head><body>Forbidden</body></html>
I have checked on TV. Where should the option to enabled remote access be? Keep in mind this is the new Improved OS. Not Saphi anymore.
Oh, it switched back to non secure on pairing. Can you grab the system info from that system again. Something is fishy.
Sure.
On URL http://192.168.28.95:1925/6/system I get:
{
"menulanguage": "Slovenian",
"name": "65PML9008/12",
"country": "Slovenia",
"serialnumber_encrypted": "K2kseVsmQFgkd15gKkJ+ai7ECTaaaaaaaaaaaa=",
"softwareversion_encrypted": "K2kseVsmQFgkd15gKkJ+atJJI6kYBl5fIhF2Isg2DFHebbbbbbbbbbbb",
"model_encrypted": "K2kseVsmQFgkd15gKkJ+aj3tXcccccccccccccc=",
"deviceid_encrypted": "K2kseVsmQFgkd15gKkJ+ddddddddddddddd=",
"nettvversion": "",
"epgsource": "no_epg",
"api_version": {
"Major": 6,
"Minor": 1,
"Patch": 0
},
"featuring": {
"jsonfeatures": {
"recordings": [
"List",
"Schedule",
"Manage"
],
"ambilight": [
"Ambilight"
],
"textentry": [
"context_based",
"initial_string_available"
],
"inputkey": [
"key",
"unicode"
],
"pointer": [
"context_based"
],
"activities": [
"browser"
],
"aurora": [
"available"
]
},
"systemfeatures": {
"tvtype": "consumer",
"content": [
"dmr"
],
"pairing_type": "digest_auth_pairing",
"secured_transport": true,
"os_type": "Linux"
}
}
}
Its using true, instead of a string of "true" for secured transport. 😔..
I have added a fix to my branch. Can you re install the python lib and try again.
I have issues this command again in HA terminal:
pip install git+https://github.com/elupus/ha-philipsjs@authfix
And then:
python -m haphilipsjs -i 192.168.28.95 -a 6 pair
or
python -m haphilipsjs -i 192.168.28.95 -a 6 -s pair
But I still get forbidden:
INFO:httpx:HTTP Request: GET http://192.168.28.95:1925/6/system "HTTP/1.1 200 OK"
INFO:httpx:HTTP Request: POST http://192.168.28.95:1925/6/pair/request "HTTP/1.1 403 Forbidden"
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/usr/lib/python3.11/site-packages/haphilipsjs/__main__.py", line 342, in <module>
asyncio.run(main())
File "/usr/lib/python3.11/asyncio/runners.py", line 190, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/haphilipsjs/__main__.py", line 210, in main
await run(args, parser, tv)
File "/usr/lib/python3.11/site-packages/haphilipsjs/__main__.py", line 296, in run
state = await tv.pairRequest(
^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/haphilipsjs/__init__.py", line 660, in pairRequest
raise NoneJsonData(resp.text)
haphilipsjs.NoneJsonData: Non json data received: <html><head><title>Forbidden</title></head><body>Forbidden</body></html>
Should I enable anything on TV?
I think you need to uninstall the library, then install it again it get the new version.
pip uninstall haphilipsjs
Or
pip uninstall ha-philipsjs
Much better! It shows PIN on TV. But when I type it I get an error. The text "Please enter pin displayed on scree" is not complete. Maybe this is the problem?
➜ ~ python -m haphilipsjs -i 192.168.28.95 -a 6 -s pair
INFO:httpx:HTTP Request: GET https://192.168.28.95:1926/6/system "HTTP/1.1 200 OK"
INFO:httpx:HTTP Request: POST https://192.168.28.95:1926/6/pair/request "HTTP/1.1 200 OK"
Please enter pin displayed on scree4639
INFO:httpx:HTTP Request: POST https://192.168.28.95:1926/6/pair/grant "HTTP/1.1 401 Unauthorized"
INFO:httpx:HTTP Request: POST https://192.168.28.95:1926/6/pair/grant "HTTP/1.1 200 OK"
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/usr/lib/python3.11/site-packages/haphilipsjs/__main__.py", line 342, in <module>
asyncio.run(main())
File "/usr/lib/python3.11/asyncio/runners.py", line 190, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/haphilipsjs/__main__.py", line 210, in main
await run(args, parser, tv)
File "/usr/lib/python3.11/site-packages/haphilipsjs/__main__.py", line 302, in run
res = await tv.pairGrant(state, pin)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/haphilipsjs/__init__.py", line 697, in pairGrant
raise PairingFailure(data_response)
haphilipsjs.PairingFailure: Failed to start pairing: {'error_id': 'INVALID_PIN', 'error_text': 'Invalid authentication parameters'}
Okey, found out we where using wrong signature.. Oddly android TV's doesn't check it at all :). Please uninstall and re-install package again and try.
Better. I got a username and password now.
Nice! You should be able to use the "status" commend with those login values.
python -m haphilipsjs -i 192.168.28.95 -a 6 -u USERNAME -p PASSWORD status
Sorry for delay. Was out of house. This is the result of status page:
➜ ~ python -m haphilipsjs -i 192.168.28.95 -a 6 -u 7e287d8e3eac7244d8ecda41e845fc09 -p hraklrdaszm0l0pm status
INFO:httpx:HTTP Request: GET http://192.168.28.95:1925/6/system "HTTP/1.1 200 OK"
INFO:haphilipsjs:Switching to secured transport
INFO:httpx:HTTP Request: GET https://192.168.28.95:1926/6/channeldb/tv "HTTP/1.1 401 Unauthorized"
INFO:httpx:HTTP Request: GET https://192.168.28.95:1926/6/channeldb/tv "HTTP/1.1 200 OK"
INFO:httpx:HTTP Request: GET https://192.168.28.95:1926/6/ambilight/supportedstyles "HTTP/1.1 200 OK"
INFO:httpx:HTTP Request: GET https://192.168.28.95:1926/6/ambilight/cached "HTTP/1.1 200 OK"
INFO:httpx:HTTP Request: GET https://192.168.28.95:1926/6/powerstate "HTTP/1.1 200 OK"
INFO:httpx:HTTP Request: GET https://192.168.28.95:1926/6/audio/volume "HTTP/1.1 200 OK"
INFO:httpx:HTTP Request: GET https://192.168.28.95:1926/6/context "HTTP/1.1 200 OK"
INFO:httpx:HTTP Request: GET https://192.168.28.95:1926/6/screenstate "HTTP/1.1 200 OK"
INFO:httpx:HTTP Request: GET https://192.168.28.95:1926/6/ambilight/mode "HTTP/1.1 200 OK"
INFO:httpx:HTTP Request: GET https://192.168.28.95:1926/6/ambilight/power "HTTP/1.1 200 OK"
INFO:httpx:HTTP Request: GET https://192.168.28.95:1926/6/ambilight/currentconfiguration "HTTP/1.1 200 OK"
INFO:httpx:HTTP Request: GET https://192.168.28.95:1926/6/recordings/list "HTTP/1.1 404 Not Found"
System: {'menulanguage': 'Slovenian', 'name': '65PML9008/12', 'country': 'Slovenia', 'serialnumber': 'FZ1A2334019108', 'softwareversion': '-000.000.000.000', 'model': 'TPN238E', 'deviceid': '1110588357', 'nettvversion': '', 'epgsource': 'no_epg', 'api_version': {'Major': 6, 'Minor': 1, 'Patch': 0}, 'featuring': {'jsonfeatures': {'recordings': ['List', 'Schedule', 'Manage'], 'ambilight': ['Ambilight'], 'textentry': ['context_based', 'initial_string_available'], 'inputkey': ['key', 'unicode'], 'pointer': ['context_based'], 'activities': ['browser'], 'aurora': ['available']}, 'systemfeatures': {'tvtype': 'consumer', 'content': ['dmr'], 'pairing_type': 'digest_auth_pairing', 'secured_transport': True, 'os_type': 'Linux'}}}
Source: None
Channel: None: None
Context: {'level1': 'WatchExtension', 'level2': 'NA', 'level3': 'NA', 'data': 'NA', 'Recording': 'On'}
Application: None
Power State: On
Screen State: Off
INFO:httpx:HTTP Request: GET https://192.168.28.95:1926/6/ambilight/power "HTTP/1.1 200 OK"
Ambilight power: On
Ambilight mode: internal
INFO:httpx:HTTP Request: GET https://192.168.28.95:1926/6/ambilight/topology "HTTP/1.1 200 OK"
Ambilight topology: {'layers': 1, 'left': 5, 'top': 9, 'right': 5, 'bottom': 0}
INFO:httpx:HTTP Request: GET https://192.168.28.95:1926/6/ambilight/processed "HTTP/1.1 200 OK"
Ambilight processed: {'layer1': {'left': {'0': {'r': 76, 'g': 199, 'b': 254}, '1': {'r': 30, 'g': 114, 'b': 255}, '2': {'r': 36, 'g': 97, 'b': 255}, '3': {'r': 38, 'g': 147, 'b': 254}, '4': {'r': 53, 'g': 135, 'b': 253}}, 'top': {'0': {'r': 100, 'g': 156, 'b': 253}, '1': {'r': 30, 'g': 81, 'b': 255}, '2': {'r': 30, 'g': 70, 'b': 254}, '3': {'r': 6, 'g': 65, 'b': 254}, '4': {'r': 7, 'g': 76, 'b': 254}, '5': {'r': 21, 'g': 162, 'b': 255}, '6': {'r': 18, 'g': 125, 'b': 246}, '7': {'r': 4, 'g': 69, 'b': 254}, '8': {'r': 10, 'g': 78, 'b': 254}}, 'right': {'0': {'r': 7, 'g': 77, 'b': 254}, '1': {'r': 3, 'g': 75, 'b': 255}, '2': {'r': 18, 'g': 45, 'b': 114}, '3': {'r': 53, 'g': 92, 'b': 251}, '4': {'r': 13, 'g': 75, 'b': 253}}, 'bottom': {}}}
INFO:httpx:HTTP Request: GET https://192.168.28.95:1926/6/ambilight/measured "HTTP/1.1 200 OK"
Ambilight measured: {'layer1': {'left': {'0': {'r': 76, 'g': 199, 'b': 254}, '1': {'r': 30, 'g': 116, 'b': 254}, '2': {'r': 34, 'g': 96, 'b': 255}, '3': {'r': 39, 'g': 147, 'b': 254}, '4': {'r': 54, 'g': 137, 'b': 252}}, 'top': {'0': {'r': 101, 'g': 158, 'b': 252}, '1': {'r': 31, 'g': 79, 'b': 255}, '2': {'r': 27, 'g': 72, 'b': 254}, '3': {'r': 6, 'g': 65, 'b': 254}, '4': {'r': 7, 'g': 75, 'b': 255}, '5': {'r': 21, 'g': 160, 'b': 255}, '6': {'r': 20, 'g': 134, 'b': 246}, '7': {'r': 4, 'g': 70, 'b': 254}, '8': {'r': 10, 'g': 78, 'b': 254}}, 'right': {'0': {'r': 7, 'g': 77, 'b': 254}, '1': {'r': 3, 'g': 74, 'b': 255}, '2': {'r': 19, 'g': 50, 'b': 126}, '3': {'r': 63, 'g': 95, 'b': 249}, '4': {'r': 15, 'g': 77, 'b': 253}}, 'bottom': {}}}
Ambilight styles: [{'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', 'STROBE', 'PARTY'], 'maxTuning': 2}, {'styleName': 'FOLLOW_COLOR', 'algorithms': ['MANUAL_HUE', 'AUTOMATIC_HUE'], 'maxSpeed': 255}]
Ambilight currentconfiguration: {'styleName': 'FOLLOW_VIDEO', 'isExpert': False, 'menuSetting': 'NATURAL', 'stringValue': 'Natural'}
Ambilight+Hue State: None
Do I need to wait for new HA release for the changes or it should already work from Philips TV addon?
Ive tagged it for next bug fix release. If it misses that it will be in next full release.
sorry guys, missed your tests. thanks @elupus and @thehijacker
The problem
I can not add a new model 65PML9008/12 in the Philips TV integration. I get an Unknown error occurred
What version of Home Assistant Core has the issue?
core-2023.9.2
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant OS
Integration causing the issue
Philips TV
Link to integration documentation on our website
https://www.home-assistant.io/integrations/philips_js/
Diagnostics information
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
Additional information
Output of http://IP_Address:1925/system