Python Plugin: Samsung TV

Python and python framework

Moderator: leecollings

User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: Python Plugin: Samsung TV

Post 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'.
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
DennisD
Posts: 51
Joined: Friday 18 September 2015 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Samsung TV

Post by DennisD »

Python 3.x is installed?
User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: Python Plugin: Samsung TV

Post 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 4820 times
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
DennisD
Posts: 51
Joined: Friday 18 September 2015 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Samsung TV

Post by DennisD »

Not sure then on the Synology, i'm working with a raspberry pi 3 so slightly different
User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: Python Plugin: Samsung TV

Post by EdwinK »

Thanks anyway.
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
kingoifsnake74
Posts: 14
Joined: Saturday 06 May 2017 11:41
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Python Plugin: Samsung TV

Post 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'
User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: Python Plugin: Samsung TV

Post 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
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
kingoifsnake74
Posts: 14
Joined: Saturday 06 May 2017 11:41
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Python Plugin: Samsung TV

Post 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.
User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: Python Plugin: Samsung TV

Post 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
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
DennisD
Posts: 51
Joined: Friday 18 September 2015 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Samsung TV

Post 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.
bertbigb
Posts: 147
Joined: Thursday 13 August 2015 13:36
Target OS: NAS (Synology & others)
Domoticz version: beta
Location: Netherlands
Contact:

Re: Python Plugin: Samsung TV

Post 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.
Best regards Bert

Synology DS1517+ - DSM 6.2
Raspberry PI2-B, Raspberry Nano - Raspberry PI3 - model B
Xiaomi Gateway - Philips HUE Lights - Zwave - RFXCom(E) with KaKu and other 433MHz devices - Yeelight Lights - Toon
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 »

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 !
bertbigb
Posts: 147
Joined: Thursday 13 August 2015 13:36
Target OS: NAS (Synology & others)
Domoticz version: beta
Location: Netherlands
Contact:

Re: Python Plugin: Samsung TV

Post 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.
Best regards Bert

Synology DS1517+ - DSM 6.2
Raspberry PI2-B, Raspberry Nano - Raspberry PI3 - model B
Xiaomi Gateway - Philips HUE Lights - Zwave - RFXCom(E) with KaKu and other 433MHz devices - Yeelight Lights - Toon
Drikus
Posts: 2
Joined: Tuesday 06 June 2017 8:32
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Python Plugin: Samsung TV

Post 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')
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 »

@Drikus
thanks for this TIP.

if someone else using Synology can confirm.. then will add that to the wiki.
kingoifsnake74
Posts: 14
Joined: Saturday 06 May 2017 11:41
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Python Plugin: Samsung TV

Post by kingoifsnake74 »

Sorry can't confirm stopped with synology, rpi now....
pablolassalle
Posts: 1
Joined: Tuesday 08 August 2017 0:38
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Samsung TV

Post 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
User avatar
gijsje
Posts: 132
Joined: Saturday 19 August 2017 14:28
Target OS: NAS (Synology & others)
Domoticz version: Stable
Location: Berkel Enschot, NL
Contact:

Re: Python Plugin: Samsung TV

Post by gijsje »

Did you find a solution for this?
I do have the same problem
Synology DS218+ - RFXtrx433 - Aeotec Z-Stick Gen5 - Toon Thermostat - Neo CoolCam plug - Neo CoolCam PIR - FIBARO PIR - Heiman Smart Smoke Senso - Neo CoolCam Leakage Detector - BeNext Tag Reader - P1 and S0 USB - many Mi-Light lights - KAKU switches
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 »

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
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 »

v2 released. Now with Kodi like remote feature.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest