Page 1 of 1

Samsung TV Python plugin (samsungctl): does not work anymore?

Posted: Friday 23 October 2020 22:41
by pgielen
I found a message in the forum saying that the Samsung TV plugin does not work anymore (viewtopic.php?t=16050), but the Wiki page (https://www.domoticz.com/wiki/Plugins/SamsungTV.html) is still there, so I had to try this with my new Samsung TU8500 (Series 8) TV. Unfortunately, without any luck (yet).

I installed samsungctl on my RPi4B running Raspbian Buster with updated software and newest version of Domoticz (2020.2 build 12.497) following the guide in the Wiki.

After installing, I entered the following command in the CLI:

Code: Select all

samsungctl -i --host 192.168.1.234 --port 8002  --method websocket
The program immediately exits with the following messages:

Code: Select all

Traceback (most recent call last):
  File "/home/pi/.local/bin/samsungctl", line 8, in <module>
    sys.exit(main())
  File "/home/pi/.local/lib/python3.7/site-packages/samsungctl/__main__.py", line 110, in main
    with Remote(config) as remote:
  File "/home/pi/.local/lib/python3.7/site-packages/samsungctl/remote.py", line 11, in __init__
    self.remote = RemoteWebsocket(config)
  File "/home/pi/.local/lib/python3.7/site-packages/samsungctl/remote_websocket.py", line 28, in __init__
    self.connection = websocket.create_connection(url, config["timeout"])
  File "/usr/local/lib/python3.7/dist-packages/websocket/_core.py", line 515, in create_connection
    websock.connect(url, **options)
  File "/usr/local/lib/python3.7/dist-packages/websocket/_core.py", line 226, in connect
    self.handshake_response = handshake(self.sock, *addrs, **options)
  File "/usr/local/lib/python3.7/dist-packages/websocket/_handshake.py", line 80, in handshake
    status, resp = _get_resp_headers(sock)
  File "/usr/local/lib/python3.7/dist-packages/websocket/_handshake.py", line 163, in _get_resp_headers
    status, resp_headers, status_message = read_headers(sock)
  File "/usr/local/lib/python3.7/dist-packages/websocket/_http.py", line 309, in read_headers
    line = recv_line(sock)
  File "/usr/local/lib/python3.7/dist-packages/websocket/_socket.py", line 123, in recv_line
    c = recv(sock, 1)
  File "/usr/local/lib/python3.7/dist-packages/websocket/_socket.py", line 115, in recv
    "Connection is already closed.")
websocket._exceptions.WebSocketConnectionClosedException: Connection is already closed.
This does not tell me much... (BTW omitting the part -- port 8002 resulted in an endless loop which I had to end with ^C and omitting --method websocket just gave me a 'connection refused' error).

Next I put the plugin.py in the domoticz/plugins/SamsungTV folder and rebooted. After that, the Samsung TV hardware showed up in Domoticz, so I entered the TV's IP and created a couple of devices with it, but it was no surprise that they do nothing...

Am I missing something? Or is this plugin not compatible anymore with 2020.2 Domoticz and 2020 TV's? Can it be fixed or do we need to look at a cloud based solution like SmartThings? :?

Re: Samsung TV Python plugin (samsungctl): does not work anymore?

Posted: Friday 23 October 2020 22:45
by Trigun
pgielen wrote:I found a message in the forum saying that the Samsung TV plugin does not work anymore (viewtopic.php?t=16050), but the Wiki page (https://www.domoticz.com/wiki/Plugins/SamsungTV.html) is still there, so I had to try this with my new Samsung TU8500 (Series 8) TV. Unfortunately, without any luck (yet).

I installed samsungctl on my RPi4B running Raspbian Buster with updated software and newest version of Domoticz (2020.2 build 12.497) following the guide in the Wiki.

After installing, I entered the following command in the CLI:

Code: Select all

samsungctl -i --host 192.168.1.234 --port 8002  --method websocket
The program immediately exits with the following messages:

Code: Select all

Traceback (most recent call last):
  File "/home/pi/.local/bin/samsungctl", line 8, in <module>
    sys.exit(main())
  File "/home/pi/.local/lib/python3.7/site-packages/samsungctl/__main__.py", line 110, in main
    with Remote(config) as remote:
  File "/home/pi/.local/lib/python3.7/site-packages/samsungctl/remote.py", line 11, in __init__
    self.remote = RemoteWebsocket(config)
  File "/home/pi/.local/lib/python3.7/site-packages/samsungctl/remote_websocket.py", line 28, in __init__
    self.connection = websocket.create_connection(url, config["timeout"])
  File "/usr/local/lib/python3.7/dist-packages/websocket/_core.py", line 515, in create_connection
    websock.connect(url, **options)
  File "/usr/local/lib/python3.7/dist-packages/websocket/_core.py", line 226, in connect
    self.handshake_response = handshake(self.sock, *addrs, **options)
  File "/usr/local/lib/python3.7/dist-packages/websocket/_handshake.py", line 80, in handshake
    status, resp = _get_resp_headers(sock)
  File "/usr/local/lib/python3.7/dist-packages/websocket/_handshake.py", line 163, in _get_resp_headers
    status, resp_headers, status_message = read_headers(sock)
  File "/usr/local/lib/python3.7/dist-packages/websocket/_http.py", line 309, in read_headers
    line = recv_line(sock)
  File "/usr/local/lib/python3.7/dist-packages/websocket/_socket.py", line 123, in recv_line
    c = recv(sock, 1)
  File "/usr/local/lib/python3.7/dist-packages/websocket/_socket.py", line 115, in recv
    "Connection is already closed.")
websocket._exceptions.WebSocketConnectionClosedException: Connection is already closed.
This does not tell me much... (BTW omitting the part -- port 8002 resulted in an endless loop which I had to end with ^C and omitting --method websocket just gave me a 'connection refused' error).

Next I put the plugin.py in the domoticz/plugins/SamsungTV folder and rebooted. After that, the Samsung TV hardware showed up in Domoticz, so I entered the TV's IP and created a couple of devices with it, but it was no surprise that they do nothing...

Am I missing something? Or is this plugin not compatible anymore with 2020.2 Domoticz and 2020 TV's? Can it be fixed or do we need to look at a cloud based solution like SmartThings? :?
I got it working via node red works fine
I’ve tried endlessly using this method without any luck. Node red was the solution for me.
Just download the latest Samsung tv node and your good to go. I am using it in combination with MQTT.


Sent from my iPhone using Tapatalk

Re: Samsung TV Python plugin (samsungctl): does not work anymore?

Posted: Sunday 25 October 2020 16:47
by pgielen
Trigun wrote: Friday 23 October 2020 22:45 I got it working via node red works fine
Node red was still undiscovered territority for me until now, but I have got it working with the node-red-contrib-samsung-tv-control: https://flows.nodered.org/node/node-red ... tv-control. Thanks!

Re: Samsung TV Python plugin (samsungctl): does not work anymore?

Posted: Monday 26 October 2020 12:36
by Trigun
pgielen wrote:
Trigun wrote: Friday 23 October 2020 22:45 I got it working via node red works fine
Node red was still undiscovered territority for me until now, but I have got it working with the node-red-contrib-samsung-tv-control: https://flows.nodered.org/node/node-red ... tv-control. Thanks!
Great Job!


Sent from my iPhone using Tapatalk

Re: Samsung TV Python plugin (samsungctl): does not work anymore?

Posted: Monday 02 November 2020 14:04
by pgielen
After some experimenting, I wrote a step-by-step manual for controlling the new Samsung Smart TV's with Domoticz. It's published on my blog (in Dutch), here: https://robothuis.nl/2020/11/02/koppel- ... -domoticz/