eslavnov / pylips

Control Philips TVs (2015+) and Ambilight (+ Hue) through their reverse-engineered API (+ MQTT support!)
MIT License
334 stars 58 forks source link

[BUG] IP blocked by TV #106

Open B3rt opened 3 years ago

B3rt commented 3 years ago

My IP of my server where the API is running on seems to be blocked by the TV (after a restart of my server). I can connect to the TV using telnet and port but the TV does not respond.

When i try from an other system in the same network the API of the TV works fine, but when run from my server (NAS) it keeps reporting cannot reach API. It can connect to IP and port but the TV part API simply does not respond.

It seems that my TV has a build in firewall which blocks IP, but i cannot find any setting or option to disable or flush it. A TV system restart had no effect.

From 1 system i get: HTTP request sent, awaiting response... 200 OK Length: 1107 (1.1K) [application/json] Saving to: 'system'

Same call from the system which does not work: HTTP request sent, awaiting response... 200 OK Length: 1107 (1.1K) [application/json] system: Permission denied

How can i unblock this system?

B3rt commented 3 years ago

stil having issues:

here a fail paring output:

Checking API version and port... Trying http://192.168.1.140:1925/6/system No valid credentials found, starting pairing process... Sending pairing request https://192.168.1.140:1926/6/pair/request Traceback (most recent call last): File "/volume1/@appstore/python3/lib/python3.7/site-packages/urllib3/connectionpool.py", line 382, in _make_request self._validate_conn(conn) File "/volume1/@appstore/python3/lib/python3.7/site-packages/urllib3/connectionpool.py", line 1010, in _validate_conn conn.connect() File "/volume1/@appstore/python3/lib/python3.7/site-packages/urllib3/connection.py", line 421, in connect tls_in_tls=tls_intls, File "/volume1/@appstore/python3/lib/python3.7/site-packages/urllib3/util/ssl.py", line 432, in ssl_wrap_socket ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_intls) File "/volume1/@appstore/python3/lib/python3.7/site-packages/urllib3/util/ssl.py", line 474, in _ssl_wrap_socket_impl return ssl_context.wrap_socket(sock) File "/volume1/@appstore/python3/lib/python3.7/ssl.py", line 423, in wrap_socket session=session File "/volume1/@appstore/python3/lib/python3.7/ssl.py", line 870, in _create self.do_handshake() File "/volume1/@appstore/python3/lib/python3.7/ssl.py", line 1139, in do_handshake self._sslobj.do_handshake() socket.timeout: _ssl.c:1074: The handshake operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/volume1/@appstore/python3/lib/python3.7/site-packages/requests/adapters.py", line 449, in send timeout=timeout File "/volume1/@appstore/python3/lib/python3.7/site-packages/urllib3/connectionpool.py", line 756, in urlopen method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2] File "/volume1/@appstore/python3/lib/python3.7/site-packages/urllib3/util/retry.py", line 532, in increment raise six.reraise(type(error), error, _stacktrace) File "/volume1/@appstore/python3/lib/python3.7/site-packages/urllib3/packages/six.py", line 735, in reraise raise value File "/volume1/@appstore/python3/lib/python3.7/site-packages/urllib3/connectionpool.py", line 706, in urlopen chunked=chunked, File "/volume1/@appstore/python3/lib/python3.7/site-packages/urllib3/connectionpool.py", line 385, in _make_request self._raise_timeout(err=e, url=url, timeout_value=conn.timeout) File "/volume1/@appstore/python3/lib/python3.7/site-packages/urllib3/connectionpool.py", line 337, in _raise_timeout self, url, "Read timed out. (read timeout=%s)" % timeout_value urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='192.168.1.140', port=1926): Read timed out. (read timeout=2)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/volume1/web/api/pylips_http/pylips.py", line 470, in pylips = Pylips(args.config) File "/volume1/web/api/pylips_http/pylips.py", line 86, in init self.pair() File "/volume1/web/api/pylips_http/pylips.py", line 194, in pair self.pair_request(data) File "/volume1/web/api/pylips_http/pylips.py", line 200, in pair_request r = session.post("https://" + str(self.config["TV"]["host"]) + ":1926/"+str(self.config["TV"]["apiv"])+"/pair/request", json=data, verify=False, timeout=2) File "/volume1/@appstore/python3/lib/python3.7/site-packages/requests/sessions.py", line 590, in post return self.request('POST', url, data=data, json=json, kwargs) File "/volume1/@appstore/python3/lib/python3.7/site-packages/requests/sessions.py", line 542, in request resp = self.send(prep, send_kwargs) File "/volume1/@appstore/python3/lib/python3.7/site-packages/requests/sessions.py", line 655, in send r = adapter.send(request, **kwargs) File "/volume1/@appstore/python3/lib/python3.7/site-packages/requests/adapters.py", line 529, in send raise ReadTimeout(e, request=request) requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='192.168.1.140', port=1926): Read timed out. (read timeout=2)

When i try: https://192.168.1.140:1926/6/system via a browser i get a error: De wachttijd voor de verbinding is verstreken

De server op 192.168.1.140 doet er te lang over om te antwoorden.

When i try: http://192.168.1.140:1925/6/system I get a listing.

But when i set the API to use port 1925 and protocol http:// i get an error Sending POST request to http://192.168.1.140:1925/6/input/key Request sent!

Status page

Not Found

The server has not found anything matching the request URI

You can get technical details here.
Please continue your visit at our home page.

I have no idea why this is not working, TV seems to block port 1926 randomly, after a while it can suddenly work again, but running API on port 1925 also results in an error...