newAM / hisensetv

Python API to control Hisense brand TVs via their internal MQTT broker.
MIT License
37 stars 16 forks source link

Timeout on macos #18

Open coralie-noyer opened 2 years ago

coralie-noyer commented 2 years ago

Hello

I tried to work with this but I have a hisensetv.HisenseTvTimeoutError: failed to recieve a response in 10.000s error

First time I do hisensetv myip --authorize my TV show me a code and I typed the code in my terminal after, I would like to get info volume but I get this timeouterror, then I tried again to authorize and I get again this error

How to work with this please ?

newAM commented 2 years ago

You got it to authorize which is good - it means something is working.

Beyond that I would need a wireshark capture to debug - there are many different reasons this might not be working.

coralie-noyer commented 2 years ago

Thanks but how to do this ?

newAM commented 2 years ago

It depends on your background knowledge in this area. If you do not know what a port, IP address, or TCP connection is start there; these concepts have not changed in a long time so there is a lot of good learning material out there. After you have that knowledge search for a tutorial on wireshark and filter for connections between your mac running the code and your TV.

There are no shortcuts here unfortunately. The MQTT interface on the TV is buggy, and was not designed to be used this way; packet capture tools like wireshark are the best way to debug.

alob-mtc commented 1 year ago

@newAM i'm getting time out at authorize

kira2@kira ~ % hisensetv 10.0.0.128 --authorize
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.11/bin/hisensetv", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/hisensetv/__main__.py", line 125, in main
    with tv:
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/hisensetv/__init__.py", line 120, in __enter__
    self._mqtt_client.connect(self.hostname, self.port)
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/paho/mqtt/client.py", line 914, in connect
    return self.reconnect()
           ^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/paho/mqtt/client.py", line 1044, in reconnect
    sock = self._create_socket_connection()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/paho/mqtt/client.py", line 3685, in _create_socket_connection
    return socket.create_connection(addr, timeout=self._connect_timeout, source_address=source)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socket.py", line 851, in create_connection
    raise exceptions[0]
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socket.py", line 836, in create_connection
    sock.connect(sa)
TimeoutError: timed out