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

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
User avatar
pgielen
Posts: 90
Joined: Monday 18 February 2019 14:44
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Boxmeer
Contact:

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

Post 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? :?
https://robothuis.nl, RPi4B, RFXCOM XL, Aeotec Z-Stick, ESP Easy, Weatherstation, several switches and sensors, Ikea Trädfri, Philips Hue, Foscam, Reolink, Lyric T6, Ring
Trigun
Posts: 390
Joined: Wednesday 30 November 2016 11:58
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Contact:

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

Post 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
User avatar
pgielen
Posts: 90
Joined: Monday 18 February 2019 14:44
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Boxmeer
Contact:

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

Post 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!
https://robothuis.nl, RPi4B, RFXCOM XL, Aeotec Z-Stick, ESP Easy, Weatherstation, several switches and sensors, Ikea Trädfri, Philips Hue, Foscam, Reolink, Lyric T6, Ring
Trigun
Posts: 390
Joined: Wednesday 30 November 2016 11:58
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Contact:

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

Post 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
User avatar
pgielen
Posts: 90
Joined: Monday 18 February 2019 14:44
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Boxmeer
Contact:

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

Post 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/
https://robothuis.nl, RPi4B, RFXCOM XL, Aeotec Z-Stick, ESP Easy, Weatherstation, several switches and sensors, Ikea Trädfri, Philips Hue, Foscam, Reolink, Lyric T6, Ring
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest