Page 2 of 9

Re: Python Plugin: Samsung TV

Posted: Sunday 14 May 2017 17:28
by EdwinK
Thanks. Going to try this.

Code: Select all

root@DiskStation:/volume3/@appstore/domoticz/var/scripts/python# pip3 intall samsungctl
-ash: pip3: command not found
Before that I already did a 'sudo -i' (something that Synology wants instead of just plain sudo'.

Re: Python Plugin: Samsung TV

Posted: Sunday 14 May 2017 17:35
by DennisD
Python 3.x is installed?

Re: Python Plugin: Samsung TV

Posted: Sunday 14 May 2017 17:42
by EdwinK
DennisD wrote:Python 3.x is installed?
I thought I had. But now it says 2.7.12

But on the Synology paackage screen I get this
Python versions installed
Python versions installed
Screen Shot 2017-05-14 at 17.45.20.png (41.87 KiB) Viewed 4824 times

Re: Python Plugin: Samsung TV

Posted: Sunday 14 May 2017 17:55
by DennisD
Not sure then on the Synology, i'm working with a raspberry pi 3 so slightly different

Re: Python Plugin: Samsung TV

Posted: Sunday 14 May 2017 18:41
by EdwinK
Thanks anyway.

Re: Python Plugin: Samsung TV

Posted: Sunday 14 May 2017 19:37
by kingoifsnake74
Anyone? synology python is driving me nuts. 017-05-14 19:32:48.485 Error: (SamsungTV) failed to load 'plugin.py', Python Path used was '/usr/local/domoticz/var/plugins/samsungctl/:/volume1/@appstore/py3k/usr/local/lib/python35.zip:/volume1/@appstore/py3k/usr/local/lib/python3.5/:/volume1/@appstore/py3k/usr/local/lib/python3.5/plat-linux:/volume1/@appstore/py3k/usr/local/lib/python3.5/lib-dynload'.

2017-05-14 19:32:48.485 Error: (samsung tv) Module Import failed, exception: 'ImportError'

2017-05-14 19:32:48.485 Error: (samsung tv) Module Import failed: ' Name: samsungctl'

Re: Python Plugin: Samsung TV

Posted: Sunday 14 May 2017 20:09
by EdwinK
kingoifsnake74 wrote:Anyone? synology python is driving me nuts. 017-05-14 19:32:48.485 Error: (SamsungTV) failed to load 'plugin.py', Python Path used was '/usr/local/domoticz/var/plugins/samsungctl/:/volume1/@appstore/py3k/usr/local/lib/python35.zip:/volume1/@appstore/py3k/usr/local/lib/python3.5/:/volume1/@appstore/py3k/usr/local/lib/python3.5/plat-linux:/volume1/@appstore/py3k/usr/local/lib/python3.5/lib-dynload'.

2017-05-14 19:32:48.485 Error: (samsung tv) Module Import failed, exception: 'ImportError'

2017-05-14 19:32:48.485 Error: (samsung tv) Module Import failed: ' Name: samsungctl'

Got the same settings (minus the python35.zip). Still driving me nuts too. As you see a few posts up, having problems with the 'test' phase. i do have various Python packages, but still it failed. With python --version I get Python 2.7.12 Why has Synology have to make it so difficult to instal this

Re: Python Plugin: Samsung TV

Posted: Monday 15 May 2017 23:39
by kingoifsnake74
I completely reinstalled everything in my synology. Firtst the python 3.5 module then domoticz. Pip etc. At the end still the same problems. Synology and python is a no go for me. Perhaps i will install domoticz on a rpi this weekeind thanx dor the tips btw.

Re: Python Plugin: Samsung TV

Posted: Tuesday 16 May 2017 10:49
by EdwinK
kingoifsnake74 wrote:I completely reinstalled everything in my synology. Firtst the python 3.5 module then domoticz. Pip etc. At the end still the same problems. Synology and python is a no go for me. Perhaps i will install domoticz on a rpi this weekeind thanx dor the tips btw.

Just my idea. Now... where did I put that spare RPi

Re: Python Plugin: Samsung TV

Posted: Tuesday 16 May 2017 11:41
by DennisD
Keep in mind that the samsungctl doens't work on all types of samsung smart tv's. Mine is a ue55JU7000 and although the plugin, receives the on/off status, i cannot control my tv with it.

Re: Python Plugin: Samsung TV

Posted: Monday 22 May 2017 19:29
by bertbigb
Hello,

I have a nice Samsung TV and want to control it from Domoticz.
I followed the wiki and have the following problems at this moment:

Code: Select all

bert@DS1515:~$ samsungctl -i --host 192.168.2.15 --method websocket
Traceback (most recent call last):
  File "/bin/samsungctl", line 11, in <module>
    sys.exit(main())
  File "/usr/lib/python2.7/site-packages/samsungctl/__main__.py", line 93, in main
    config = _read_config()
  File "/usr/lib/python2.7/site-packages/samsungctl/__main__.py", line 37, in _read_config
    except FileNotFoundError:
NameError: global name 'FileNotFoundError' is not defined
Anyone an idea what I can / have to do to get this solved? Help is appreciated.

Re: Python Plugin: Samsung TV

Posted: Monday 22 May 2017 23:08
by zak45
bertbigb wrote:Hello,

I have a nice Samsung TV and want to control it from Domoticz.
I followed the wiki and have the following problems at this moment:

Code: Select all

bert@DS1515:~$ samsungctl -i --host 192.168.2.15 --method websocket
Traceback (most recent call last):
  File "/bin/samsungctl", line 11, in <module>
    sys.exit(main())
  File "/usr/lib/python2.7/site-packages/samsungctl/__main__.py", line 93, in main
    config = _read_config()
  File "/usr/lib/python2.7/site-packages/samsungctl/__main__.py", line 37, in _read_config
    except FileNotFoundError:
NameError: global name 'FileNotFoundError' is not defined
Anyone an idea what I can / have to do to get this solved? Help is appreciated.
/usr/lib/python2.7/site-packages/samsungctl/ --> this show that you have installed on python version 2.7

Plugin system need python 3.x !

Re: Python Plugin: Samsung TV

Posted: Tuesday 23 May 2017 7:22
by bertbigb
zak45 wrote: /usr/lib/python2.7/site-packages/samsungctl/ --> this show that you have installed on python version 2.7

Plugin system need python 3.x !
Hi Zak,
Thanks for your answer. I have a synology and on that one python 2.7 and 3.5 is installed.
Ok, now i know this is the trouble I'm going to switch over too another forum (Synology) to ask there how I can achieve that Synology will run with Python 3.5.

Re: Python Plugin: Samsung TV

Posted: Tuesday 06 June 2017 8:46
by Drikus
kingoifsnake74 wrote:Anyone? synology python is driving me nuts. 017-05-14 19:32:48.485 Error: (SamsungTV) failed to load 'plugin.py', Python Path used was '/usr/local/domoticz/var/plugins/samsungctl/:/volume1/@appstore/py3k/usr/local/lib/python35.zip:/volume1/@appstore/py3k/usr/local/lib/python3.5/:/volume1/@appstore/py3k/usr/local/lib/python3.5/plat-linux:/volume1/@appstore/py3k/usr/local/lib/python3.5/lib-dynload'.

2017-05-14 19:32:48.485 Error: (samsung tv) Module Import failed, exception: 'ImportError'

2017-05-14 19:32:48.485 Error: (samsung tv) Module Import failed: ' Name: samsungctl'
Got it work on my Synology. Originally I got the same error, then I had a quick look in the plugin.py:

Code: Select all

if sys.platform.startswith('linux'):
    # linux specific code here
    sys.path.append(os.path.dirname(os.__file__) + '/diste-packages')
change this to:

Code: Select all

if sys.platform.startswith('linux'):
    # linux specific code here
    sys.path.append(os.path.dirname(os.__file__) + '/site-packages')

Re: Python Plugin: Samsung TV

Posted: Tuesday 06 June 2017 12:27
by zak45
@Drikus
thanks for this TIP.

if someone else using Synology can confirm.. then will add that to the wiki.

Re: Python Plugin: Samsung TV

Posted: Saturday 17 June 2017 20:30
by kingoifsnake74
Sorry can't confirm stopped with synology, rpi now....

Re: Python Plugin: Samsung TV

Posted: Tuesday 08 August 2017 0:51
by pablolassalle
Zak, I could not get the interactive control from the command line to work.
I have a Samsung J model from 2016, and I use this command line to test it:

Code: Select all

sudo samsungctl -i --host 192.168.0.8 --port 8001 --method websocket
but when i use any key, the TV does not respond to any of them.

Do you know what can be the issue?

This is the log from the plugin
2017-08-07 19:44:39.448 User: Admin initiated a switch command (41/Samsung TV - Volume/Set Level)
2017-08-07 19:44:39.456 (Samsung TV) Calling message handler 'onCommand'.
2017-08-07 19:44:39.457 (Samsung TV) onCommand called for Unit 3: Parameter 'Off', Level: 0, Connected: True
2017-08-07 19:44:39.460 Error: (Samsung TV) 'onCommand' failed 'ImportError'.
2017-08-07 19:44:39.460 Error: (Samsung TV) ----> Line 177 in /home/pi/domoticz/plugins/SamsungTV/plugin.py, function onCommand
2017-08-07 19:44:39.460 Error: (Samsung TV) ----> Line 287 in /home/pi/domoticz/plugins/SamsungTV/plugin.py, function SamsungSend
2017-08-07 19:44:39.460 Error: (Samsung TV) ----> Line 10 in /usr/lib/python3.4/samsungctl/remote.py, function __init__
2017-08-07 19:44:39.460 Error: (Samsung TV) ----> Line 13 in /usr/lib/python3.4/samsungctl/remote_websocket.py, function __init__
2017-08-07 19:44:39.511 (Samsung TV) Calling message handler 'onHeartbeat'.
2017-08-07 19:44:39.514 (Samsung TV) isAlive status :True
If someone has an idea of what can be happening, I'll be glad to hear from you.

Thanks

Re: Python Plugin: Samsung TV

Posted: Monday 21 August 2017 22:53
by gijsje
Did you find a solution for this?
I do have the same problem

Re: Python Plugin: Samsung TV

Posted: Tuesday 22 August 2017 17:22
by zak45
pablolassalle wrote: Tuesday 08 August 2017 0:51 Zak, I could not get the interactive control from the command line to work.
I have a Samsung J model from 2016, and I use this command line to test it:

Code: Select all

sudo samsungctl -i --host 192.168.0.8 --port 8001 --method websocket
but when i use any key, the TV does not respond to any of them.
maybe similar:
https://github.com/Ape/samsungctl/issues/22

Re: Python Plugin: Samsung TV

Posted: Tuesday 29 August 2017 20:07
by zak45
v2 released. Now with Kodi like remote feature.