Python Plugin: Samsung TV

Python and python framework

Moderator: leecollings

zak45
Posts: 952
Joined: Sunday 22 January 2017 11:37
Target OS: Windows
Domoticz version: V2024.4
Contact:

Re: Python Plugin: Samsung TV

Post by zak45 »

dextm80 wrote: Tuesday 24 October 2017 18:35 Hi guys, a guide for linux installation (ubuntu) and domoticz?
if you follow the wiki, you should be able to find enough information to install it.
dextm80
Posts: 117
Joined: Tuesday 24 October 2017 18:32
Target OS: Linux
Domoticz version: 4.10159
Contact:

Re: Python Plugin: Samsung TV

Post by dextm80 »

zak45 wrote: Sunday 29 October 2017 11:49
dextm80 wrote: Tuesday 24 October 2017 18:35 Hi guys, a guide for linux installation (ubuntu) and domoticz?
if you follow the wiki, you should be able to find enough information to install it.
it's very difficullt for me by this wiki, i'm a newbie....can you help me ?
Domoticz on AsRock j3455-ITX 8gb ram - Aeotec ZWave Usb Stick - RFLink 433Mhz
1x Fibaro Wall Plug
1x Fibaro Motion Sensor
x NeoCoolcam Wall Plug
Netatmo Weather Station - Netatmo Thermostat
Philips Hue Bridge
zak45
Posts: 952
Joined: Sunday 22 January 2017 11:37
Target OS: Windows
Domoticz version: V2024.4
Contact:

Re: Python Plugin: Samsung TV

Post by zak45 »

Sorry do not have linux.. but in domoticz wiki & google etc... you should be able to find all necessary.

just to start:
https://www.digitalocean.com/community/ ... untu-16-04
http://www.domoticz.com/wiki/Using_Python_plugins
dextm80
Posts: 117
Joined: Tuesday 24 October 2017 18:32
Target OS: Linux
Domoticz version: 4.10159
Contact:

Re: Python Plugin: Samsung TV

Post by dextm80 »

Can anyone explain step to step how to install this plugin (ubuntu 17.04)?
Thanks
Domoticz on AsRock j3455-ITX 8gb ram - Aeotec ZWave Usb Stick - RFLink 433Mhz
1x Fibaro Wall Plug
1x Fibaro Motion Sensor
x NeoCoolcam Wall Plug
Netatmo Weather Station - Netatmo Thermostat
Philips Hue Bridge
desertdog
Posts: 84
Joined: Sunday 14 August 2016 13:45
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.1
Location: Netherlands
Contact:

Re: Python Plugin: Samsung TV

Post by desertdog »

I hope someone van help me out, since following the wiki and solutions in this thread didn't work for me.

when i run the command: samsungctl -i --host 192.168.1.26 --method websocket, I get:

Code: Select all

Traceback (most recent call last):
  File "/usr/local/bin/samsungctl", line 9, 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
I tried running the command: sudo cp -r /usr/local/lib/python3.4/dist-packages/samsungctl/ /usr/lib/python3.4/, but that doesn't change a thing
I can see I have to versions of Python. /usr/local/lib shows:
drwxrwsr-x 4 root staff 4096 Jul 5 12:49 python2.7
drwxrwsr-x 3 root staff 4096 Aug 2 15:33 python3.4

I really hope someone can help me out to get to the next step of controlling my samsung tv
zak45
Posts: 952
Joined: Sunday 22 January 2017 11:37
Target OS: Windows
Domoticz version: V2024.4
Contact:

Re: Python Plugin: Samsung TV

Post by zak45 »

desertdog wrote: Saturday 18 November 2017 12:05 I can see I have to versions of Python. /usr/local/lib shows:
drwxrwsr-x 4 root staff 4096 Jul 5 12:49 python2.7
drwxrwsr-x 3 root staff 4096 Aug 2 15:33 python3.4
samsungctl require python 3. just try install it using e.g. : sudo pip3 install samsungctl
desertdog
Posts: 84
Joined: Sunday 14 August 2016 13:45
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.1
Location: Netherlands
Contact:

Re: Python Plugin: Samsung TV

Post by desertdog »

When i try to do that I get the message it's already installed:
Requirement already up-to-date: samsungctl in /usr/local/lib/python3.4/dist-packages
zak45
Posts: 952
Joined: Sunday 22 January 2017 11:37
Target OS: Windows
Domoticz version: V2024.4
Contact:

Re: Python Plugin: Samsung TV

Post by zak45 »

if you take a look to your output log :

/usr/local/lib/python2.7/dist-packages/samsungctl/

This look like samsungctl has been installed under 2.7 environnment, uninstall it and install it with pip3.
the same for others modules.
Jostice
Posts: 6
Joined: Monday 20 November 2017 21:24
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Samsung TV

Post by Jostice »

gijsje wrote: 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
Hi, new to this forum. Or at least posting something on it :-)

I have the exact same issue. Everything works through the command line, but in Domoticz it does not work and gives the same errors.
I also have a Samsung KS7000 TV.

Does anyone have the solution?
zak45
Posts: 952
Joined: Sunday 22 January 2017 11:37
Target OS: Windows
Domoticz version: V2024.4
Contact:

Re: Python Plugin: Samsung TV

Post by zak45 »

verify that you have websocket under /usr/lib/python3.5/
if not, copy it could help.
desertdog
Posts: 84
Joined: Sunday 14 August 2016 13:45
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.1
Location: Netherlands
Contact:

Re: Python Plugin: Samsung TV

Post by desertdog »

Ik ben inmiddels weer een paar stappen verder. Het bleek dat in de config file verwezen werd naar de 0.6.0. versie ipv de 0.7.0 versie. Dit heb ik handmatig aangepakt waarna de onderstaande foutmelding is verdwenen

Code: Select all

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__
Echter, als ik het commando 'samsungctl -i --host 192.168.1.26' geef dan krijg ik 'Error: Connection refused'
Bij 'samsungctl -i --host 192.168.1.26 --method websocket' krijg ik: 'Error: Operation now in progress'

Op mijn tv heb ik geen popup gezien of ik toestemming wilde geven en ook in de device lijsten op de tv zie ik niets geblokt. Momenteel is alleen in deze device lijst mijn telefoon verbonden met de televisie.

Model tv wat ik heb is de SAMSUNG UE48J6200
Jostice
Posts: 6
Joined: Monday 20 November 2017 21:24
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Samsung TV

Post by Jostice »

desertdog wrote: Wednesday 22 November 2017 10:32 Ik ben inmiddels weer een paar stappen verder. Het bleek dat in de config file verwezen werd naar de 0.6.0. versie ipv de 0.7.0 versie. Dit heb ik handmatig aangepakt waarna de onderstaande foutmelding is verdwenen

Code: Select all

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__
Echter, als ik het commando 'samsungctl -i --host 192.168.1.26' geef dan krijg ik 'Error: Connection refused'
Bij 'samsungctl -i --host 192.168.1.26 --method websocket' krijg ik: 'Error: Operation now in progress'

Op mijn tv heb ik geen popup gezien of ik toestemming wilde geven en ook in de device lijsten op de tv zie ik niets geblokt. Momenteel is alleen in deze device lijst mijn telefoon verbonden met de televisie.

Model tv wat ik heb is de SAMSUNG UE48J6200
I had the same issue when I upgraded to 0.7.0, could not find out why. So I downgraded to 0.6.0 and could connect through command line. But still nothing through Webinterface. Will double check everything tonight, but I think everything is okay.

Where did you find the config file for redirection of the version number?
Jostice
Posts: 6
Joined: Monday 20 November 2017 21:24
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Samsung TV

Post by Jostice »

zak45 wrote: Tuesday 21 November 2017 23:55 verify that you have websocket under /usr/lib/python3.5/
if not, copy it could help.
I use python3.4 (quote was from another user). But yes, the directories are copied to /usr/lib/python3.4/
samsungctl and websocket both together

Everything works seemles with the command line, but in Domoticz I get these errors when controlling volume for example....
Can anybody help me out or point me in some direction?

Code: Select all

2017-11-22 20:59:06.099 Error: (TV) 'onCommand' failed 'ImportError'.
2017-11-22 20:59:06.099 Error: (TV) ----> Line 170 in /home/pi/domoticz/plugins/SamsungTV/plugin.py, function onCommand
2017-11-22 20:59:06.099 Error: (TV) ----> Line 287 in /home/pi/domoticz/plugins/SamsungTV/plugin.py, function SamsungSend
2017-11-22 20:59:06.099 Error: (TV) ----> Line 10 in /usr/lib/python3.4/samsungctl/remote.py, function __init__
2017-11-22 20:59:06.099 Error: (TV) ----> Line 13 in /usr/lib/python3.4/samsungctl/remote_websocket.py, function __init__
2017-11-22 20:59:06.099 Error: (TV) ----> Line 22 in /usr/lib/python3.4/websocket/__init__.py, function
2017-11-22 20:59:06.099 Error: (TV) ----> Line 26 in /usr/lib/python3.4/websocket/_abnf.py, function

edit: figured it out!
When checking status of websocket-client I saw that six.py is required.
Six was always installed, but in a previous python environment.

Solution: copy six.py to right directory, in my case:

Code: Select all

cp -r /usr/lib/python3/dist-packages/six.py /usr/lib/python3.4
zak45
Posts: 952
Joined: Sunday 22 January 2017 11:37
Target OS: Windows
Domoticz version: V2024.4
Contact:

Re: Python Plugin: Samsung TV

Post by zak45 »

thanks @Jostice that should help others
dextm80
Posts: 117
Joined: Tuesday 24 October 2017 18:32
Target OS: Linux
Domoticz version: 4.10159
Contact:

Re: Python Plugin: Samsung TV

Post by dextm80 »

hi guys,
i am a month tring to install samsungtcl but omg guide is not clear.
i installed samsung tcl

Code: Select all

:-$ samsungctl -version
samsungctl 0.7.0
ok then (by guide)

Code: Select all

sudo cp -r /usr/local/lib/python3.4/dist-packages/samsungctl/ /usr/lib/python3.4/
File or directory not exist
ok i understand that path is 3.5 but 3.5 folder dist-packages is empty (there isn't samsungctl)
look /usr/local/lib/python3.4/dist-packages/samsungctl/ and it's empty.
i don't understand why....

python3 -V give me 3.5.2
Domoticz on AsRock j3455-ITX 8gb ram - Aeotec ZWave Usb Stick - RFLink 433Mhz
1x Fibaro Wall Plug
1x Fibaro Motion Sensor
x NeoCoolcam Wall Plug
Netatmo Weather Station - Netatmo Thermostat
Philips Hue Bridge
zak45
Posts: 952
Joined: Sunday 22 January 2017 11:37
Target OS: Windows
Domoticz version: V2024.4
Contact:

Re: Python Plugin: Samsung TV

Post by zak45 »

@dextm80
there is lots os different configuration possible.
all need to be adapted at your env.

in your case, looks like you have python 3.5, so path should be /usr/lib/python3.5/ (need to be verified)
And as you use linux, probably python 2.7 is also installed and you need to use pip3 instead pip.
dextm80
Posts: 117
Joined: Tuesday 24 October 2017 18:32
Target OS: Linux
Domoticz version: 4.10159
Contact:

Re: Python Plugin: Samsung TV

Post by dextm80 »

zak45 wrote: Monday 27 November 2017 20:07 @dextm80
there is lots os different configuration possible.
all need to be adapted at your env.

in your case, looks like you have python 3.5, so path should be /usr/lib/python3.5/ (need to be verified)
And as you use linux, probably python 2.7 is also installed and you need to use pip3 instead pip.
i've xubuntu 16.04 and i ve py 2.7 and py 3.5 path installed

i use pip3 but nothing change, can you guide me? :)
Domoticz on AsRock j3455-ITX 8gb ram - Aeotec ZWave Usb Stick - RFLink 433Mhz
1x Fibaro Wall Plug
1x Fibaro Motion Sensor
x NeoCoolcam Wall Plug
Netatmo Weather Station - Netatmo Thermostat
Philips Hue Bridge
Jostice
Posts: 6
Joined: Monday 20 November 2017 21:24
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Samsung TV

Post by Jostice »

dextm80 wrote: Tuesday 28 November 2017 16:41
zak45 wrote: Monday 27 November 2017 20:07 @dextm80
there is lots os different configuration possible.
all need to be adapted at your env.

in your case, looks like you have python 3.5, so path should be /usr/lib/python3.5/ (need to be verified)
And as you use linux, probably python 2.7 is also installed and you need to use pip3 instead pip.
i've xubuntu 16.04 and i ve py 2.7 and py 3.5 path installed

i use pip3 but nothing change, can you guide me? :)
Check also the folder site-packages in your python3.5 folder, could be it's installed there...

so something like: /usr/local/lib/python3.5/site-packages/
denman091
Posts: 30
Joined: Monday 31 July 2017 15:22
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8153
Location: Pijnacker
Contact:

Re: Python Plugin: Samsung TV

Post by denman091 »

Jostice wrote: Wednesday 22 November 2017 19:03
desertdog wrote: Wednesday 22 November 2017 10:32 Ik ben inmiddels weer een paar stappen verder. Het bleek dat in de config file verwezen werd naar de 0.6.0. versie ipv de 0.7.0 versie. Dit heb ik handmatig aangepakt waarna de onderstaande foutmelding is verdwenen

Code: Select all

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__
Echter, als ik het commando 'samsungctl -i --host 192.168.1.26' geef dan krijg ik 'Error: Connection refused'
Bij 'samsungctl -i --host 192.168.1.26 --method websocket' krijg ik: 'Error: Operation now in progress'

Op mijn tv heb ik geen popup gezien of ik toestemming wilde geven en ook in de device lijsten op de tv zie ik niets geblokt. Momenteel is alleen in deze device lijst mijn telefoon verbonden met de televisie.

Model tv wat ik heb is de SAMSUNG UE48J6200
I had the same issue when I upgraded to 0.7.0, could not find out why. So I downgraded to 0.6.0 and could connect through command line. But still nothing through Webinterface. Will double check everything tonight, but I think everything is okay.

Where did you find the config file for redirection of the version number?
I have exactly the same problem.
Do you you have it already fixed?
Jostice
Posts: 6
Joined: Monday 20 November 2017 21:24
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Samsung TV

Post by Jostice »

denman091 wrote: Thursday 14 December 2017 22:51
I have exactly the same problem.
Do you you have it already fixed?
Yes, check the forum post right after that one! There is the solution.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest