Closed giotdev closed 6 years ago
ImportError: No module named 'websocket'
There is something wrong with out websocket installation.
What does pip3 --version
print on your system?
What does pip3 --version print on your system?
pip 9.0.1 from /home/pi/.local/lib/python3.5/site-packages (python 3.5)
Also checked wireshark capture between SmartView iPhone App and the TV.
They first exchange the device and app details. Then the App initiates pairing to TV on port 8080. After that, there are some WebSocket packets on TV port 8000 and HTTP packets on TV port 8001
I think I might have found your problem. Your pip3
uses a different site-packages folder than your HA python installation:
pip3: /home/pi/.local/lib/python3.5/site-packages
HA: /srv/homeassistant/lib/python3.5/site-packages
You probably have to use pip
in the HA python installation.
You probably have to use pip in the HA python installation.
You are absolutely right. I have to install websocket-client in the homeassistant virtualenv. Now the websocket works but I don't think the remote function will work.
I can see HA sent to following to TV in websocket: {"params": {"TypeOfRemote": "SendRemoteKey", "DataOfCmd": "KEY", "Cmd": "Click", "Option": "false"}, "method": "ms.remote.control"} and TV response: {"event":"ms.error","data":{"message":"unrecognized method value : ms.remote.control"}}
Also HA sent some PSH packets in TCP to TV port 8001, I believe this is the KEY values: 81:fe:00:86:ff:c0:be:48:84:e2:ce:29:8d:a1:d3:3b:dd:fa:9e:33:dd:94:c7:38:9a:8f:d8:1a:9a:ad:d1:3c:9a:e2:84:68:dd:93:db:26:9b:92:db:25:90:b4:db:03:9a:b9:9c:64:df:e2:fa:29:8b:a1:f1:2e:bc:ad:da:6a:c5:e0:9c:03:ba:99:e1:0e:b9:e2:92:68:dd:83:d3:2c:dd:fa:9e:6a:bc:ac:d7:2b:94:e2:92:68:dd:8f:ce:3c:96:af:d0:6a:c5:e0:9c:2e:9e:ac:cd:2d:dd:bd:92:68:dd:ad:db:3c:97:af:da:6a:c5:e0:9c:25:8c:ee:cc:2d:92:af:ca:2d:d1:a3:d1:26:8b:b2:d1:24:dd:bd
And nothing happen on the TV
Duplicate of #22
This is 2014 model, so try the traditional way with port 55000. Seems the TV reject to setup the TCP![image](https://user-images.githubusercontent.com/31511005/29925365-7630785c-8ea3-11e7-9dac-a619ad7db12d.png)
Try the websocket method. Installed websocket with command "sudo pip3 install websocket-client". When restart HA, got the error below:
hass[17816]: 2017-08-31 13:25:10 ERROR (MainThread) [homeassistant.helpers.entity] Update for media_player.samsung_tv_remote fails hass[17816]: Traceback (most recent call last): hass[17816]: File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity.py", line 225, in async_update_ha_state hass[17816]: yield from self.hass.async_add_job(self.update) hass[17816]: File "/usr/lib/python3.5/asyncio/futures.py", line 380, in iter hass[17816]: yield self # This tells Task to wait for completion. hass[17816]: File "/usr/lib/python3.5/asyncio/tasks.py", line 304, in _wakeup hass[17816]: future.result() hass[17816]: File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result hass[17816]: raise self._exception hass[17816]: File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run hass[17816]: result = self.fn(*self.args, **self.kwargs) hass[17816]: File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/media_player/samsungtv.py", line 121, in update hass[17816]: return self.send_key('KEY') hass[17816]: File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/media_player/samsungtv.py", line 134, in send_key hass[17816]: self.get_remote().control(key) hass[17816]: File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/media_player/samsungtv.py", line 127, in get_remote hass[17816]: self._remote = self._remote_class(self._config) hass[17816]: File "/srv/homeassistant/lib/python3.5/site-packages/samsungctl/remote.py", line 10, in init hass[17816]: self.remote = RemoteWebsocket(config) hass[17816]: File "/srv/homeassistant/lib/python3.5/site-packages/samsungctl/remote_websocket.py", line 13, in init hass[17816]: import websocket hass[17816]: ImportError: No module named 'websocket'
did I install the websocket correctly?