Samsung TV control in Domoticz

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.
ptijo
Posts: 4
Joined: Saturday 18 March 2017 12:24
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Samsung TV control in Domoticz

Post by ptijo » Sunday 19 March 2017 0:33

Hi,
i have try :
/usr/local/iSamsungTV/bin$ ./iSamsungTV C 192.168.1.10 -KEY KEY_MUTE
-sh: ./iSamsungTV: cannot execute binary file: Exec format error
and with root

/usr/local/iSamsungTV/bin$ ./iSamsungTV C 192.168.1.10 -KEY KEY_MUTE
-ash: /usr/local/iSamsungTV/bin$: No such file or directory

User avatar
jumbotroll
Posts: 492
Joined: Tuesday 13 January 2015 15:36
Target OS: NAS (Synology & others)
Domoticz version: Beta
Location: Oslo,Norway
Contact:

Re: Samsung TV control in Domoticz

Post by jumbotroll » Sunday 19 March 2017 0:40

@ptijo
I am using this without any problem, on DS712+, but maybe my build not working on your NAS.
If my packages not work I'm going to delete them from my server.
Edit: packages deleted!
Last edited by jumbotroll on Sunday 19 March 2017 1:46, edited 1 time in total.
Regards
Jumbotroll
http://www.jadahl.com

Rodio
Posts: 26
Joined: Thursday 16 April 2015 10:18
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Samsung TV control in Domoticz

Post by Rodio » Sunday 19 March 2017 1:38

tontze wrote:
Correct sudo usage :

Code: Select all

sudo /usr/local/iSamsungTV/bin/iSamsungTV E 192.168.1.36 -KEY KEY_POWEROFF
Still the same error:
[email protected]:~# sudo /usr/local/iSamsungTV/bin/iSamsungTV E 192.168.1.36 -KEY KEY_POWEROFF
/usr/local/iSamsungTV/bin/iSamsungTV: /usr/local/iSamsungTV/bin/iSamsungTV: cannot execute binary file

I tried:
Delete and reinstall package.
Install it on my 916 (running latest stable version)
Install it on my 916 running Domoticz V3.6749
Tried the C, D, F TV setting.
All give the same error

ptijo
Posts: 4
Joined: Saturday 18 March 2017 12:24
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Samsung TV control in Domoticz

Post by ptijo » Sunday 19 March 2017 10:06

jumbotroll wrote:@ptijo
I am using this without any problem, on DS712+, but maybe my build not working on your NAS.
If my packages not work I'm going to delete them from my server.
Edit: packages deleted!
I see that there are lot of issue with version of NAS
uname r :2.6.32.12
'm sorry, but I'm resigning myself.
thanks
Regards

tontze
Posts: 227
Joined: Thursday 12 January 2017 16:30
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Samsung TV control in Domoticz

Post by tontze » Sunday 19 March 2017 13:45

Rodio wrote:
tontze wrote:
Correct sudo usage :

Code: Select all

sudo /usr/local/iSamsungTV/bin/iSamsungTV E 192.168.1.36 -KEY KEY_POWEROFF
Still the same error:
[email protected]:~# sudo /usr/local/iSamsungTV/bin/iSamsungTV E 192.168.1.36 -KEY KEY_POWEROFF
/usr/local/iSamsungTV/bin/iSamsungTV: /usr/local/iSamsungTV/bin/iSamsungTV: cannot execute binary file

I tried:
Delete and reinstall package.
Install it on my 916 (running latest stable version)
Install it on my 916 running Domoticz V3.6749
Tried the C, D, F TV setting.
All give the same error
Not the same error, last time it didnt find sudo since wrong path was provided to it. go to

Code: Select all

/usr/local/iSamsungTV/bin/
and try

Code: Select all

./iSamsungTV
or

Code: Select all

sudo ./iSamsungTV
If it cannot be xecuted, you have wrong architecture for the binary or perhaps permission problem ? You can try giving more execution permissions

Code: Select all

chmod a+x /usr/local/iSamsungTV/bin/iSamsungTV
-----------------------------------------
Rpi 3 / Razberry 2
RFLink 433mhz / Nrf 2.4Ghz
Mi Light
ESP82xx

Rodio
Posts: 26
Joined: Thursday 16 April 2015 10:18
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Samsung TV control in Domoticz

Post by Rodio » Sunday 19 March 2017 20:11

Hi Tontze,

Thx for the replies.

did the chmod a+x thing

[email protected]:/usr/local/iSamsungTV/bin# iSamsungTV
-ash: /bin/iSamsungTV: cannot execute binary file: Exec format error

[email protected]:/usr/local/iSamsungTV/bin# iSamsungTV E 192.168.1.36 -KEY KEY_POWERON
-ash: /bin/iSamsungTV: cannot execute binary file: Exec format error

[email protected]:/usr/local/iSamsungTV/bin# sudo iSamsungTV
/bin/iSamsungTV: /bin/iSamsungTV: cannot execute binary file

[email protected]:/usr/local/iSamsungTV/bin# sudo ./iSamsungTV
./iSamsungTV: ./iSamsungTV: cannot execute binary file

Regards
R

tontze
Posts: 227
Joined: Thursday 12 January 2017 16:30
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Samsung TV control in Domoticz

Post by tontze » Sunday 19 March 2017 20:16

Check that your binary file matches with your systems architecture, is it ARM and your system is X86 or vice versa :) Or is it 32bit program and your system is 64bit, or vice versa.
-----------------------------------------
Rpi 3 / Razberry 2
RFLink 433mhz / Nrf 2.4Ghz
Mi Light
ESP82xx

Rodio
Posts: 26
Joined: Thursday 16 April 2015 10:18
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Samsung TV control in Domoticz

Post by Rodio » Monday 20 March 2017 12:26

Hi,

