Python Plugin: Samsung TV

Python and python framework
sennheiser
Posts: 11
Joined: Wednesday 16 August 2017 10:42
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Python Plugin: Samsung TV

Post by sennheiser » Friday 08 September 2017 12:56

@zak45

I installed python plugin SamsungTV and it's ok but I want to use the Kodi remote but I have this message :

(Samsung TV) Remote command not defined: Select

But I don't know how to defined this commande ?

Thx

zak45
Posts: 325
Joined: Sunday 22 January 2017 12:37
Target OS: Windows
Domoticz version: V3.8153
Contact:

Re: Python Plugin: Samsung TV

Post by zak45 » Friday 08 September 2017 18:23

Wiki need to be updated .... :oops:
Which version you have ?

sennheiser
Posts: 11
Joined: Wednesday 16 August 2017 10:42
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Python Plugin: Samsung TV

Post by sennheiser » Friday 08 September 2017 19:18

@zak45

samsungctl-0.6.0.tar.gz

zak45
Posts: 325
Joined: Sunday 22 January 2017 12:37
Target OS: Windows
Domoticz version: V3.8153
Contact:

Re: Python Plugin: Samsung TV

Post by zak45 » Friday 08 September 2017 20:04

sennheiser wrote:
Friday 08 September 2017 19:18
@zak45

samsungctl-0.6.0.tar.gz
what's your plugin version ?
2017-09-08 20:03:44.935 (Samsung TV Salon) Initialized version 2.0.0, author 'zak45'

Yustmenl
Posts: 43
Joined: Wednesday 28 September 2016 17:26
Target OS: Raspberry Pi
Domoticz version: 3.5997
Contact:

Re: Python Plugin: Samsung TV

Post by Yustmenl » Saturday 09 September 2017 12:38

Hello when tying to run
sudo samsungctl -i --host 192.168.X.X --port 8001 --method websocket
I get this as a result

Code: Select all

Traceback (most recent call last):
  File "/usr/local/bin/samsungctl", line 11, in <module>
    load_entry_point('samsungctl==0.6.0', 'console_scripts', 'samsungctl')()
  File "/usr/local/lib/python2.7/dist-packages/samsungctl/__main__.py", line 93, in main
    config = _read_config()
  File "/usr/local/lib/python2.7/dist-packages/samsungctl/__main__.py", line 37, in _read_config
    except FileNotFoundError:
NameError: global name 'FileNotFoundError' is not defined
it looks like the plugin is trying to use python 2.7 even though python 3 is installed

I also tryed this https://linuxconfig.org/how-to-change-f ... bian-linux but this didn't turned out to be a sollution.

anyone have any idea what could be the issue?

[edit] somehowe i could install samsungctl again with pip install samsungctl
and the same goes for websocket

also when testing from the commandline it works and i see responce on my TV but the plugin gives the folowing error in the log

Code: Select all

2017-09-09 17:34:59.658 Error: (SamsungTV) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/samsungtv/:/usr/lib/python3.4/:/usr/lib/python3.4/plat-arm-linux-gnueabihf:/usr/lib/python3.4/lib-dynload'.
2017-09-09 17:34:59.658 Error: (TV Woonkamer) Module Import failed, exception: 'ImportError'
2017-09-09 17:34:59.658 Error: (TV Woonkamer) Module Import failed: ' Name: samsungctl'
[Edit 2] i found the problem, i overlooked one line in the wiki

Code: Select all

sudo cp -r /usr/local/lib/python3.4/dist-packages/samsungctl/ /usr/lib/python3.4/
Rasberry Pi 3; Razberry 2.0; RFXCOM

zak45
Posts: 325
Joined: Sunday 22 January 2017 12:37
Target OS: Windows
Domoticz version: V3.8153
Contact:

Re: Python Plugin: Samsung TV

Post by zak45 » Sunday 10 September 2017 11:56

