Samsung TV will turn ON, not OFF

Gday, Ive had my TV working for ON/OFF (and status detection) for some time now but recently it has stopped working. It is a Samsung ua55mu9000 (Australia). I have a static IP, connected wirelessly on 5Ghz. I have specified the mac and port in the config. I had a few problems (with the 2.4Ghz network) after reflashing a router recently but thats all I can think of that has changed other than keeping up with HASS releases, currently running Raspberry pi, 82.1.

The TV will now turn ON via HASS and Google Home but will not show as ON and thus wont turn off. Any help appreciated.

media_player:
  - platform: samsungtv
    host: 192.168.1.10
    name: TV
    port: 8001
    mac: xx:xx:xx:xx:xx:xx

        2018-11-24 07:47:53 ERROR (MainThread) [homeassistant.helpers.entity] Update for media_player.tv fails
    Traceback (most recent call last):
      File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 221, in async_update_ha_state
        await self.async_device_update()
      File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 349, in async_device_update
        await self.hass.async_add_executor_job(self.update)
      File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
        result = self.fn(*self.args, **self.kwargs)
      File "/usr/local/lib/python3.6/site-packages/homeassistant/components/media_player/samsungtv.py", line 129, in update
        self.send_key("KEY")
      File "/usr/local/lib/python3.6/site-packages/homeassistant/components/media_player/samsungtv.py", line 150, in send_key
        self.get_remote().control(key)
      File "/usr/local/lib/python3.6/site-packages/homeassistant/components/media_player/samsungtv.py", line 135, in get_remote
        self._remote = self._remote_class(self._config)
      File "/usr/local/lib/python3.6/site-packages/samsungctl/remote.py", line 11, in __init__
        self.remote = RemoteWebsocket(config)
      File "/usr/local/lib/python3.6/site-packages/samsungctl/remote_websocket.py", line 30, in __init__
        self._read_response()
      File "/usr/local/lib/python3.6/site-packages/samsungctl/remote_websocket.py", line 67, in _read_response
        response = self.connection.recv()
      File "/usr/local/lib/python3.6/site-packages/websocket/_core.py", line 298, in recv
        opcode, data = self.recv_data()
      File "/usr/local/lib/python3.6/site-packages/websocket/_core.py", line 315, in recv_data
        opcode, frame = self.recv_data_frame(control_frame)
      File "/usr/local/lib/python3.6/site-packages/websocket/_core.py", line 328, in recv_data_frame
        frame = self.recv_frame()
      File "/usr/local/lib/python3.6/site-packages/websocket/_core.py", line 360, in recv_frame
        return self.frame_buffer.recv_frame()
      File "/usr/local/lib/python3.6/site-packages/websocket/_abnf.py", line 334, in recv_frame
        frame.validate(self.skip_utf8_validation)
      File "/usr/local/lib/python3.6/site-packages/websocket/_abnf.py", line 149, in validate
        raise WebSocketProtocolException("Invalid close opcode.")
    websocket._exceptions.WebSocketProtocolException: Invalid close opcode.
2 Likes

Since 0.81 the Samsung TV component has been changed and it’s not working very well anymore.
In this thread two problems are described:
https://github.com/home-assistant/home-assistant/issues/17802

1 Like

Thank you very much. I did not find that issue via google. Fingers crossed for a fix otherwise I will downgrade. 80 was a perfect release for me.