core: Samsung TV component not working and logging traceback

The problem

Samsung TV component update that came in home assistant v0.107.1 is not working and is logging tracebacks.

Environment

Home Assistant 0.107.1

  • Home Assistant release with the issue: 0.107.1
  • Last working Home Assistant release (if known):
  • Operating environment (Hass.io/Docker/Windows/etc.): Manual installation in virtualenv
  • Integration causing this issue: samsungtv
  • Link to integration documentation on our website: https://www.home-assistant.io/integrations/samsungtv/

Problem-relevant configuration.yaml

samsungtv:
  - host: 192.168.1.100
    name: TV
    turn_on_action:
      - service: wake_on_lan.send_magic_packet
        data:
          mac: "<redacted>"

Traceback/Error logs

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

Additional information

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.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 58 (51 by maintainers)

Most upvoted comments

@raoulteeuwen please open a new issue. This is offtopic for this issue.

It’s in the config directory in .storage/core.config_entries. Search for samsungtv.

@LeoCal, I would recommend the following:

  • Go into the device/remote list on your TV and delete all devices. You can find this in the settings of the TV.
  • In that same menu you’ll also see an option to control when authorization should be requested (off, each time, once). Make sure once is selected.
  • Remove the integration from HA in the integration menu. Based on your config above it should be called TV. This gives you a clean slate.
  • Restart HA and pay attention to your TV. During the restart you should get one pop-up asking for authorization.

Following the above steps you should not get any subsequent authorization requests. Could you confirm?