@Yustmenl
nice that you have been able to help yourself ;-)

sennheiser
Posts: 11
Joined: Wednesday 16 August 2017 10:42
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Python Plugin: Samsung TV

Post by sennheiser » Sunday 10 September 2017 22:02

@zak45

Hi,

I don't know what's happen but I create a folder SamsungTV but when I reboot my raspberry this folder is automatically delete !

I'm lost....

EDIT : It's the same with domoticz ... if I add a switch for exemple it's remove if I reboot my raspberry :(

zak45
Posts: 325
Joined: Sunday 22 January 2017 12:37
Target OS: Windows
Domoticz version: V3.8153
Contact:

Re: Python Plugin: Samsung TV

Post by zak45 » Sunday 10 September 2017 23:37

Looks like your Domoticz re install at each boot !! ??

sennheiser
Posts: 11
Joined: Wednesday 16 August 2017 10:42
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Python Plugin: Samsung TV

Post by sennheiser » Monday 11 September 2017 9:49

Looks like my raspberry is in read only mode !
I tried to install the new beta domoticz software... after this installation, it was ok but after the raspberry reboot I was back at the last version of domoticz.

EDIT : I was clone my SD CARD and it's ok with the new SD CARD ! ...

mircer
Posts: 2
Joined: Saturday 23 September 2017 19:52
Target OS: -
Domoticz version:
Contact:

Re: Python Plugin: Samsung TV

Post by mircer » Saturday 23 September 2017 19:55

Hello
First, i want to Thank you all for the information you share.
I have a problem and I will be glad if someone can help
when I try to turn off the TV, I getting this error:
2017-09-23 20:47:45.100 Error: (SamsungTV) 'onCommand' failed 'WebSocketBadStatusException'.
2017-09-23 20:47:45.101 Error: (SamsungTV) ----> Line 170 in C:\Program Files (x86)\Domoticz\plugins\SamsungTV\plugin.py, function onCommand
2017-09-23 20:47:45.101 Error: (SamsungTV) ----> Line 287 in C:\Program Files (x86)\Domoticz\plugins\SamsungTV\plugin.py, function SamsungSend
2017-09-23 20:47:45.101 Error: (SamsungTV) ----> Line 10 in C:\Program Files (x86)\Python35-32\Lib\site-packages\samsungctl\remote.py, function __init__
2017-09-23 20:47:45.101 Error: (SamsungTV) ----> Line 23 in C:\Program Files (x86)\Python35-32\Lib\site-packages\samsungctl\remote_websocket.py, function __init__
2017-09-23 20:47:45.101 Error: (SamsungTV) ----> Line 220 in C:\Program Files (x86)\Python35-32\Lib\site-packages\websocket\_core.py, function connect
2017-09-23 20:47:45.101 Error: (SamsungTV) ----> Line 69 in C:\Program Files (x86)\Python35-32\Lib\site-packages\websocket\_handshake.py, function handshake
2017-09-23 20:47:45.101 Error: (SamsungTV) ----> Line 129 in C:\Program Files (x86)\Python35-32\Lib\site-packages\websocket\_handshake.py, function _get_resp_headers

i'm using Python 3.5.2.

Thanks

I found the problem. now there is no error, but the commands not work (only ON command working)
Last edited by mircer on Saturday 23 September 2017 20:09, edited 1 time in total.

User avatar
emme
Posts: 644
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: Python Plugin: Samsung TV

Post by emme » Saturday 23 September 2017 20:03

Let me just say

OMG! this plugin is AMAZING!!! :D :D

THANK YOU SO MUCH!!!
That's one small step for a programmer, one giant leap for me!
- - - - -
Raspberry Pi3 + AeonStick G5 + RFXCOMM433 + iRTrans Server + NodeJS
There's no stress in the mess!!

zak45
Posts: 325
Joined: Sunday 22 January 2017 12:37
Target OS: Windows
Domoticz version: V3.8153
Contact:

Re: Python Plugin: Samsung TV

Post by zak45 » Saturday 23 September 2017 22:39

emme wrote:
Saturday 23 September 2017 20:03
Let me just say

OMG! this plugin is AMAZING!!! :D :D

THANK YOU SO MUCH!!!
Happy you like it ;-)
thanks :-)

User avatar
felix63
Posts: 100
Joined: Monday 07 December 2015 10:30
Target OS: Raspberry Pi
Domoticz version: 3.8275
Location: Gouda
Contact:

Re: Python Plugin: Samsung TV

Post by felix63 » Sunday 24 September 2017 14:13

mircer wrote:
Saturday 23 September 2017 19:55
I found the problem. now there is no error, but the commands not work (only ON command working)
I use the following script to turn off the tv

Code: Select all

samsungctl --method websocket --host 192.168.x.x --port 8001 -v KEY_POWER
Depending on your version of TV you might need to change the method parameter and the port.

mircer
Posts: 2
Joined: Saturday 23 September 2017 19:52
Target OS: -
Domoticz version:
Contact:

Re: Python Plugin: Samsung TV

Post by mircer » Tuesday 26 September 2017 23:49

Hello felix63,

I try:
C:\WINDOWS\system32>samsungctl --method websocket --host 192.168.1.189 --port 8001 -v KEY_POWER
Sending control command: KEY_POWER

But nothing happens.
I have 2017 model, 75mu7000
someone know what i'm doing wrong ?

Thanks for the help

User avatar
felix63
Posts: 100
Joined: Monday 07 December 2015 10:30
Target OS: Raspberry Pi
Domoticz version: 3.8275
Location: Gouda
Contact:

Re: Python Plugin: Samsung TV

Post by felix63 » Wednesday 27 September 2017 10:40

Sorry... difficult to answer that question. I am running on linux not windows. And without any other than 'nothing happens' it's difficult to debug. Can't help you out.

User avatar
emme
Posts: 644
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: Python Plugin: Samsung TV

Post by emme » Wednesday 27 September 2017 10:52

mircer wrote:
Tuesday 26 September 2017 23:49
Hello felix63,

I try:
C:\WINDOWS\system32>samsungctl --method websocket --host 192.168.1.189 --port 8001 -v KEY_POWER
Sending control command: KEY_POWER

But nothing happens.
I have 2017 model, 75mu7000
someone know what i'm doing wrong ?

Thanks for the help
Are you trying to switch it on or off? is that the only one button that does not work?
some models does not support wake up on lan, especially if you have it WiFi connected (the interface is down while tv is off)
If you're trying to switch it off... ensure the remote connection is enabled and the plugin is paired with the device
ciao
M
That's one small step for a programmer, one giant leap for me!
- - - - -
Raspberry Pi3 + AeonStick G5 + RFXCOMM433 + iRTrans Server + NodeJS
There's no stress in the mess!!

User avatar
gijsje
Posts: 64
Joined: Saturday 19 August 2017 14:28
Target OS: Raspberry Pi
Domoticz version:
Location: Berkel Enschot, NL
Contact:

Re: Python Plugin: Samsung TV

Post by gijsje » Monday 16 October 2017 20:32

i think it is seeing the tv
2017-10-16 20:30:54.511 (Samsung TV) Calling message handler 'onHeartbeat'.
2017-10-16 20:30:54.512 (Samsung TV) isAlive status :True
When i want to change something i get
2017-10-16 20:28:07.724 Error: (Samsung TV) 'onCommand' failed 'ImportError'.
2017-10-16 20:28:07.724 Error: (Samsung TV) ----> Line 170 in /home/pi/domoticz/plugins/samsungctl/plugin.py, function onCommand
2017-10-16 20:28:07.724 Error: (Samsung TV) ----> Line 287 in /home/pi/domoticz/plugins/samsungctl/plugin.py, function SamsungSend
2017-10-16 20:28:07.724 Error: (Samsung TV) ----> Line 10 in /usr/lib/python3.5/samsungctl/remote.py, function __init__
2017-10-16 20:28:07.724 Error: (Samsung TV) ----> Line 13 in /usr/lib/python3.5/samsungctl/remote_websocket.py, function __init__
Any idea?

zak45
Posts: 325
Joined: Sunday 22 January 2017 12:37
Target OS: Windows
Domoticz version: V3.8153
Contact:

Re: Python Plugin: Samsung TV

Post by zak45 » Monday 16 October 2017 21:17

'onCommand' failed 'ImportError'

Looks like you do not have copied in the folder that can be found by the plugin system. Please take a look at the wiki.

User avatar
gijsje
Posts: 64
Joined: Saturday 19 August 2017 14:28
Target OS: Raspberry Pi
Domoticz version:
Location: Berkel Enschot, NL
Contact:

Re: Python Plugin: Samsung TV

Post by gijsje » Tuesday 17 October 2017 0:06

i do have the plugin.py in the folder plugins/samsungctl did try also to change the folder to SamsungTV and Samsung TV without suc6
also checked if /usr/lib/python3.5/samsungctl/remote.py and /usr/lib/python3.5/samsungctl/remote_websocket.py are there and they are

If i restart domoticz i do get
2017-10-16 23:44:03.107 Error: (Samsung TV) 'onStart' failed 'ImportError'.
2017-10-16 23:44:03.107 Error: (Samsung TV) ----> Line 134 in /home/pi/domoticz/plugins/SamsungTV/plugin.py, function onStart
2017-10-16 23:44:03.107 Error: (Samsung TV) ----> Line 287 in /home/pi/domoticz/plugins/SamsungTV/plugin.py, function SamsungSend
2017-10-16 23:44:03.107 Error: (Samsung TV) ----> Line 10 in /usr/lib/python3.5/samsungctl/remote.py, function __init__
2017-10-16 23:44:03.107 Error: (Samsung TV) ----> Line 13 in /usr/lib/python3.5/samsungctl/remote_websocket.py, function __init__
if i try button mute i get
017-10-16 23:47:51.587 User: Admin initiated a switch command (117/Samsung TV - Volume/Set Level)
2017-10-16 23:47:51.619 (Samsung TV) Calling message handler 'onCommand'.
2017-10-16 23:47:51.619 (Samsung TV) onCommand called for Unit 3: Parameter 'Off', Level: 0, Connected: True
2017-10-16 23:47:51.621 Error: (Samsung TV) 'onCommand' failed 'ImportError'.
2017-10-16 23:47:51.621 Error: (Samsung TV) ----> Line 182 in /home/pi/domoticz/plugins/SamsungTV/plugin.py, function onCommand
2017-10-16 23:47:51.621 Error: (Samsung TV) ----> Line 287 in /home/pi/domoticz/plugins/SamsungTV/plugin.py, function SamsungSend
2017-10-16 23:47:51.621 Error: (Samsung TV) ----> Line 10 in /usr/lib/python3.5/samsungctl/remote.py, function __init__
2017-10-16 23:47:51.621 Error: (Samsung TV) ----> Line 13 in /usr/lib/python3.5/samsungctl/remote_websocket.py, function __init__
I do have a K series tv so maybe it does not work ue49ks7000s
if i do samsungctl --host 192.168.0.112 --method websocket KEY_VOLUP that is working also samsungctl --host 192.168.0.112 --method websocket KEY_MUTE

dextm80
Posts: 12
Joined: Tuesday 24 October 2017 18:32
Target OS: Linux
Domoticz version: 3.8627
Contact:

Re: Python Plugin: Samsung TV

Post by dextm80 » Tuesday 24 October 2017 18:35

Hi guys, a guide for linux installation (ubuntu) and domoticz?

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests