Page 2 of 3

Re: Samsung TV control in Domoticz

Posted: Saturday 18 March 2017 23:33
by ptijo
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

Re: Samsung TV control in Domoticz

Posted: Saturday 18 March 2017 23:40
by jumbotroll
@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!

Re: Samsung TV control in Domoticz

Posted: Sunday 19 March 2017 0:38
by Rodio
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:
root@HA:~# 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

Re: Samsung TV control in Domoticz

Posted: Sunday 19 March 2017 9:06
by ptijo
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

Re: Samsung TV control in Domoticz

Posted: Sunday 19 March 2017 12:45
by tontze
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:
root@HA:~# 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

Re: Samsung TV control in Domoticz

Posted: Sunday 19 March 2017 19:11
by Rodio
Hi Tontze,

Thx for the replies.

did the chmod a+x thing

root@HA:/usr/local/iSamsungTV/bin# iSamsungTV
-ash: /bin/iSamsungTV: cannot execute binary file: Exec format error

root@HA:/usr/local/iSamsungTV/bin# iSamsungTV E 192.168.1.36 -KEY KEY_POWERON
-ash: /bin/iSamsungTV: cannot execute binary file: Exec format error

root@HA:/usr/local/iSamsungTV/bin# sudo iSamsungTV
/bin/iSamsungTV: /bin/iSamsungTV: cannot execute binary file

root@HA:/usr/local/iSamsungTV/bin# sudo ./iSamsungTV
./iSamsungTV: ./iSamsungTV: cannot execute binary file

Regards
R

Re: Samsung TV control in Domoticz

Posted: Sunday 19 March 2017 19:16
by tontze
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.

Re: Samsung TV control in Domoticz

Posted: Monday 20 March 2017 11:26
by Rodio
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

Re: Samsung TV control in Domoticz

Posted: Monday 20 March 2017 17:16
by bueno79
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

Re: Samsung TV control in Domoticz

Posted: Friday 31 March 2017 18:40
by stavast
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

pi@domoticz:~ $ sudo apt-get install python3-pip
2. Install SamsungCTL:

Code: Select all

pi@domoticz:~ $ sudo pip3 install samsungctl
3. Install websocket-client (this python module is needed for the 2016+ Samsung models):

Code: Select all

pi@domoticz:~ $ 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

pi@domoticz:~ $ 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

pi@domoticz:~ $ 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!

Re: Samsung TV control in Domoticz

Posted: Friday 31 March 2017 18:49
by mlamie
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

Re: Samsung TV control in Domoticz

Posted: Friday 31 March 2017 19:43
by Westcott
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...

Re: Samsung TV control in Domoticz

Posted: Friday 31 March 2017 19:44
by stavast
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!

Re: Samsung TV control in Domoticz

Posted: Friday 31 March 2017 19:46
by stavast
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

Re: Samsung TV control in Domoticz

Posted: Friday 31 March 2017 21:28
by Westcott
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.

Re: Samsung TV control in Domoticz

Posted: Monday 03 April 2017 19:18
by ptijo
#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

Re: Samsung TV control in Domoticz

Posted: Wednesday 05 April 2017 20:10
by bueno79
@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

Re: Samsung TV control in Domoticz

Posted: Wednesday 05 April 2017 22:26
by woodtrix
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...

Re: Samsung TV control in Domoticz

Posted: Tuesday 18 April 2017 16:40
by tontze
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 4231 times

Re: Samsung TV control in Domoticz

Posted: Tuesday 18 April 2017 22:55
by bueno79
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.