No idea how to check for which architecture the binary file is.
I've downloaded it form the site of Jumbotroll, but he's deleted them (they're not there anymore).

I'm gonna stop for now with this 'project'.

Thx for the help Tontze, really appreciate it :D

User avatar
bueno79
Posts: 44
Joined: Wednesday 08 March 2017 11:26
Target OS: Raspberry Pi
Domoticz version: 3.5877
Location: France
Contact:

Re: Samsung TV control in Domoticz

Post by bueno79 » Monday 20 March 2017 18:16

Hi,

your problem is : this file is NOT compile for your architecture. type :

file iSamsungTV

you will see the infos (you need file command of course). So I get the same issue and fix it with a 214play.

- I install a linux ubuntuu.
- I install the CORRECT tool chain from here on the ubuntuu (https://sourceforge.net/projects/dsgpl/ ... edomCookie)
- I set some variables to compile on th ubuntuu (lines below are not for 214play, just example)

Code: Select all

export CFLAGS="-I/usr/local/arm-none-linux-gnueabi/include"
export LDFLAGS="-L/usr/local/arm-none-linux-gnueabi/lib"
export RANLIB=/usr/local/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-ranlib
export LD=/usr/local/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-ld
export CC=/usr/local/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-gcc
export LD_LIBRARY_PATH=/usr/local/arm-none-linux-gnueabi/lib
export ARCH=arm
- then compile the samsungTV code (I clone the project on the ubuntuu with git first) with the gcc (the path is in the variable CC you set before)
- move my new iSAmsungTV on my NAS

it woooorks !!!

:)

you can find all info in french here : http://benjamin-balet.info/multimedia/s ... -synology/
you can fin d info on google with "cross compilation synology"

regards
Bueno

stavast
Posts: 3
Joined: Friday 31 March 2017 18:20
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Samsung TV control in Domoticz

Post by stavast » Friday 31 March 2017 18:40

perwei wrote:Just a comment regarding newer Samsung TVs like model K. Seems iSamsungTV isn't working on those models.
On the other hand, Wake-on-LAN does work and brings the TV from sleeping and un-pingable to live and pingable.

Cheers,
Per
As a proud owner of a Samsung Series K I really wanted to integrate remote control into Domoticz and i finally found a way!

SamsungCTL makes it possible to control the Samsung Series K (and probably all the other series as well). At this moment i can control the TV via the command interface, so we are only a small step away from the full integration which will allow us to control the TV via Domoticz.

Installation
1. Install python3-pip:

Code: Select all

[email protected]:~ $ sudo apt-get install python3-pip
2. Install SamsungCTL:

Code: Select all

[email protected]:~ $ sudo pip3 install samsungctl
3. Install websocket-client (this python module is needed for the 2016+ Samsung models):

Code: Select all

[email protected]:~ $ sudo pip3 install websocket-client   
4. Make sure your TV is on, run the following command from the cli (Change xxx.xxx.xxx.xxx with the IP address of your TV):

Code: Select all

[email protected]:~ $ samsungctl --host xxx.xxx.xxx.xxx --method websocket KEY_MUTE  
5. Depending on the setting of your TV, the TV will ask you if you want to allow the external control from the device from which you just send the mute key

6. Allow the external control with your TV Remote and voila! remote control should be working now and the volume of your TV should be muted.

Extra information:
1. To unmute your tv use

Code: Select all

[email protected]:~ $ samsungctl --host xxx.xxx.xxx.xxx --method websocket KEY_VOLUP  
KEY_UNMUTE would be the logical unmute option, but I didn't see that in the key list ;)

2. The extra option

Code: Select all

--method websocket
should only be needed for the 2016+ models.

Links
SamsungCTL GitHub: https://github.com/Ape/samsungctl
Key Codes: https://github.com/Ape/samsungctl#key-codes

Good luck!

User avatar
mlamie
Posts: 147
Joined: Friday 25 October 2013 17:12
Target OS: Raspberry Pi
Domoticz version: 3.5877
Location: The Netherlands
Contact:

Re: Samsung TV control in Domoticz

Post by mlamie » Friday 31 March 2017 18:49

stavast wrote: Good luck!
I have seen there is a new Samsung TV page in the Domoticz wiki based on samsungctl. You can try that as well I expect.
https://www.domoticz.com/wiki/Plugins/SamsungTV.html
Raspberry Pi 3, RaZberry, RFXtrx433
Various Z-Wave devices, KlikAanKlikUit devices, ESP8266 NodeMCU, Sonoff POW and a Essent E-thermostaat
IP camera: Dahua 4MP IPC-HDBW4421R-AS, Vivotek FD8134V

User avatar
Westcott
Posts: 522
Joined: Tuesday 09 December 2014 18:04
Target OS: Raspberry Pi
Domoticz version: Beta
Location: UK - Glos
Contact:

Re: Samsung TV control in Domoticz

Post by Westcott » Friday 31 March 2017 19:43

When I try it from the command line, I get -

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

My guess is that the config file is missing...
Zwave - Sigma Z+ stick, Fibaro 2x FGSD002, FGMS001, Horstmann - 2x HRT4, 2x C-stat-11,
4x ASR-ZW, Aeon Micro Switch, 2x TKB TZ68E
Max-EQ Cube, Valve
RFXtrx433E, RFlink - 1byone driveway, doorbell, Oregon and BangGood temp
Wifi - YeeLight RGB, 3x ESP8266

stavast
Posts: 3
Joined: Friday 31 March 2017 18:20
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Samsung TV control in Domoticz

Post by stavast » Friday 31 March 2017 19:44

mlamie wrote:
stavast wrote: Good luck!
I have seen there is a new Samsung TV page in the Domoticz wiki based on samsungctl. You can try that as well I expect.
https://www.domoticz.com/wiki/Plugins/SamsungTV.html
O Wow, I have been searching for two weeks! what a coincidence and a luck. Thank god the plugin is from the 27th of March, I was very sure I search in every corner of the Domoticz forum and wiki. I felt a bit of a fool for missing such a big elephant :lol: Thanks for mentioning it mlamie!

stavast
Posts: 3
Joined: Friday 31 March 2017 18:20
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Samsung TV control in Domoticz

Post by stavast » Friday 31 March 2017 19:46

Westcott wrote:When I try it from the command line, I get -

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

My guess is that the config file is missing...
You need to have Python Version 3 to be able to run samsungctl. based upon this "File "/usr/local/lib/python2.7/" i get the feeling you installed it under Python Version 2 with the use of pip instead of pip3

User avatar
Westcott
Posts: 522
Joined: Tuesday 09 December 2014 18:04
Target OS: Raspberry Pi
Domoticz version: Beta
Location: UK - Glos
Contact:

Re: Samsung TV control in Domoticz

Post by Westcott » Friday 31 March 2017 21:28

Thanks, Stavast!
The Wiki needs to be updated with some 3's.
I REALLY don't like version-specific installs.
Now I'm getting the dreaded -

/usr/local/bin/python3.5: error while loading shared libraries: libpython3.5.so.1.0: cannot open shared object file: No such file or directory

Python3 runs OK -
Python3 -i
Python 3.5.2 (default, Dec 14 2016, 15:53:15)

echo $LD_LIBRARY_PATH
/usr/local/lib

And libpython3.5.so.1.0 is in /usr/local/lib

Haven't been able to Google a solution yet.
Zwave - Sigma Z+ stick, Fibaro 2x FGSD002, FGMS001, Horstmann - 2x HRT4, 2x C-stat-11,
4x ASR-ZW, Aeon Micro Switch, 2x TKB TZ68E
Max-EQ Cube, Valve
RFXtrx433E, RFlink - 1byone driveway, doorbell, Oregon and BangGood temp
Wifi - YeeLight RGB, 3x ESP8266

ptijo
Posts: 4
Joined: Saturday 18 March 2017 12:24
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Samsung TV control in Domoticz

Post by ptijo » Monday 03 April 2017 19:18

#bueno79

Could you give me the gcc command
i try but i have the same error (format exec error)
bueno79 wrote:Hi,

your problem is : this file is NOT compile for your architecture. type :

file iSamsungTV

you will see the infos (you need file command of course). So I get the same issue and fix it with a 214play.

- I install a linux ubuntuu.
- I install the CORRECT tool chain from here on the ubuntuu (https://sourceforge.net/projects/dsgpl/ ... edomCookie)
- I set some variables to compile on th ubuntuu (lines below are not for 214play, just example)

Code: Select all

export CFLAGS="-I/usr/local/arm-none-linux-gnueabi/include"
export LDFLAGS="-L/usr/local/arm-none-linux-gnueabi/lib"
export RANLIB=/usr/local/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-ranlib
export LD=/usr/local/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-ld
export CC=/usr/local/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-gcc
export LD_LIBRARY_PATH=/usr/local/arm-none-linux-gnueabi/lib
export ARCH=arm
- then compile the samsungTV code (I clone the project on the ubuntuu with git first) with the gcc (the path is in the variable CC you set before)
- move my new iSAmsungTV on my NAS

it woooorks !!!

:)

you can find all info in french here : http://benjamin-balet.info/multimedia/s ... -synology/
you can fin d info on google with "cross compilation synology"

regards
Bueno

User avatar
bueno79
Posts: 44
Joined: Wednesday 08 March 2017 11:26
Target OS: Raspberry Pi
Domoticz version: 3.5877
Location: France
Contact:

Re: Samsung TV control in Domoticz

Post by bueno79 » Wednesday 05 April 2017 20:10

@ptijo

just imagine your processor is an arm. you get the tool chain and your path is the default one. And you have the source from iSamnsungTV in your home. So you should type something like this :

/usr/local/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-gcc /home/bueno/iSamsungTV/iSamsungTV.c

woodtrix
Posts: 24
Joined: Saturday 18 February 2017 18:54
Target OS: -
Domoticz version:
Contact:

Re: Samsung TV control in Domoticz

Post by woodtrix » Wednesday 05 April 2017 22:26

If you have a precompiled binary of iSamsungTV, other then osx or raspberry pi, post a link, I will add them to the github page...

tontze
Posts: 227
Joined: Thursday 12 January 2017 16:30
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Samsung TV control in Domoticz

Post by tontze » Tuesday 18 April 2017 16:40

Finally made a button to control my TV in domoticz, but seems its not working well ..

Code: Select all

2017-04-18 17:31:47.268 Error: Error executing script command (/usr/local/bin/iSamsungTV). returned: 512
This is what im getting to log in domoticz, from command line its working well .. ?
Sieppaa.PNG
Sieppaa.PNG (171.88 KiB) Viewed 507 times
-----------------------------------------
Rpi 3 / Razberry 2
RFLink 433mhz / Nrf 2.4Ghz
Mi Light
ESP82xx

User avatar
bueno79
Posts: 44
Joined: Wednesday 08 March 2017 11:26
Target OS: Raspberry Pi
Domoticz version: 3.5877
Location: France
Contact:

Re: Samsung TV control in Domoticz

Post by bueno79 » Tuesday 18 April 2017 22:55

woodtrix wrote:If you have a precompiled binary of iSamsungTV, other then osx or raspberry pi, post a link, I will add them to the github page...
ok I will extract my version.

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests