Samsung TV component update that came in home assistant v0.107.1 is not working and is logging tracebacks.
Home Assistant 0.107.1
configuration.yamlsamsungtv:
- host: 192.168.1.100
name: TV
turn_on_action:
- service: wake_on_lan.send_magic_packet
data:
mac: "<redacted>"
Mar 19 17:48:39 pihome hass[2229]: 2020-03-19 17:48:39 WARNING (SyncWorker_4) [homeassistant.components.homekit.type_media_players] media_player.tv: Sources out of sync. Restart Home Assistant
Mar 19 17:49:27 pihome hass[2229]: 2020-03-19 17:49:27 ERROR (MainThread) [homeassistant.helpers.entity] Update for media_player.tv fails
Mar 19 17:49:27 pihome hass[2229]: Traceback (most recent call last):
Mar 19 17:49:27 pihome hass[2229]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_socket.py", line 102, in recv
Mar 19 17:49:27 pihome hass[2229]: bytes_ = _recv()
Mar 19 17:49:27 pihome hass[2229]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_socket.py", line 84, in _recv
Mar 19 17:49:27 pihome hass[2229]: return sock.recv(bufsize)
Mar 19 17:49:27 pihome hass[2229]: File "/usr/lib/python3.7/ssl.py", line 1037, in recv
Mar 19 17:49:27 pihome hass[2229]: return self.read(buflen)
Mar 19 17:49:27 pihome hass[2229]: File "/usr/lib/python3.7/ssl.py", line 913, in read
Mar 19 17:49:27 pihome hass[2229]: return self._sslobj.read(len)
Mar 19 17:49:27 pihome hass[2229]: socket.timeout: The read operation timed out
Mar 19 17:49:27 pihome hass[2229]: During handling of the above exception, another exception occurred:
Mar 19 17:49:27 pihome hass[2229]: Traceback (most recent call last):
Mar 19 17:49:27 pihome hass[2229]: File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 279, in async_update_ha_state
Mar 19 17:49:27 pihome hass[2229]: await self.async_device_update()
Mar 19 17:49:27 pihome hass[2229]: File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 476, in async_device_update
Mar 19 17:49:27 pihome hass[2229]: await self.hass.async_add_executor_job(self.update)
Mar 19 17:49:27 pihome hass[2229]: File "/usr/lib/python3.7/concurrent/futures/thread.py", line 57, in run
Mar 19 17:49:27 pihome hass[2229]: result = self.fn(*self.args, **self.kwargs)
Mar 19 17:49:27 pihome hass[2229]: File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/samsungtv/media_player.py", line 127, in update
Mar 19 17:49:27 pihome hass[2229]: self._state = STATE_ON if self._bridge.is_on() else STATE_OFF
Mar 19 17:49:27 pihome hass[2229]: File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/samsungtv/bridge.py", line 66, in is_on
Mar 19 17:49:27 pihome hass[2229]: return self._get_remote() is not None
Mar 19 17:49:27 pihome hass[2229]: File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/samsungtv/bridge.py", line 251, in _get_remote
Mar 19 17:49:27 pihome hass[2229]: self._remote.open()
Mar 19 17:49:27 pihome hass[2229]: File "/srv/homeassistant/lib/python3.7/site-packages/samsungtvws/remote.py", line 149, in open
Mar 19 17:49:27 pihome hass[2229]: response = self._process_api_response(self.connection.recv())
Mar 19 17:49:27 pihome hass[2229]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_core.py", line 313, in recv
Mar 19 17:49:27 pihome hass[2229]: opcode, data = self.recv_data()
Mar 19 17:49:27 pihome hass[2229]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_core.py", line 330, in recv_data
Mar 19 17:49:27 pihome hass[2229]: opcode, frame = self.recv_data_frame(control_frame)
Mar 19 17:49:27 pihome hass[2229]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_core.py", line 343, in recv_data_frame
Mar 19 17:49:27 pihome hass[2229]: frame = self.recv_frame()
Mar 19 17:49:27 pihome hass[2229]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_core.py", line 377, in recv_frame
Mar 19 17:49:27 pihome hass[2229]: return self.frame_buffer.recv_frame()
Mar 19 17:49:27 pihome hass[2229]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_abnf.py", line 361, in recv_frame
Mar 19 17:49:27 pihome hass[2229]: self.recv_header()
Mar 19 17:49:27 pihome hass[2229]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_abnf.py", line 309, in recv_header
Mar 19 17:49:27 pihome hass[2229]: header = self.recv_strict(2)
Mar 19 17:49:27 pihome hass[2229]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_abnf.py", line 396, in recv_strict
Mar 19 17:49:27 pihome hass[2229]: bytes_ = self.recv(min(16384, shortage))
Mar 19 17:49:27 pihome hass[2229]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_core.py", line 452, in _recv
Mar 19 17:49:27 pihome hass[2229]: return recv(self.sock, bufsize)
Mar 19 17:49:27 pihome hass[2229]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_socket.py", line 105, in recv
Mar 19 17:49:27 pihome hass[2229]: raise WebSocketTimeoutException(message)
Mar 19 17:49:27 pihome hass[2229]: websocket._exceptions.WebSocketTimeoutException: The read operation timed out
Mar 19 17:50:00 pihome hass[2229]: 2020-03-19 17:50:00 ERROR (MainThread) [homeassistant.helpers.entity] Update for media_player.tv fails
Mar 19 17:50:00 pihome hass[2229]: Traceback (most recent call last):
Mar 19 17:50:00 pihome hass[2229]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_socket.py", line 102, in recv
Mar 19 17:50:00 pihome hass[2229]: bytes_ = _recv()
Mar 19 17:50:00 pihome hass[2229]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_socket.py", line 84, in _recv
Mar 19 17:50:00 pihome hass[2229]: return sock.recv(bufsize)
Mar 19 17:50:00 pihome hass[2229]: File "/usr/lib/python3.7/ssl.py", line 1037, in recv
Mar 19 17:50:00 pihome hass[2229]: return self.read(buflen)
Mar 19 17:50:00 pihome hass[2229]: File "/usr/lib/python3.7/ssl.py", line 913, in read
Mar 19 17:50:00 pihome hass[2229]: return self._sslobj.read(len)
Mar 19 17:50:00 pihome hass[2229]: socket.timeout: The read operation timed out
Mar 19 17:50:00 pihome hass[2229]: During handling of the above exception, another exception occurred:
Mar 19 17:50:00 pihome hass[2229]: Traceback (most recent call last):
Mar 19 17:50:00 pihome hass[2229]: File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 279, in async_update_ha_state
Mar 19 17:50:00 pihome hass[2229]: await self.async_device_update()
Mar 19 17:50:00 pihome hass[2229]: File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 476, in async_device_update
Mar 19 17:50:00 pihome hass[2229]: await self.hass.async_add_executor_job(self.update)
Mar 19 17:50:00 pihome hass[2229]: File "/usr/lib/python3.7/concurrent/futures/thread.py", line 57, in run
Mar 19 17:50:00 pihome hass[2229]: result = self.fn(*self.args, **self.kwargs)
Mar 19 17:50:00 pihome hass[2229]: File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/samsungtv/media_player.py", line 127, in update
Mar 19 17:50:00 pihome hass[2229]: self._state = STATE_ON if self._bridge.is_on() else STATE_OFF
Mar 19 17:50:00 pihome hass[2229]: File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/samsungtv/bridge.py", line 66, in is_on
Mar 19 17:50:00 pihome hass[2229]: return self._get_remote() is not None
Mar 19 17:50:00 pihome hass[2229]: File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/samsungtv/bridge.py", line 251, in _get_remote
Mar 19 17:50:00 pihome hass[2229]: self._remote.open()
Mar 19 17:50:00 pihome hass[2229]: File "/srv/homeassistant/lib/python3.7/site-packages/samsungtvws/remote.py", line 149, in open
Mar 19 17:50:00 pihome hass[2229]: response = self._process_api_response(self.connection.recv())
Mar 19 17:50:00 pihome hass[2229]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_core.py", line 313, in recv
Mar 19 17:50:00 pihome hass[2229]: opcode, data = self.recv_data()
Mar 19 17:50:00 pihome hass[2229]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_core.py", line 330, in recv_data
Mar 19 17:50:00 pihome hass[2229]: opcode, frame = self.recv_data_frame(control_frame)
Mar 19 17:50:00 pihome hass[2229]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_core.py", line 343, in recv_data_frame
Mar 19 17:50:00 pihome hass[2229]: frame = self.recv_frame()
Mar 19 17:50:00 pihome hass[2229]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_core.py", line 377, in recv_frame
Mar 19 17:50:00 pihome hass[2229]: return self.frame_buffer.recv_frame()
Mar 19 17:50:00 pihome hass[2229]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_abnf.py", line 361, in recv_frame
Mar 19 17:50:00 pihome hass[2229]: self.recv_header()
Mar 19 17:50:00 pihome hass[2229]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_abnf.py", line 309, in recv_header
Mar 19 17:50:00 pihome hass[2229]: header = self.recv_strict(2)
Mar 19 17:50:00 pihome hass[2229]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_abnf.py", line 396, in recv_strict
Mar 19 17:50:00 pihome hass[2229]: bytes_ = self.recv(min(16384, shortage))
Mar 19 17:50:00 pihome hass[2229]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_core.py", line 452, in _recv
Mar 19 17:50:00 pihome hass[2229]: return recv(self.sock, bufsize)
Mar 19 17:50:00 pihome hass[2229]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_socket.py", line 105, in recv
Mar 19 17:50:00 pihome hass[2229]: raise WebSocketTimeoutException(message)
Mar 19 17:50:00 pihome hass[2229]: websocket._exceptions.WebSocketTimeoutException: The read operation timed out
Mar 19 17:50:33 pihome hass[2229]: 2020-03-19 17:50:33 ERROR (MainThread) [homeassistant.helpers.entity] Update for media_player.tv fails
Mar 19 17:50:33 pihome hass[2229]: Traceback (most recent call last):
Mar 19 17:50:33 pihome hass[2229]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_socket.py", line 102, in recv
Mar 19 17:50:33 pihome hass[2229]: bytes_ = _recv()
Mar 19 17:50:33 pihome hass[2229]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_socket.py", line 84, in _recv
Mar 19 17:50:33 pihome hass[2229]: return sock.recv(bufsize)
Mar 19 17:50:33 pihome hass[2229]: File "/usr/lib/python3.7/ssl.py", line 1037, in recv
Mar 19 17:50:33 pihome hass[2229]: return self.read(buflen)
Mar 19 17:50:33 pihome hass[2229]: File "/usr/lib/python3.7/ssl.py", line 913, in read
Mar 19 17:50:33 pihome hass[2229]: return self._sslobj.read(len)
Mar 19 17:50:33 pihome hass[2229]: socket.timeout: The read operation timed out
Mar 19 17:50:33 pihome hass[2229]: During handling of the above exception, another exception occurred:
Mar 19 17:50:33 pihome hass[2229]: Traceback (most recent call last):
Mar 19 17:50:33 pihome hass[2229]: File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 279, in async_update_ha_state
Mar 19 17:50:33 pihome hass[2229]: await self.async_device_update()
Mar 19 17:50:33 pihome hass[2229]: File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 476, in async_device_update
Mar 19 17:50:33 pihome hass[2229]: await self.hass.async_add_executor_job(self.update)
Mar 19 17:50:33 pihome hass[2229]: File "/usr/lib/python3.7/concurrent/futures/thread.py", line 57, in run
Mar 19 17:50:33 pihome hass[2229]: result = self.fn(*self.args, **self.kwargs)
Mar 19 17:50:33 pihome hass[2229]: File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/samsungtv/media_player.py", line 127, in update
Mar 19 17:50:33 pihome hass[2229]: self._state = STATE_ON if self._bridge.is_on() else STATE_OFF
Mar 19 17:50:33 pihome hass[2229]: File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/samsungtv/bridge.py", line 66, in is_on
Mar 19 17:50:33 pihome hass[2229]: return self._get_remote() is not None
Mar 19 17:50:33 pihome hass[2229]: File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/samsungtv/bridge.py", line 251, in _get_remote
Mar 19 17:50:33 pihome hass[2229]: self._remote.open()
Mar 19 17:50:33 pihome hass[2229]: File "/srv/homeassistant/lib/python3.7/site-packages/samsungtvws/remote.py", line 149, in open
Mar 19 17:50:33 pihome hass[2229]: response = self._process_api_response(self.connection.recv())
Mar 19 17:50:33 pihome hass[2229]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_core.py", line 313, in recv
Mar 19 17:50:33 pihome hass[2229]: opcode, data = self.recv_data()
Mar 19 17:50:33 pihome hass[2229]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_core.py", line 330, in recv_data
Mar 19 17:50:33 pihome hass[2229]: opcode, frame = self.recv_data_frame(control_frame)
Mar 19 17:50:33 pihome hass[2229]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_core.py", line 343, in recv_data_frame
Mar 19 17:50:33 pihome hass[2229]: frame = self.recv_frame()
Mar 19 17:50:33 pihome hass[2229]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_core.py", line 377, in recv_frame
Mar 19 17:50:33 pihome hass[2229]: return self.frame_buffer.recv_frame()
Mar 19 17:50:33 pihome hass[2229]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_abnf.py", line 361, in recv_frame
Mar 19 17:50:33 pihome hass[2229]: self.recv_header()
Mar 19 17:50:33 pihome hass[2229]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_abnf.py", line 309, in recv_header
Mar 19 17:50:33 pihome hass[2229]: header = self.recv_strict(2)
Mar 19 17:50:33 pihome hass[2229]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_abnf.py", line 396, in recv_strict
Mar 19 17:50:33 pihome hass[2229]: bytes_ = self.recv(min(16384, shortage))
Mar 19 17:50:33 pihome hass[2229]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_core.py", line 452, in _recv
Mar 19 17:50:33 pihome hass[2229]: return recv(self.sock, bufsize)
Mar 19 17:50:33 pihome hass[2229]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_socket.py", line 105, in recv
Mar 19 17:50:33 pihome hass[2229]: raise WebSocketTimeoutException(message)
Mar 19 17:50:33 pihome hass[2229]: websocket._exceptions.WebSocketTimeoutException: The read operation timed out
The model of Samsung TV I'm testing is quite recent (2018/2019): UE49NU7170.
The only component that has worked fine so far is the "samsungtv_custom" custom component that I installed via HACS.
same error, and same working custom component
Hey there @escoand, mind taking a look at this issue as its been labeled with a integration (samsungtv) you are listed as a codeowner for? Thanks!
WebSocketTimeoutException sound like slow pi, tv, network, ... whatever
Thanks for your reply. But then why is the "samsungtv_custom" component (installed via HACS) working fine? Same PI, TV, network...
Just FYI, if that helps, the samsungtv_custom is using port 8002 via websocket.
Can you please test https://github.com/home-assistant/core/pull/33001
And have you re-created the via config flow or is this an old entry from a former release? And if the latter, could you please try recreation?
And have you re-created the via config flow or is this an old entry from a former release? And if the latter, could you please try recreation?
I created a new entry via the yaml config flow.
While doing this, I've noticed the same issue described by @beloso in the issue #33001: a never ending loop of notifications on my TV - until I was forced to kill home assistant to stop it.
@LeoCal, I would recommend the following:
once is selected.TV. This gives you a clean slate.Following the above steps you should not get any subsequent authorization requests. Could you confirm?
When we need to remove the old auth from the TV then this sounds exactly what is already mentioned in a comment in the code:
https://github.com/home-assistant/core/blob/5893f6b14b0098c41fdef05e00eef0d81bb5bb81/homeassistant/components/samsungtv/bridge.py#L177 and https://github.com/home-assistant/core/blob/5893f6b14b0098c41fdef05e00eef0d81bb5bb81/homeassistant/components/samsungtv/bridge.py#L258
But the problem is also already mentioned. There is no way to distinguish between a missing/wrong/invalid auth and any other timeout reason. At least I don't know how.
Hello, I can confirm that the suggestion from @stephanmiehe did help - at least initially.
Indeed, after upgrading to HA 0.107.5 today, I have cleaned up the devices permitted on the TV and have cleaned the HA Samsung integration. After that, I managed to add the TV correctly.
However, it worked well for 30 minutes and then it stared logging the traceback I mentioned and it went in the authorization loop in the TV again:
Mar 24 20:25:43 pihome hass[14261]: Traceback (most recent call last):
Mar 24 20:25:43 pihome hass[14261]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_socket.py", line 102, in recv
Mar 24 20:25:43 pihome hass[14261]: bytes_ = _recv()
Mar 24 20:25:43 pihome hass[14261]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_socket.py", line 84, in _recv
Mar 24 20:25:43 pihome hass[14261]: return sock.recv(bufsize)
Mar 24 20:25:43 pihome hass[14261]: File "/usr/lib/python3.7/ssl.py", line 1037, in recv
Mar 24 20:25:43 pihome hass[14261]: return self.read(buflen)
Mar 24 20:25:43 pihome hass[14261]: File "/usr/lib/python3.7/ssl.py", line 913, in read
Mar 24 20:25:43 pihome hass[14261]: return self._sslobj.read(len)
Mar 24 20:25:43 pihome hass[14261]: socket.timeout: The read operation timed out
Mar 24 20:25:43 pihome hass[14261]: During handling of the above exception, another exception occurred:
Mar 24 20:25:43 pihome hass[14261]: Traceback (most recent call last):
Mar 24 20:25:43 pihome hass[14261]: File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 279, in async_update_ha_state
Mar 24 20:25:43 pihome hass[14261]: await self.async_device_update()
Mar 24 20:25:43 pihome hass[14261]: File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 476, in async_device_update
Mar 24 20:25:43 pihome hass[14261]: await self.hass.async_add_executor_job(self.update)
Mar 24 20:25:43 pihome hass[14261]: File "/usr/lib/python3.7/concurrent/futures/thread.py", line 57, in run
Mar 24 20:25:43 pihome hass[14261]: result = self.fn(*self.args, **self.kwargs)
Mar 24 20:25:43 pihome hass[14261]: File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/samsungtv/media_player.py", line 127, in update
Mar 24 20:25:43 pihome hass[14261]: self._state = STATE_ON if self._bridge.is_on() else STATE_OFF
Mar 24 20:25:43 pihome hass[14261]: File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/samsungtv/bridge.py", line 66, in is_on
Mar 24 20:25:43 pihome hass[14261]: return self._get_remote() is not None
Mar 24 20:25:43 pihome hass[14261]: File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/samsungtv/bridge.py", line 256, in _get_remote
Mar 24 20:25:43 pihome hass[14261]: self._remote.open()
Mar 24 20:25:43 pihome hass[14261]: File "/srv/homeassistant/lib/python3.7/site-packages/samsungtvws/remote.py", line 149, in open
Mar 24 20:25:43 pihome hass[14261]: response = self._process_api_response(self.connection.recv())
Mar 24 20:25:43 pihome hass[14261]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_core.py", line 313, in recv
Mar 24 20:25:43 pihome hass[14261]: opcode, data = self.recv_data()
Mar 24 20:25:43 pihome hass[14261]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_core.py", line 330, in recv_data
Mar 24 20:25:43 pihome hass[14261]: opcode, frame = self.recv_data_frame(control_frame)
Mar 24 20:25:43 pihome hass[14261]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_core.py", line 343, in recv_data_frame
Mar 24 20:25:43 pihome hass[14261]: frame = self.recv_frame()
Mar 24 20:25:43 pihome hass[14261]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_core.py", line 377, in recv_frame
Mar 24 20:25:43 pihome hass[14261]: return self.frame_buffer.recv_frame()
Mar 24 20:25:43 pihome hass[14261]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_abnf.py", line 361, in recv_frame
Mar 24 20:25:43 pihome hass[14261]: self.recv_header()
Mar 24 20:25:43 pihome hass[14261]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_abnf.py", line 309, in recv_header
Mar 24 20:25:43 pihome hass[14261]: header = self.recv_strict(2)
Mar 24 20:25:43 pihome hass[14261]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_abnf.py", line 396, in recv_strict
Mar 24 20:25:43 pihome hass[14261]: bytes_ = self.recv(min(16384, shortage))
Mar 24 20:25:43 pihome hass[14261]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_core.py", line 452, in _recv
Mar 24 20:25:43 pihome hass[14261]: return recv(self.sock, bufsize)
Mar 24 20:25:43 pihome hass[14261]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_socket.py", line 105, in recv
Mar 24 20:25:43 pihome hass[14261]: raise WebSocketTimeoutException(message)
Mar 24 20:25:43 pihome hass[14261]: websocket._exceptions.WebSocketTimeoutException: The read operation timed out
So, I did all over again (cleanup and adding again) and it is working for now... but I expect it to fail again in the same manner.
Hello,
I can confirm it happened again after 15 hours this time.
Same repeating traceback and I got 23 (!?) notifications to allow the HomeAssistant again on my Samsung TV (despite the fact I selected to notify me only once). I guess what's happening is that the TV thinks it's a new device asking for permission.
For the time being, I'm gonna disable the samsungtv extension completely before other people at home decide to kill me :-)
@LeoCal could you verify the token doesn't change on our side?
Sure, glad to do it. How do I do that? Where is the token stored?
It's in the config directory in .storage/core.config_entries. Search for samsungtv.
@tulindo I could think of 3 possibilities:
It's in the config directory in
.storage/core.config_entries. Search for samsungtv.
Currently there's no token there, I guess because I cleaned up the integration and removed the TV... I'll try again as soon as I get some time (busy days)
Just a thought here: shouldn't we simply put the following line in a try/except harness?
homeassistant/components/samsungtv/media_player.py::127
self._state = STATE_ON if self._bridge.is_on() else STATE_OFF
Something like:
try:
self._state = STATE_ON if self._bridge.is_on() else STATE_OFF
except WebSocketTimeoutException:
self._state = STATE_OFF
This way, if "is_on()" throws exception, we don't blow up, we just consider the state to be off.
Not 100% sure that this would work, just food for thoughts.
My 2c
Having second thoughts actually: this might just mask the exception but not solve the actual issue (the TV state would stay off, but disconnected). Maybe it's worth exploring the token avenue you brought up.
During the development of the samsungtvws patch the api developer told me that the token was not changing.
It's hard without such a tv
@LeoCal as @escoand said. Can you control if and when the token value changes?
Are the ip of your TV and hass.io static or they change during time?
Can you also add debug level for the samsungtvws component?
@arsaboo sorry to bother you... Are you experiencing those problems on your TV?
Are the ip of your TV and hass.io static or they change during time?
They're both statically assigned.
Can you also add debug level for the samsungtvws component?
Sure, will do.
@LeoCal as @escoand said. Can you control if and when the token value changes?
Just to be sure I understand the procedure to follow here:
.storage/core.config_entriesJust to be sure I understand the procedure to follow here:
- I enable samsungtv component and its debugs
- I connect to the TV and go and check the token in
.storage/core.config_entries- I wait for the HA/TV to go into problematic state and check the value of the token again?
Yes, basically. And also please add samsungtvws to debug logging. That's the library the integration leverages.
Thanks @escoand for the confirmation.
I did add debug logs for homeassistant.components.samsungtv; however, I don't see samsungtvws being loaded by homeassistant.loader when homeassistant starts. But I double-checked and that's installed in my python virtualenv:
(homeassistant) homeassistant@pihome:/srv/homeassistant $ pip3 list | grep -i samsung
samsungctl 0.7.1
samsungtvws 1.4.0
How do I add debug logging for samsungtvws ?
Write just the name of the python module:
logger:
default: info
logs:
homeassistant.components.samsungtv: debug
samsungtvws: debug
Great, thanks 馃憤
Ok, first of all, I realized one important thing that might (or not) have contributed to mess things up: I left my samsungtv config in the configuration.yaml file and added the TV from the "Integration" GUI of HA as well. From the logs, it seems that causes two websocket connections to be opened in parallel towards the TV. So, first thing, I cleared that and I'm now running with the yang config only.
Now, with the clean config, I'm collecting the logs and things look to be ok for now - I might have to wait for several hours until the issue pops up again. The logs show correct behaviour so far: first "legacy" connection is attempted, which fails as expected; then connection to port 8001, which fails as expected; then connection to port 8002 which is successful. After that, token is exchanged correctly and I can control the TV.
Just one question: from the logs, I noticed a connection to the TV happens every ~11seconds, I guess to keep the connection alive - correct? Is that really needed? Would it be possible to extend this polling time without incurring in a timeout?
Here's the samsungtv config (including token) in the .homeassistant/.storage/core.config_entries:
{
"connection_class": "local_poll",
"data": {
"host": "192.168.1.100",
"id": null,
"ip_address": "192.168.1.100",
"manufacturer": null,
"method": "websocket",
"model": null,
"name": "TV",
"port": 8002,
"token": "13394648"
},
"domain": "samsungtv",
"entry_id": "112e09926b454d39b7fec285b561a183",
"options": {},
"source": "import",
"system_options": {
"disable_new_entities": false
},
"title": "TV",
"unique_id": "192.168.1.100",
"version": 1
}
Here's the logs:
Mar 26 12:48:37 pihome hass[3525]: 2020-03-26 12:48:37 DEBUG (SyncWorker_18) [homeassistant.components.samsungtv] Try config: {'name': 'HomeAssistant', 'description': 'HomeAssistant', 'id': 'ha.component.samsung', 'host': '192.168.1.100', 'method': 'legacy', 'port': None, 'timeout': 31}
Mar 26 12:48:37 pihome hass[3525]: 2020-03-26 12:48:37 DEBUG (SyncWorker_18) [homeassistant.components.samsungtv] Failing config: {'name': 'HomeAssistant', 'description': 'HomeAssistant', 'id': 'ha.component.samsung', 'host': '192.168.1.100', 'method': 'legacy', 'port': None, 'timeout': 31}, error: [Errno 111] Connection refused
Mar 26 12:48:37 pihome hass[3525]: 2020-03-26 12:48:37 DEBUG (SyncWorker_18) [homeassistant.components.samsungtv] Try config: {'name': 'HomeAssistant', 'host': '192.168.1.100', 'method': 'websocket', 'port': 8001, 'timeout': 31}
Mar 26 12:48:37 pihome hass[3525]: 2020-03-26 12:48:37 DEBUG (SyncWorker_18) [samsungtvws.remote] WS url ws://192.168.1.100:8001/api/v2/channels/samsung.remote.control?name=SG9tZUFzc2lzdGFudA==
Mar 26 12:48:38 pihome hass[3525]: 2020-03-26 12:48:38 DEBUG (SyncWorker_18) [samsungtvws.remote] Connection closed.
Mar 26 12:48:38 pihome hass[3525]: 2020-03-26 12:48:38 DEBUG (SyncWorker_18) [samsungtvws.remote] Connection closed.
Mar 26 12:48:38 pihome hass[3525]: 2020-03-26 12:48:38 DEBUG (SyncWorker_18) [homeassistant.components.samsungtv] Failing config: {'name': 'HomeAssistant', 'host': '192.168.1.100', 'method': 'websocket', 'port': 8001, 'timeout': 31}, error: {'event': 'ms.channel.unauthorized'}
Mar 26 12:48:38 pihome hass[3525]: 2020-03-26 12:48:38 DEBUG (SyncWorker_18) [homeassistant.components.samsungtv] Try config: {'name': 'HomeAssistant', 'host': '192.168.1.100', 'method': 'websocket', 'port': 8002, 'timeout': 31}
Mar 26 12:48:38 pihome hass[3525]: 2020-03-26 12:48:38 DEBUG (SyncWorker_18) [samsungtvws.remote] WS url wss://192.168.1.100:8002/api/v2/channels/samsung.remote.control?name=SG9tZUFzc2lzdGFudA==&token=None
Mar 26 12:48:42 pihome hass[3525]: 2020-03-26 12:48:42 DEBUG (SyncWorker_18) [samsungtvws.remote] Got token 13394648
Mar 26 12:48:42 pihome hass[3525]: 2020-03-26 12:48:42 INFO (SyncWorker_18) [samsungtvws.remote] New token 13394648
Mar 26 12:48:42 pihome hass[3525]: 2020-03-26 12:48:42 DEBUG (SyncWorker_18) [samsungtvws.remote] Connection closed.
Mar 26 12:48:42 pihome hass[3525]: 2020-03-26 12:48:42 DEBUG (SyncWorker_18) [homeassistant.components.samsungtv] Working config: {'name': 'HomeAssistant', 'host': '192.168.1.100', 'method': 'websocket', 'port': 8002, 'timeout': 31, 'token': '*****'}
Mar 26 12:48:50 pihome hass[3525]: 2020-03-26 12:48:50 WARNING (SyncWorker_19) [homeassistant.components.homekit.type_media_players] media_player.tv: Sources out of sync. Restart Home Assistant
Mar 26 12:48:55 pihome hass[3525]: 2020-03-26 12:48:55 DEBUG (SyncWorker_3) [homeassistant.components.samsungtv] Create SamsungTVWS
Mar 26 12:48:55 pihome hass[3525]: 2020-03-26 12:48:55 DEBUG (SyncWorker_3) [samsungtvws.remote] WS url wss://192.168.1.100:8002/api/v2/channels/samsung.remote.control?name=SG9tZUFzc2lzdGFudA==&token=13394648
Mar 26 12:48:55 pihome hass[3525]: 2020-03-26 12:48:55 WARNING (MainThread) [homeassistant.components.sensor] Updating command_line sensor took longer than the scheduled update interval 0:00:05
Mar 26 12:48:55 pihome hass[3525]: 2020-03-26 12:48:55 WARNING (SyncWorker_12) [homeassistant.components.homekit.type_media_players] media_player.tv: Sources out of sync. Restart Home Assistant
Mar 26 12:49:05 pihome hass[3525]: 2020-03-26 12:49:05 DEBUG (SyncWorker_14) [samsungtvws.remote] Connection closed.
Mar 26 12:49:05 pihome hass[3525]: 2020-03-26 12:49:05 DEBUG (SyncWorker_14) [homeassistant.components.samsungtv] Create SamsungTVWS
Mar 26 12:49:05 pihome hass[3525]: 2020-03-26 12:49:05 DEBUG (SyncWorker_14) [samsungtvws.remote] WS url wss://192.168.1.100:8002/api/v2/channels/samsung.remote.control?name=SG9tZUFzc2lzdGFudA==&token=13394648
Mar 26 12:49:16 pihome hass[3525]: 2020-03-26 12:49:16 DEBUG (SyncWorker_9) [samsungtvws.remote] Connection closed.
Mar 26 12:49:16 pihome hass[3525]: 2020-03-26 12:49:16 DEBUG (SyncWorker_9) [homeassistant.components.samsungtv] Create SamsungTVWS
Mar 26 12:49:16 pihome hass[3525]: 2020-03-26 12:49:16 DEBUG (SyncWorker_9) [samsungtvws.remote] WS url wss://192.168.1.100:8002/api/v2/channels/samsung.remote.control?name=SG9tZUFzc2lzdGFudA==&token=13394648
Mar 26 12:49:27 pihome hass[3525]: 2020-03-26 12:49:27 DEBUG (SyncWorker_13) [samsungtvws.remote] Connection closed.
Mar 26 12:49:27 pihome hass[3525]: 2020-03-26 12:49:27 DEBUG (SyncWorker_13) [homeassistant.components.samsungtv] Create SamsungTVWS
Mar 26 12:49:27 pihome hass[3525]: 2020-03-26 12:49:27 DEBUG (SyncWorker_13) [samsungtvws.remote] WS url wss://192.168.1.100:8002/api/v2/channels/samsung.remote.control?name=SG9tZUFzc2lzdGFudA==&token=13394648
Mar 26 12:49:38 pihome hass[3525]: 2020-03-26 12:49:38 DEBUG (SyncWorker_9) [samsungtvws.remote] Connection closed.
Mar 26 12:49:38 pihome hass[3525]: 2020-03-26 12:49:38 DEBUG (SyncWorker_9) [homeassistant.components.samsungtv] Create SamsungTVWS
Mar 26 12:49:38 pihome hass[3525]: 2020-03-26 12:49:38 DEBUG (SyncWorker_9) [samsungtvws.remote] WS url wss://192.168.1.100:8002/api/v2/channels/samsung.remote.control?name=SG9tZUFzc2lzdGFudA==&token=13394648
Mar 26 12:49:49 pihome hass[3525]: 2020-03-26 12:49:49 DEBUG (SyncWorker_16) [samsungtvws.remote] Connection closed.
Mar 26 12:49:49 pihome hass[3525]: 2020-03-26 12:49:49 DEBUG (SyncWorker_16) [homeassistant.components.samsungtv] Create SamsungTVWS
Mar 26 12:49:49 pihome hass[3525]: 2020-03-26 12:49:49 DEBUG (SyncWorker_16) [samsungtvws.remote] WS url wss://192.168.1.100:8002/api/v2/channels/samsung.remote.control?name=SG9tZUFzc2lzdGFudA==&token=13394648
Mar 26 12:49:59 pihome hass[3525]: 2020-03-26 12:49:59 DEBUG (SyncWorker_15) [samsungtvws.remote] Connection closed.
Mar 26 12:49:59 pihome hass[3525]: 2020-03-26 12:49:59 DEBUG (SyncWorker_15) [homeassistant.components.samsungtv] Create SamsungTVWS
Mar 26 12:49:59 pihome hass[3525]: 2020-03-26 12:49:59 DEBUG (SyncWorker_15) [samsungtvws.remote] WS url wss://192.168.1.100:8002/api/v2/channels/samsung.remote.control?name=SG9tZUFzc2lzdGFudA==&token=13394648
Mar 26 12:50:10 pihome hass[3525]: 2020-03-26 12:50:10 DEBUG (SyncWorker_19) [samsungtvws.remote] Connection closed.
Mar 26 12:50:10 pihome hass[3525]: 2020-03-26 12:50:10 DEBUG (SyncWorker_19) [homeassistant.components.samsungtv] Create SamsungTVWS
Mar 26 12:50:10 pihome hass[3525]: 2020-03-26 12:50:10 DEBUG (SyncWorker_19) [samsungtvws.remote] WS url wss://192.168.1.100:8002/api/v2/channels/samsung.remote.control?name=SG9tZUFzc2lzdGFudA==&token=13394648
Mar 26 12:50:21 pihome hass[3525]: 2020-03-26 12:50:21 DEBUG (SyncWorker_12) [samsungtvws.remote] Connection closed.
Mar 26 12:50:21 pihome hass[3525]: 2020-03-26 12:50:21 DEBUG (SyncWorker_12) [homeassistant.components.samsungtv] Create SamsungTVWS
Mar 26 12:50:21 pihome hass[3525]: 2020-03-26 12:50:21 DEBUG (SyncWorker_12) [samsungtvws.remote] WS url wss://192.168.1.100:8002/api/v2/channels/samsung.remote.control?name=SG9tZUFzc2lzdGFudA==&token=13394648
Mar 26 12:50:32 pihome hass[3525]: 2020-03-26 12:50:32 DEBUG (SyncWorker_8) [samsungtvws.remote] Connection closed.
Mar 26 12:50:32 pihome hass[3525]: 2020-03-26 12:50:32 DEBUG (SyncWorker_8) [homeassistant.components.samsungtv] Create SamsungTVWS
Mar 26 12:50:32 pihome hass[3525]: 2020-03-26 12:50:32 DEBUG (SyncWorker_8) [samsungtvws.remote] WS url wss://192.168.1.100:8002/api/v2/channels/samsung.remote.control?name=SG9tZUFzc2lzdGFudA==&token=13394648
Mar 26 12:50:32 pihome hass[3525]: 2020-03-26 12:50:32 DEBUG (SyncWorker_16) [samsungtvws.remote] Sending key KEY_VOLDOWN
Mar 26 12:50:33 pihome hass[3525]: 2020-03-26 12:50:33 DEBUG (SyncWorker_7) [samsungtvws.remote] Connection closed.
Mar 26 12:50:33 pihome hass[3525]: 2020-03-26 12:50:33 DEBUG (SyncWorker_7) [homeassistant.components.samsungtv] Create SamsungTVWS
Mar 26 12:50:33 pihome hass[3525]: 2020-03-26 12:50:33 DEBUG (SyncWorker_7) [samsungtvws.remote] WS url wss://192.168.1.100:8002/api/v2/channels/samsung.remote.control?name=SG9tZUFzc2lzdGFudA==&token=13394648
Mar 26 12:50:37 pihome hass[3525]: 2020-03-26 12:50:37 DEBUG (SyncWorker_19) [samsungtvws.remote] Sending key KEY_VOLUP
Mar 26 12:50:38 pihome hass[3525]: 2020-03-26 12:50:38 DEBUG (SyncWorker_15) [samsungtvws.remote] Connection closed.
Mar 26 12:50:38 pihome hass[3525]: 2020-03-26 12:50:38 DEBUG (SyncWorker_15) [homeassistant.components.samsungtv] Create SamsungTVWS
Mar 26 12:50:38 pihome hass[3525]: 2020-03-26 12:50:38 DEBUG (SyncWorker_15) [samsungtvws.remote] WS url wss://192.168.1.100:8002/api/v2/channels/samsung.remote.control?name=SG9tZUFzc2lzdGFudA==&token=13394648
Mar 26 12:50:42 pihome hass[3525]: 2020-03-26 12:50:42 DEBUG (SyncWorker_17) [samsungtvws.remote] Sending key KEY_MUTE
Mar 26 12:50:43 pihome hass[3525]: 2020-03-26 12:50:43 DEBUG (SyncWorker_12) [samsungtvws.remote] Connection closed.
Mar 26 12:50:43 pihome hass[3525]: 2020-03-26 12:50:43 DEBUG (SyncWorker_12) [homeassistant.components.samsungtv] Create SamsungTVWS
Mar 26 12:50:43 pihome hass[3525]: 2020-03-26 12:50:43 DEBUG (SyncWorker_12) [samsungtvws.remote] WS url wss://192.168.1.100:8002/api/v2/channels/samsung.remote.control?name=SG9tZUFzc2lzdGFudA==&token=13394648
Mar 26 12:50:43 pihome hass[3525]: 2020-03-26 12:50:43 DEBUG (SyncWorker_11) [samsungtvws.remote] Sending key KEY_MUTE
Mar 26 12:50:44 pihome hass[3525]: 2020-03-26 12:50:44 DEBUG (SyncWorker_14) [samsungtvws.remote] Connection closed.
Mar 26 12:50:44 pihome hass[3525]: 2020-03-26 12:50:44 DEBUG (SyncWorker_14) [homeassistant.components.samsungtv] Create SamsungTVWS
Mar 26 12:50:44 pihome hass[3525]: 2020-03-26 12:50:44 DEBUG (SyncWorker_14) [samsungtvws.remote] WS url wss://192.168.1.100:8002/api/v2/channels/samsung.remote.control?name=SG9tZUFzc2lzdGFudA==&token=13394648
Mar 26 12:50:54 pihome hass[3525]: 2020-03-26 12:50:54 DEBUG (SyncWorker_10) [samsungtvws.remote] Connection closed.
Mar 26 12:50:54 pihome hass[3525]: 2020-03-26 12:50:54 DEBUG (SyncWorker_10) [homeassistant.components.samsungtv] Create SamsungTVWS
Mar 26 12:50:54 pihome hass[3525]: 2020-03-26 12:50:54 DEBUG (SyncWorker_10) [samsungtvws.remote] WS url wss://192.168.1.100:8002/api/v2/channels/samsung.remote.control?name=SG9tZUFzc2lzdGFudA==&token=13394648
Mar 26 12:51:05 pihome hass[3525]: 2020-03-26 12:51:05 DEBUG (SyncWorker_13) [samsungtvws.remote] Connection closed.
Mar 26 12:51:05 pihome hass[3525]: 2020-03-26 12:51:05 DEBUG (SyncWorker_13) [homeassistant.components.samsungtv] Create SamsungTVWS
Mar 26 12:51:05 pihome hass[3525]: 2020-03-26 12:51:05 DEBUG (SyncWorker_13) [samsungtvws.remote] WS url wss://192.168.1.100:8002/api/v2/channels/samsung.remote.control?name=SG9tZUFzc2lzdGFudA==&token=13394648
Mar 26 12:51:16 pihome hass[3525]: 2020-03-26 12:51:16 DEBUG (SyncWorker_13) [samsungtvws.remote] Connection closed.
Mar 26 12:51:16 pihome hass[3525]: 2020-03-26 12:51:16 DEBUG (SyncWorker_13) [homeassistant.components.samsungtv] Create SamsungTVWS
Mar 26 12:51:16 pihome hass[3525]: 2020-03-26 12:51:16 DEBUG (SyncWorker_13) [samsungtvws.remote] WS url wss://192.168.1.100:8002/api/v2/channels/samsung.remote.control?name=SG9tZUFzc2lzdGFudA==&token=13394648
Mar 26 12:51:26 pihome hass[3525]: 2020-03-26 12:51:26 DEBUG (SyncWorker_10) [samsungtvws.remote] Connection closed.
Mar 26 12:51:26 pihome hass[3525]: 2020-03-26 12:51:26 DEBUG (SyncWorker_10) [homeassistant.components.samsungtv] Create SamsungTVWS
Mar 26 12:51:26 pihome hass[3525]: 2020-03-26 12:51:26 DEBUG (SyncWorker_10) [samsungtvws.remote] WS url wss://192.168.1.100:8002/api/v2/channels/samsung.remote.control?name=SG9tZUFzc2lzdGFudA==&token=13394648
Mar 26 12:51:37 pihome hass[3525]: 2020-03-26 12:51:37 DEBUG (SyncWorker_15) [samsungtvws.remote] Connection closed.
Mar 26 12:51:37 pihome hass[3525]: 2020-03-26 12:51:37 DEBUG (SyncWorker_15) [homeassistant.components.samsungtv] Create SamsungTVWS
Mar 26 12:51:37 pihome hass[3525]: 2020-03-26 12:51:37 DEBUG (SyncWorker_15) [samsungtvws.remote] WS url wss://192.168.1.100:8002/api/v2/channels/samsung.remote.control?name=SG9tZUFzc2lzdGFudA==&token=13394648
Mar 26 12:51:48 pihome hass[3525]: 2020-03-26 12:51:48 DEBUG (SyncWorker_18) [samsungtvws.remote] Connection closed.
Mar 26 12:51:48 pihome hass[3525]: 2020-03-26 12:51:48 DEBUG (SyncWorker_18) [homeassistant.components.samsungtv] Create SamsungTVWS
Mar 26 12:51:48 pihome hass[3525]: 2020-03-26 12:51:48 DEBUG (SyncWorker_18) [samsungtvws.remote] WS url wss://192.168.1.100:8002/api/v2/channels/samsung.remote.control?name=SG9tZUFzc2lzdGFudA==&token=13394648
Mar 26 12:51:59 pihome hass[3525]: 2020-03-26 12:51:59 DEBUG (SyncWorker_0) [samsungtvws.remote] Connection closed.
Mar 26 12:51:59 pihome hass[3525]: 2020-03-26 12:51:59 DEBUG (SyncWorker_0) [homeassistant.components.samsungtv] Create SamsungTVWS
Mar 26 12:51:59 pihome hass[3525]: 2020-03-26 12:51:59 DEBUG (SyncWorker_0) [samsungtvws.remote] WS url wss://192.168.1.100:8002/api/v2/channels/samsung.remote.control?name=SG9tZUFzc2lzdGFudA==&token=13394648
Mar 26 12:52:10 pihome hass[3525]: 2020-03-26 12:52:10 DEBUG (SyncWorker_9) [samsungtvws.remote] Connection closed.
Mar 26 12:52:10 pihome hass[3525]: 2020-03-26 12:52:10 DEBUG (SyncWorker_9) [homeassistant.components.samsungtv] Create SamsungTVWS
Mar 26 12:52:10 pihome hass[3525]: 2020-03-26 12:52:10 DEBUG (SyncWorker_9) [samsungtvws.remote] WS url wss://192.168.1.100:8002/api/v2/channels/samsung.remote.control?name=SG9tZUFzc2lzdGFudA==&token=13394648
Mar 26 12:52:21 pihome hass[3525]: 2020-03-26 12:52:21 DEBUG (SyncWorker_3) [samsungtvws.remote] Connection closed.
Mar 26 12:52:21 pihome hass[3525]: 2020-03-26 12:52:21 DEBUG (SyncWorker_3) [homeassistant.components.samsungtv] Create SamsungTVWS
Mar 26 12:52:21 pihome hass[3525]: 2020-03-26 12:52:21 DEBUG (SyncWorker_3) [samsungtvws.remote] WS url wss://192.168.1.100:8002/api/v2/channels/samsung.remote.control?name=SG9tZUFzc2lzdGFudA==&token=13394648
Mar 26 12:52:32 pihome hass[3525]: 2020-03-26 12:52:32 DEBUG (SyncWorker_5) [samsungtvws.remote] Connection closed.
Mar 26 12:52:32 pihome hass[3525]: 2020-03-26 12:52:32 DEBUG (SyncWorker_5) [homeassistant.components.samsungtv] Create SamsungTVWS
Mar 26 12:52:32 pihome hass[3525]: 2020-03-26 12:52:32 DEBUG (SyncWorker_5) [samsungtvws.remote] WS url wss://192.168.1.100:8002/api/v2/channels/samsung.remote.control?name=SG9tZUFzc2lzdGFudA==&token=13394648
Mar 26 12:52:43 pihome hass[3525]: 2020-03-26 12:52:43 DEBUG (SyncWorker_7) [samsungtvws.remote] Connection closed.
Mar 26 12:52:43 pihome hass[3525]: 2020-03-26 12:52:43 DEBUG (SyncWorker_7) [homeassistant.components.samsungtv] Create SamsungTVWS
Mar 26 12:52:43 pihome hass[3525]: 2020-03-26 12:52:43 DEBUG (SyncWorker_7) [samsungtvws.remote] WS url wss://192.168.1.100:8002/api/v2/channels/samsung.remote.control?name=SG9tZUFzc2lzdGFudA==&token=13394648
Mar 26 12:52:54 pihome hass[3525]: 2020-03-26 12:52:54 DEBUG (SyncWorker_2) [samsungtvws.remote] Connection closed.
Mar 26 12:52:54 pihome hass[3525]: 2020-03-26 12:52:54 DEBUG (SyncWorker_2) [homeassistant.components.samsungtv] Create SamsungTVWS
Mar 26 12:52:54 pihome hass[3525]: 2020-03-26 12:52:54 DEBUG (SyncWorker_2) [samsungtvws.remote] WS url wss://192.168.1.100:8002/api/v2/channels/samsung.remote.control?name=SG9tZUFzc2lzdGFudA==&token=13394648
Mar 26 12:53:05 pihome hass[3525]: 2020-03-26 12:53:05 DEBUG (SyncWorker_9) [samsungtvws.remote] Connection closed.
Mar 26 12:53:05 pihome hass[3525]: 2020-03-26 12:53:05 DEBUG (SyncWorker_9) [homeassistant.components.samsungtv] Create SamsungTVWS
Mar 26 12:53:05 pihome hass[3525]: 2020-03-26 12:53:05 DEBUG (SyncWorker_9) [samsungtvws.remote] WS url wss://192.168.1.100:8002/api/v2/channels/samsung.remote.control?name=SG9tZUFzc2lzdGFudA==&token=13394648
Mar 26 12:53:16 pihome hass[3525]: 2020-03-26 12:53:16 DEBUG (SyncWorker_11) [samsungtvws.remote] Connection closed.
Mar 26 12:53:16 pihome hass[3525]: 2020-03-26 12:53:16 DEBUG (SyncWorker_11) [homeassistant.components.samsungtv] Create SamsungTVWS
Mar 26 12:53:16 pihome hass[3525]: 2020-03-26 12:53:16 DEBUG (SyncWorker_11) [samsungtvws.remote] WS url wss://192.168.1.100:8002/api/v2/channels/samsung.remote.control?name=SG9tZUFzc2lzdGFudA==&token=13394648
Mar 26 12:53:27 pihome hass[3525]: 2020-03-26 12:53:27 DEBUG (SyncWorker_14) [samsungtvws.remote] Connection closed.
The 2 websocket connection where there because you had 2 separate entities connecting to the same TV from the same host.... (maybe this caused the TV to react in some way)
The debug level for samsungtvws is only used to understand if the token changes from time to time.
as you can see now your token is 13394648 (during PR development I've been asked to mask his value in component logging).
Keep this level detail and if problem will rise again (I hope not). We'll check if token changes and hopefully find a way to deail with it.
Let's wait few days and see if the problem disappears.
@LeoCal. Any news? Did you experience the problem once you cleared your config?
Yes, it has just happened after 3 days of everything working fine (see logs below)... However, the token didn't change!
Not sure what happened to my Raspberry PI: after the issue happened, it went into a weird state and I'm now forced to reboot it. I hope I don't have to restore my last backup.
Mar 29 13:59:45 pihome hass[2958]: 2020-03-29 13:59:45 DEBUG (SyncWorker_10) [samsungtvws.remote] Connection closed.
Mar 29 13:59:45 pihome hass[2958]: 2020-03-29 13:59:45 DEBUG (SyncWorker_10) [homeassistant.components.samsungtv] Create SamsungTVWS
Mar 29 13:59:45 pihome hass[2958]: 2020-03-29 13:59:45 DEBUG (SyncWorker_10) [samsungtvws.remote] WS url wss://192.168.1.100:8002/api/v2/channels/samsung.remote.control?name=SG9tZUFzc2lzdGFudA==&token=13394648
Mar 29 13:59:46 pihome hass[2958]: 2020-03-29 13:59:46 WARNING (SyncWorker_0) [homeassistant.components.homekit.type_media_players] media_player.tv: Sources out of sync. Restart Home Assistant
Mar 29 13:59:56 pihome hass[2958]: 2020-03-29 13:59:56 DEBUG (SyncWorker_0) [samsungtvws.remote] Connection closed.
Mar 29 13:59:56 pihome hass[2958]: 2020-03-29 13:59:56 DEBUG (SyncWorker_0) [homeassistant.components.samsungtv] Create SamsungTVWS
Mar 29 13:59:56 pihome hass[2958]: 2020-03-29 13:59:56 DEBUG (SyncWorker_0) [samsungtvws.remote] WS url wss://192.168.1.100:8002/api/v2/channels/samsung.remote.control?name=SG9tZUFzc2lzdGFudA==&token=13394648
Mar 29 14:00:07 pihome hass[2958]: 2020-03-29 14:00:07 DEBUG (SyncWorker_15) [samsungtvws.remote] Connection closed.
Mar 29 14:00:07 pihome hass[2958]: 2020-03-29 14:00:07 DEBUG (SyncWorker_15) [homeassistant.components.samsungtv] Create SamsungTVWS
Mar 29 14:00:07 pihome hass[2958]: 2020-03-29 14:00:07 DEBUG (SyncWorker_15) [samsungtvws.remote] WS url wss://192.168.1.100:8002/api/v2/channels/samsung.remote.control?name=SG9tZUFzc2lzdGFudA==&token=13394648
Mar 29 14:00:07 pihome hass[2958]: 2020-03-29 14:00:07 DEBUG (SyncWorker_15) [samsungtvws.remote] Connection closed.
Mar 29 14:00:07 pihome hass[2958]: 2020-03-29 14:00:07 DEBUG (SyncWorker_15) [homeassistant.components.samsungtv] Access denied in getting remote object
Mar 29 14:00:07 pihome hass[2958]: 2020-03-29 14:00:07 WARNING (SyncWorker_18) [homeassistant.components.homekit.type_media_players] media_player.tv: Sources out of sync. Restart Home Assistant
Mar 29 14:00:18 pihome hass[2958]: 2020-03-29 14:00:18 DEBUG (SyncWorker_0) [samsungtvws.remote] Connection closed.
Mar 29 14:00:18 pihome hass[2958]: 2020-03-29 14:00:18 DEBUG (SyncWorker_0) [homeassistant.components.samsungtv] Create SamsungTVWS
Mar 29 14:00:18 pihome hass[2958]: 2020-03-29 14:00:18 DEBUG (SyncWorker_0) [samsungtvws.remote] WS url wss://192.168.1.100:8002/api/v2/channels/samsung.remote.control?name=SG9tZUFzc2lzdGFudA==&token=13394648
Mar 29 14:00:19 pihome hass[2958]: 2020-03-29 14:00:19 ERROR (MainThread) [homeassistant.helpers.entity] Update for media_player.tv fails
Mar 29 14:00:19 pihome hass[2958]: Traceback (most recent call last):
Mar 29 14:00:19 pihome hass[2958]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_socket.py", line 102, in recv
Mar 29 14:00:19 pihome hass[2958]: bytes_ = _recv()
Mar 29 14:00:19 pihome hass[2958]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_socket.py", line 84, in _recv
Mar 29 14:00:19 pihome hass[2958]: return sock.recv(bufsize)
Mar 29 14:00:19 pihome hass[2958]: File "/usr/lib/python3.7/ssl.py", line 1037, in recv
Mar 29 14:00:19 pihome hass[2958]: return self.read(buflen)
Mar 29 14:00:19 pihome hass[2958]: File "/usr/lib/python3.7/ssl.py", line 913, in read
Mar 29 14:00:19 pihome hass[2958]: return self._sslobj.read(len)
Mar 29 14:00:19 pihome hass[2958]: socket.timeout: The read operation timed out
Mar 29 14:00:19 pihome hass[2958]: During handling of the above exception, another exception occurred:
Mar 29 14:00:19 pihome hass[2958]: Traceback (most recent call last):
Mar 29 14:00:19 pihome hass[2958]: File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 279, in async_update_ha_state
Mar 29 14:00:19 pihome hass[2958]: await self.async_device_update()
Mar 29 14:00:19 pihome hass[2958]: File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 476, in async_device_update
Mar 29 14:00:19 pihome hass[2958]: await self.hass.async_add_executor_job(self.update)
Mar 29 14:00:19 pihome hass[2958]: File "/usr/lib/python3.7/concurrent/futures/thread.py", line 57, in run
Mar 29 14:00:19 pihome hass[2958]: result = self.fn(*self.args, **self.kwargs)
Mar 29 14:00:19 pihome hass[2958]: File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/samsungtv/media_player.py", line 127, in update
Mar 29 14:00:19 pihome hass[2958]: self._state = STATE_ON if self._bridge.is_on() else STATE_OFF
Mar 29 14:00:19 pihome hass[2958]: File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/samsungtv/bridge.py", line 66, in is_on
Mar 29 14:00:19 pihome hass[2958]: return self._get_remote() is not None
Mar 29 14:00:19 pihome hass[2958]: File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/samsungtv/bridge.py", line 256, in _get_remote
Mar 29 14:00:19 pihome hass[2958]: self._remote.open()
Mar 29 14:00:19 pihome hass[2958]: File "/srv/homeassistant/lib/python3.7/site-packages/samsungtvws/remote.py", line 149, in open
Mar 29 14:00:19 pihome hass[2958]: response = self._process_api_response(self.connection.recv())
Mar 29 14:00:19 pihome hass[2958]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_core.py", line 313, in recv
Mar 29 14:00:19 pihome hass[2958]: opcode, data = self.recv_data()
Mar 29 14:00:19 pihome hass[2958]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_core.py", line 330, in recv_data
Mar 29 14:00:19 pihome hass[2958]: opcode, frame = self.recv_data_frame(control_frame)
Mar 29 14:00:19 pihome hass[2958]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_core.py", line 343, in recv_data_frame
Mar 29 14:00:19 pihome hass[2958]: frame = self.recv_frame()
Mar 29 14:00:19 pihome hass[2958]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_core.py", line 377, in recv_frame
Mar 29 14:00:19 pihome hass[2958]: return self.frame_buffer.recv_frame()
Mar 29 14:00:19 pihome hass[2958]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_abnf.py", line 361, in recv_frame
Mar 29 14:00:19 pihome hass[2958]: self.recv_header()
Mar 29 14:00:19 pihome hass[2958]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_abnf.py", line 309, in recv_header
Mar 29 14:00:19 pihome hass[2958]: header = self.recv_strict(2)
Mar 29 14:00:19 pihome hass[2958]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_abnf.py", line 396, in recv_strict
Mar 29 14:00:19 pihome hass[2958]: bytes_ = self.recv(min(16384, shortage))
Mar 29 14:00:19 pihome hass[2958]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_core.py", line 452, in _recv
Mar 29 14:00:19 pihome hass[2958]: return recv(self.sock, bufsize)
Mar 29 14:00:19 pihome hass[2958]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_socket.py", line 105, in recv
Mar 29 14:00:19 pihome hass[2958]: raise WebSocketTimeoutException(message)
Mar 29 14:00:19 pihome hass[2958]: websocket._exceptions.WebSocketTimeoutException: The read operation timed out
Mar 29 14:00:32 pihome hass[2958]: 2020-03-29 14:00:32 DEBUG (SyncWorker_5) [samsungtvws.remote] Connection closed.
Mar 29 14:00:32 pihome hass[2958]: 2020-03-29 14:00:32 DEBUG (SyncWorker_5) [homeassistant.components.samsungtv] Create SamsungTVWS
Mar 29 14:00:32 pihome hass[2958]: 2020-03-29 14:00:32 DEBUG (SyncWorker_5) [samsungtvws.remote] WS url wss://192.168.1.100:8002/api/v2/channels/samsung.remote.control?name=SG9tZUFzc2lzdGFudA==&token=13394648
Mar 29 14:00:33 pihome hass[2958]: 2020-03-29 14:00:33 WARNING (SyncWorker_16) [homeassistant.components.homekit.type_media_players] media_player.tv: Sources out of sync. Restart Home Assistant
Mar 29 14:00:40 pihome hass[2958]: 2020-03-29 14:00:40 DEBUG (SyncWorker_8) [samsungtvws.remote] Connection closed.
Mar 29 14:00:40 pihome hass[2958]: 2020-03-29 14:00:40 DEBUG (SyncWorker_8) [homeassistant.components.samsungtv] Create SamsungTVWS
Mar 29 14:00:40 pihome hass[2958]: 2020-03-29 14:00:40 DEBUG (SyncWorker_8) [samsungtvws.remote] WS url wss://192.168.1.100:8002/api/v2/channels/samsung.remote.control?name=SG9tZUFzc2lzdGFudA==&token=13394648
Mar 29 14:00:51 pihome hass[2958]: 2020-03-29 14:00:51 DEBUG (SyncWorker_19) [samsungtvws.remote] Connection closed.
Mar 29 14:00:51 pihome hass[2958]: 2020-03-29 14:00:51 DEBUG (SyncWorker_19) [homeassistant.components.samsungtv] Create SamsungTVWS
Mar 29 14:00:51 pihome hass[2958]: 2020-03-29 14:00:51 DEBUG (SyncWorker_19) [samsungtvws.remote] WS url wss://192.168.1.100:8002/api/v2/channels/samsung.remote.control?name=SG9tZUFzc2lzdGFudA==&token=13394648
Mar 29 14:00:52 pihome hass[2958]: 2020-03-29 14:00:52 ERROR (MainThread) [homeassistant.helpers.entity] Update for media_player.tv fails
Mar 29 14:00:52 pihome hass[2958]: Traceback (most recent call last):
Mar 29 14:00:52 pihome hass[2958]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_socket.py", line 102, in recv
Mar 29 14:00:52 pihome hass[2958]: bytes_ = _recv()
Mar 29 14:00:52 pihome hass[2958]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_socket.py", line 84, in _recv
Mar 29 14:00:52 pihome hass[2958]: return sock.recv(bufsize)
Mar 29 14:00:52 pihome hass[2958]: File "/usr/lib/python3.7/ssl.py", line 1037, in recv
Mar 29 14:00:52 pihome hass[2958]: return self.read(buflen)
Mar 29 14:00:52 pihome hass[2958]: File "/usr/lib/python3.7/ssl.py", line 913, in read
Mar 29 14:00:52 pihome hass[2958]: return self._sslobj.read(len)
Mar 29 14:00:52 pihome hass[2958]: socket.timeout: The read operation timed out
Mar 29 14:00:52 pihome hass[2958]: During handling of the above exception, another exception occurred:
Mar 29 14:00:52 pihome hass[2958]: Traceback (most recent call last):
Mar 29 14:00:52 pihome hass[2958]: File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 279, in async_update_ha_state
Mar 29 14:00:52 pihome hass[2958]: await self.async_device_update()
Mar 29 14:00:52 pihome hass[2958]: File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 476, in async_device_update
Mar 29 14:00:52 pihome hass[2958]: await self.hass.async_add_executor_job(self.update)
Mar 29 14:00:52 pihome hass[2958]: File "/usr/lib/python3.7/concurrent/futures/thread.py", line 57, in run
Mar 29 14:00:52 pihome hass[2958]: result = self.fn(*self.args, **self.kwargs)
Mar 29 14:00:52 pihome hass[2958]: File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/samsungtv/media_player.py", line 127, in update
Mar 29 14:00:52 pihome hass[2958]: self._state = STATE_ON if self._bridge.is_on() else STATE_OFF
Mar 29 14:00:52 pihome hass[2958]: File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/samsungtv/bridge.py", line 66, in is_on
Mar 29 14:00:52 pihome hass[2958]: return self._get_remote() is not None
Mar 29 14:00:52 pihome hass[2958]: File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/samsungtv/bridge.py", line 256, in _get_remote
Mar 29 14:00:52 pihome hass[2958]: self._remote.open()
Mar 29 14:00:52 pihome hass[2958]: File "/srv/homeassistant/lib/python3.7/site-packages/samsungtvws/remote.py", line 149, in open
Mar 29 14:00:52 pihome hass[2958]: response = self._process_api_response(self.connection.recv())
Mar 29 14:00:52 pihome hass[2958]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_core.py", line 313, in recv
Mar 29 14:00:52 pihome hass[2958]: opcode, data = self.recv_data()
Mar 29 14:00:52 pihome hass[2958]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_core.py", line 330, in recv_data
Mar 29 14:00:52 pihome hass[2958]: opcode, frame = self.recv_data_frame(control_frame)
Mar 29 14:00:52 pihome hass[2958]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_core.py", line 343, in recv_data_frame
Mar 29 14:00:52 pihome hass[2958]: frame = self.recv_frame()
Mar 29 14:00:52 pihome hass[2958]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_core.py", line 377, in recv_frame
Mar 29 14:00:52 pihome hass[2958]: return self.frame_buffer.recv_frame()
Mar 29 14:00:52 pihome hass[2958]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_abnf.py", line 361, in recv_frame
Mar 29 14:00:52 pihome hass[2958]: self.recv_header()
Mar 29 14:00:52 pihome hass[2958]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_abnf.py", line 309, in recv_header
Mar 29 14:00:52 pihome hass[2958]: header = self.recv_strict(2)
Mar 29 14:00:52 pihome hass[2958]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_abnf.py", line 396, in recv_strict
Mar 29 14:00:52 pihome hass[2958]: bytes_ = self.recv(min(16384, shortage))
Mar 29 14:00:52 pihome hass[2958]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_core.py", line 452, in _recv
Mar 29 14:00:52 pihome hass[2958]: return recv(self.sock, bufsize)
Mar 29 14:00:52 pihome hass[2958]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_socket.py", line 105, in recv
Mar 29 14:00:52 pihome hass[2958]: raise WebSocketTimeoutException(message)
Mar 29 14:00:52 pihome hass[2958]: websocket._exceptions.WebSocketTimeoutException: The read operation timed out
Mar 29 14:01:05 pihome hass[2958]: 2020-03-29 14:01:05 DEBUG (SyncWorker_17) [samsungtvws.remote] Connection closed.
Mar 29 14:01:05 pihome hass[2958]: 2020-03-29 14:01:05 DEBUG (SyncWorker_17) [homeassistant.components.samsungtv] Create SamsungTVWS
Mar 29 14:01:05 pihome hass[2958]: 2020-03-29 14:01:05 DEBUG (SyncWorker_17) [samsungtvws.remote] WS url wss://192.168.1.100:8002/api/v2/channels/samsung.remote.control?name=SG9tZUFzc2lzdGFudA==&token=13394648
Mar 29 14:01:13 pihome hass[2958]: 2020-03-29 14:01:13 DEBUG (SyncWorker_19) [samsungtvws.remote] Connection closed.
Mar 29 14:01:13 pihome hass[2958]: 2020-03-29 14:01:13 DEBUG (SyncWorker_19) [homeassistant.components.samsungtv] Create SamsungTVWS
Mar 29 14:01:13 pihome hass[2958]: 2020-03-29 14:01:13 DEBUG (SyncWorker_19) [samsungtvws.remote] WS url wss://192.168.1.100:8002/api/v2/channels/samsung.remote.control?name=SG9tZUFzc2lzdGFudA==&token=13394648
Mar 29 14:01:24 pihome hass[2958]: 2020-03-29 14:01:24 DEBUG (SyncWorker_0) [samsungtvws.remote] Connection closed.
Mar 29 14:01:24 pihome hass[2958]: 2020-03-29 14:01:24 DEBUG (SyncWorker_0) [homeassistant.components.samsungtv] Create SamsungTVWS
Mar 29 14:01:24 pihome hass[2958]: 2020-03-29 14:01:24 DEBUG (SyncWorker_0) [samsungtvws.remote] WS url wss://192.168.1.100:8002/api/v2/channels/samsung.remote.control?name=SG9tZUFzc2lzdGFudA==&token=13394648
Mar 29 14:01:25 pihome hass[2958]: 2020-03-29 14:01:25 ERROR (MainThread) [homeassistant.helpers.entity] Update for media_player.tv fails
Mar 29 14:01:25 pihome hass[2958]: Traceback (most recent call last):
Mar 29 14:01:25 pihome hass[2958]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_socket.py", line 102, in recv
Mar 29 14:01:25 pihome hass[2958]: bytes_ = _recv()
Mar 29 14:01:25 pihome hass[2958]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_socket.py", line 84, in _recv
Mar 29 14:01:25 pihome hass[2958]: return sock.recv(bufsize)
Mar 29 14:01:25 pihome hass[2958]: File "/usr/lib/python3.7/ssl.py", line 1037, in recv
Mar 29 14:01:25 pihome hass[2958]: return self.read(buflen)
Mar 29 14:01:25 pihome hass[2958]: File "/usr/lib/python3.7/ssl.py", line 913, in read
Mar 29 14:01:25 pihome hass[2958]: return self._sslobj.read(len)
Mar 29 14:01:25 pihome hass[2958]: socket.timeout: The read operation timed out
Mar 29 14:01:25 pihome hass[2958]: During handling of the above exception, another exception occurred:
Mar 29 14:01:25 pihome hass[2958]: Traceback (most recent call last):
Mar 29 14:01:25 pihome hass[2958]: File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 279, in async_update_ha_state
Mar 29 14:01:25 pihome hass[2958]: await self.async_device_update()
Mar 29 14:01:25 pihome hass[2958]: File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 476, in async_device_update
Mar 29 14:01:25 pihome hass[2958]: await self.hass.async_add_executor_job(self.update)
Mar 29 14:01:25 pihome hass[2958]: File "/usr/lib/python3.7/concurrent/futures/thread.py", line 57, in run
Mar 29 14:01:25 pihome hass[2958]: result = self.fn(*self.args, **self.kwargs)
Mar 29 14:01:25 pihome hass[2958]: File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/samsungtv/media_player.py", line 127, in update
Mar 29 14:01:25 pihome hass[2958]: self._state = STATE_ON if self._bridge.is_on() else STATE_OFF
Mar 29 14:01:25 pihome hass[2958]: File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/samsungtv/bridge.py", line 66, in is_on
Mar 29 14:01:25 pihome hass[2958]: return self._get_remote() is not None
Mar 29 14:01:25 pihome hass[2958]: File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/samsungtv/bridge.py", line 256, in _get_remote
Mar 29 14:01:25 pihome hass[2958]: self._remote.open()
Mar 29 14:01:25 pihome hass[2958]: File "/srv/homeassistant/lib/python3.7/site-packages/samsungtvws/remote.py", line 149, in open
Mar 29 14:01:25 pihome hass[2958]: response = self._process_api_response(self.connection.recv())
Mar 29 14:01:25 pihome hass[2958]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_core.py", line 313, in recv
Mar 29 14:01:25 pihome hass[2958]: opcode, data = self.recv_data()
Mar 29 14:01:25 pihome hass[2958]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_core.py", line 330, in recv_data
Mar 29 14:01:25 pihome hass[2958]: opcode, frame = self.recv_data_frame(control_frame)
Mar 29 14:01:25 pihome hass[2958]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_core.py", line 343, in recv_data_frame
Mar 29 14:01:25 pihome hass[2958]: frame = self.recv_frame()
Mar 29 14:01:25 pihome hass[2958]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_core.py", line 377, in recv_frame
Mar 29 14:01:25 pihome hass[2958]: return self.frame_buffer.recv_frame()
Mar 29 14:01:25 pihome hass[2958]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_abnf.py", line 361, in recv_frame
Mar 29 14:01:25 pihome hass[2958]: self.recv_header()
Mar 29 14:01:25 pihome hass[2958]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_abnf.py", line 309, in recv_header
Mar 29 14:01:25 pihome hass[2958]: header = self.recv_strict(2)
Mar 29 14:01:25 pihome hass[2958]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_abnf.py", line 396, in recv_strict
Mar 29 14:01:25 pihome hass[2958]: bytes_ = self.recv(min(16384, shortage))
Mar 29 14:01:25 pihome hass[2958]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_core.py", line 452, in _recv
Mar 29 14:01:25 pihome hass[2958]: return recv(self.sock, bufsize)
Mar 29 14:01:25 pihome hass[2958]: File "/srv/homeassistant/lib/python3.7/site-packages/websocket/_socket.py", line 105, in recv
Mar 29 14:01:25 pihome hass[2958]: raise WebSocketTimeoutException(message)
Mar 29 14:01:25 pihome hass[2958]: websocket._exceptions.WebSocketTimeoutException: The read operation timed out
Here's the content of my core.config_entries:
{
"connection_class": "local_poll",
"data": {
"host": "192.168.1.100",
"id": null,
"ip_address": "192.168.1.100",
"manufacturer": null,
"method": "websocket",
"model": null,
"name": "TV",
"port": 8002,
"token": "13394648"
},
"domain": "samsungtv",
"entry_id": "112e09926b454d39b7fec285b561a183",
"options": {},
"source": "import",
"system_options": {
"disable_new_entities": false
},
"title": "TV",
"unique_id": "192.168.1.100",
"version": 1
}
After the error what did you to do restore normal operation?
Thankfully, I had a quite recent backup handy and so I used it to restore...
Did the debugs I collected help in narrowing down the issue?
I think fix should be easy (add WebsocketException handling at bridge level).
I'd add it for sure in the is_on method. @escoand do you think it has to be handled also in the _get_remote (just like the ConnectionFailure)?
@tulindo - yes, I think exception handling is needed as I mentioned in one of my previous posts. Not sure though if that's enough or TV would go in unmanaged state, therefore resulting offline. Maybe we can give it a try and see.
Ah, I probably forgot to mention that when the error has occurred earlier today, I've seen repeated notifications of access request from HA to my TV (even though I tried to set on TV "notify only once" or "do not notify"). Would simply catching the WebsocketTimeoutException solve that? Probably not, right?
I'd add it for sure in the
is_onmethod. @escoand do you think it has to be handled also in the_get_remote(just like theConnectionFailure)?
This error could happen on every connect attempt, so we should handle it for all of them. The question is if we do it multiple times or just once in _get_remote. Not sure what's best.
For me it's still not clear why this is happening. Just catching the exception is definitely not a solution. When there are auth popups on the TV then something changed from it's point of view. I was wondering if it's maybe some kind of rate limit. Perhaps we should not re-open the connection every n seconds but do a dummy/no-op request. Is something in this direction known?
@escoand I do agree.... timeout exception must be handled always and it's quite easy to implement. Will this solve the issue? I don't know.
From the @LeoCal's log i see:
2020-03-29 14:00:33 WARNING (SyncWorker_16) [homeassistant.components.homekit.type_media_players] media_player.tv: Sources out of sync. Restart Home Assistant
What does it mean? Can this be linked to the errors @LeoCal is experiencing?
As a long term approach the bridge can keep the connection alive and use a sort of "ping" method to detect if the TV status. samsungtvws has such a method we can use... but what about samsungctl? few times ago it was using the "send_key" with a fake key but we changed it in order to get rid of the annoying logging message.
I'm using samsungctl on a daily basis without any problem. So we don't need to think about it atm.
@LeoCal When you turn the TV off and let the whole problem calm a bit down, is it working later without changing anything? I'm asking because from HA's point nothing changed but the TV is responding weird.
And when you accept one of the new auth requests, do you have 2 entries in the TV config? And do they have some obvious differences?
If it's happening too fast you could hard code the timeout value to a higher value when used as custom_component.
@LeoCal When you turn the TV off and let the whole problem calm a bit down, is it working later without changing anything? I'm asking because from HA's point nothing changed but the TV is responding weird.
No, when the issue happens I couldn't find a way to recover, even after turning the TV off. In particular, yesterday, my Raspberry PI went into a weird state and I decided to restore the backup (which is based on the older HA 0.106.5) and I have left the samsungtv off for now.
And when you accept one of the new auth requests, do you have 2 entries in the TV config? And do they have some obvious differences?
No, I still see the same entry on the TV, but the message on the TV screen keeps repeating forever, until I kill HA. My gut feeling is that, once in the weird state, even accepting the request doesn't actually take the new connection establishment to a successful conclusion.
If it's happening too fast you could hard code the timeout value to a higher value when used as custom_component.
Not sure it would help, but please do point me to the line of code you're referring to and I'll have a look.
Not sure it would help, but please do point me to the line of code you're referring to and I'll have a look.
I'm using samsungctl on a daily basis without any problem. So we don't need to think about it atm.
Mee too with samsungtvws... But I think that opening and closing connection every 10 seconds is not the best approach.
@LeoCal
If you'd like to try can you add (same file linked by @escoand) WebSocketException handling.
Line 70 and 269.
Let me understand.
When you experience the problem the only way to have the system up and running is to restore HA from the backup?
Even is you turn off your TV and HA. when you restart HA... the whole stuff doesn't work as expected? and the only solution is to restore HA?
Sure you're not having hardware issues with your PI?
@LeoCal
If you'd like to try can you add (same file linked by @escoand) WebSocketException handling.
Line 70 and 269.
Let me understand.
When you experience the problem the only way to have the system up and running is to restore HA from the backup?
Even is you turn off your TV and HA. when you restart HA... the whole stuff doesn't work as expected? and the only solution is to restore HA?
No, it wasn't the case the first two times it occurred, but last one was quite bad and I had to restore.
Sure you're not having hardware issues with your PI?
This is not happening frequently, but I cannot exclude that either. Next time it happens, I might try to swap my "production" Raspberry PI with the one I use to experiment new things.
I think for now I'll keep HA 0.106.5 for some time (without samsungtv) and see if issues happen again. If I don't see issues for some time, I guess we can exclude hardware fault.
I'm on 0.108.2 and since a couple of versions (not sure when it started, i think 0.107) i see the following in the logs: "
media_player.samsung_led46_ue46h7000: Sources out of sync. Restart Home Assistant "
HA doesn't detect any state changes from the TV anymore
Upon clicking it, it gives:
" Logger: homeassistant.components.homekit.type_media_players
Source: components/homekit/type_media_players.py:426
Integration: homekit (documentation, issues)
media_player.samsung_led46_ue46h7000: Sources out of sync. Restart Home Assistant "
@raoulteeuwen
This is apperantly happening when the current source is not within the sources list. The samsungtv integration has a hardcoded sources list but is not able to get the current source. So it is at the beginning None and later the last selected. Is this now a homekid or a samsungtv problem?
@escoand no idea. Do you mean i have to find another place to report the error i have in the logs, try to find a HA homekit thread?
No sure what to do with this problem. Maybe the homekid codeowner could help.
@bdraco do you have a suggestion?
@raoulteeuwen please open a new issue. This is offtopic for this issue.
same issue, turning on is possible, but turning off or controlling can't. Having a UE49KS7000
host: !secret samsung_tv_ip
name: TV
turn_on_action:
- service: wake_on_lan.send_magic_packet
data:
mac: "00:00:00:00:00:00" #redacted
entity is shown correct, info, type and brand is shown correct, but controlling not possible (turn off).
Got a warning on TV for allowing HA, that part went just fine, and allowed it.
log:
2020-05-09 13:15:48 DEBUG (SyncWorker_13) [homeassistant.components.samsungtv] Create SamsungTVWS,
2020-05-09 13:15:48 DEBUG (SyncWorker_13) [samsungtvws.remote] WS url ws://10.10.11.11:8001/api/v2/channels/samsung.remote.control?name=SG9tZUFzc2lzdGFudA==,
2020-05-09 13:15:59 DEBUG (SyncWorker_0) [samsungtvws.remote] Connection closed.,
2020-05-09 13:15:59 DEBUG (SyncWorker_0) [homeassistant.components.samsungtv] Create SamsungTVWS,
2020-05-09 13:15:59 DEBUG (SyncWorker_0) [samsungtvws.remote] WS url ws://10.10.11.11:8001/api/v2/channels/samsung.remote.control?name=SG9tZUFzc2lzdGFudA==,
2020-05-09 13:16:10 DEBUG (SyncWorker_13) [samsungtvws.remote] Connection closed.,
2020-05-09 13:16:10 DEBUG (SyncWorker_13) [homeassistant.components.samsungtv] Create SamsungTVWS,
2020-05-09 13:16:10 DEBUG (SyncWorker_13) [samsungtvws.remote] WS url ws://10.10.11.11:8001/api/v2/channels/samsung.remote.control?name=SG9tZUFzc2lzdGFudA==,
2020-05-09 13:16:21 DEBUG (SyncWorker_2) [samsungtvws.remote] Connection closed.,
2020-05-09 13:16:21 DEBUG (SyncWorker_2) [homeassistant.components.samsungtv] Create SamsungTVWS,
2020-05-09 13:16:21 DEBUG (SyncWorker_2) [samsungtvws.remote] WS url ws://10.10.11.11:8001/api/v2/channels/samsung.remote.control?name=SG9tZUFzc2lzdGFudA==,
2020-05-09 13:16:32 DEBUG (SyncWorker_19) [homeassistant.components.samsungtv] Create SamsungTVWS,
2020-05-09 13:16:32 DEBUG (SyncWorker_19) [samsungtvws.remote] WS url ws://10.10.11.11:8001/api/v2/channels/samsung.remote.control?name=SG9tZUFzc2lzdGFudA==,
2020-05-09 13:16:43 DEBUG (SyncWorker_14) [homeassistant.components.samsungtv] Create SamsungTVWS,
2020-05-09 13:16:43 DEBUG (SyncWorker_14) [samsungtvws.remote] WS url ws://10.10.11.11:8001/api/v2/channels/samsung.remote.control?name=SG9tZUFzc2lzdGFudA==,
2020-05-09 13:16:54 DEBUG (SyncWorker_4) [homeassistant.components.samsungtv] Create SamsungTVWS,
2020-05-09 13:16:54 DEBUG (SyncWorker_4) [samsungtvws.remote] WS url ws://10.10.11.11:8001/api/v2/channels/samsung.remote.control?name=SG9tZUFzc2lzdGFudA==,
2020-05-09 13:17:05 DEBUG (SyncWorker_11) [homeassistant.components.samsungtv] Create SamsungTVWS,
2020-05-09 13:17:05 DEBUG (SyncWorker_11) [samsungtvws.remote] WS url ws://10.10.11.11:8001/api/v2/channels/samsung.remote.control?name=SG9tZUFzc2lzdGFudA==,
2020-05-09 13:17:16 DEBUG (SyncWorker_0) [homeassistant.components.samsungtv] Create SamsungTVWS,
2020-05-09 13:17:16 DEBUG (SyncWorker_0) [samsungtvws.remote] WS url ws://10.10.11.11:8001/api/v2/channels/samsung.remote.control?name=SG9tZUFzc2lzdGFudA==,
2020-05-09 13:17:27 DEBUG (SyncWorker_8) [homeassistant.components.samsungtv] Create SamsungTVWS,
Somebody could test if a higher timeout in homeassistant/components/samsungtv/brigde.py (search for CONF_TIMEOUT) really solves the issue.
sorry i could'nt fix it. I migrated to the custom component for Samsung Tizen, which worked out of the box.
Hello! On my side, I'd be glad to give it another try, to contribute stabilizing the HA codebase.
However, I'm having issues with my Pi2: every 5-10 days, Python SDK files on SD get corrupted and I need to restore the last backup. I replaced SD card, same issue. I suspect a HW issue with the PI itself; therefore, by the end of May, I'm going to migrate to the PI3 I kept in my drawer for long time. At that point, I can give the Samsung integration another try and will let you know.
Meantime, can I suggest you to have a look at the implementation of the "samsungtv_custom" component installable via HACS? Maybe looking at their code might give an idea of how to improve the samsungtv component?
I'd be glad to give it another try, to contribute stabilizing the HA codebase.
Thumbs up! I dislike the it's-not-working-I-use-a-custom-component-way. If everybody is acting like that we'll never have a stable built-in component. That's why I never used HACS.
Meantime, can I suggest you to have a look at the implementation of the "samsungtv_custom" component installable via HACS? Maybe looking at their code might give an idea of how to improve the samsungtv component?
I encourage everybody to do so and create PRs. The samsungtv component is not my code. I've also just adopted the old and extended it. So today the component is working for my legacy TV and this was for me the reason to work on it. If anybody is interested in more or better functionality, feel free to take part as well. @tulindo did it and added functionality for the websocket devices. I'll do my best to help others.
@escoand i do appreciate the amount of work what you did and will do in this project, but iam not skilled coding enough the fix things and can only contribute in collecting log files and thinking along. In this case I was looking for a short term solution. Perhaps in the feature I will switch again to the native component. Again I do like the amount of work everyone is giving is such projects.
Hello, just wanted to let you know that I finally got some time to migrate my home automation system to another raspberry PI. So far, Samsung TV component is behaving correctly (based on HA 109.1). I'll let it run for a couple of weeks and will let you know by the end of June if I see the problem again with the new piece of hardware.
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 馃憤
This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
Hello,
just to close on this, I wanted to confirm that, after 3 months of usage, the Samsung component is still working fine. So, most likely, it was an hardware issue of my old Raspberry PI 2. I'm going ahead and closing this thread.
Thanks everyone for your support.