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.

Moderators: leecollings, remb0

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

Re: Samsung TV control in Domoticz

Post 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
User avatar
jumbotroll
Posts: 793
Joined: Tuesday 13 January 2015 14:36
Target OS: NAS (Synology & others)
Domoticz version: Beta
Location: Oslo,Norway
Contact:

Re: Samsung TV control in Domoticz

Post 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!
Last edited by jumbotroll on Sunday 19 March 2017 0:46, edited 1 time in total.
If you like the work I do for synology and domoticz, I appreciate a donation.
https://paypal.me/Jumbotroll
Regards
Jumbotroll
http://www.jadahl.com
Rodio
Posts: 39
Joined: Thursday 16 April 2015 10:18
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Samsung TV control in Domoticz

Post 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
ptijo
Posts: 4
Joined: Saturday 18 March 2017 11:24
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Samsung TV control in Domoticz

Post 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
tontze
Posts: 317
Joined: Thursday 12 January 2017 15:30
Target OS: Linux
Domoticz version: Beta Ch
Location: Finland
Contact:

Re: Samsung TV control in Domoticz

Post 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
-----------------------------------------
Smartthings
zigbee2mqtt
RFLink 433mhz / Nrf 2.4Ghz
Mi Light
esp8266MiLight Hub
OpenHab/HomeAssistant/Domoticz
HP T610 & Debian 5.10.19-1 x86_64[/b]
Rodio
Posts: 39
Joined: Thursday 16 April 2015 10:18
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Samsung TV control in Domoticz

Post 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
tontze
Posts: 317
Joined: Thursday 12 January 2017 15:30
Target OS: Linux
Domoticz version: Beta Ch
Location: Finland
Contact:

Re: Samsung TV control in Domoticz

Post 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.
-----------------------------------------
Smartthings
zigbee2mqtt
RFLink 433mhz / Nrf 2.4Ghz
Mi Light
esp8266MiLight Hub
OpenHab/HomeAssistant/Domoticz
HP T610 & Debian 5.10.19-1 x86_64[/b]
Rodio
Posts: 39
Joined: Thursday 16 April 2015 10:18
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Samsung TV control in Domoticz

Post 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
User avatar
bueno79
Posts: 83
Joined: Wednesday 08 March 2017 10:26
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.9700
Location: France
Contact:

Re: Samsung TV control in Domoticz

Post 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
stavast
Posts: 3
Joined: Friday 31 March 2017 18:20
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Samsung TV control in Domoticz

Post 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!
User avatar
mlamie
Posts: 122
Joined: Friday 25 October 2013 17:12
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.5877
Location: The Netherlands
Contact:

Re: Samsung TV control in Domoticz

Post 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
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: 423
Joined: Tuesday 09 December 2014 17:04
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: UK - Glos
Contact:

Re: Samsung TV control in Domoticz

Post 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...
Zwave - Sigma Z+ stick, Fibaro, Horstmann, Neo Coolcam, EUROtronic
RFlink - IR detectors and temperatures
Wifi - YeeLights, ESP32s, Anoop sockets
Zigbee - lots with zigbee2mqtt and ZbBridge
stavast
Posts: 3
Joined: Friday 31 March 2017 18:20
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Samsung TV control in Domoticz

Post 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!
stavast
Posts: 3
Joined: Friday 31 March 2017 18:20
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Samsung TV control in Domoticz

Post 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
User avatar
Westcott
Posts: 423
Joined: Tuesday 09 December 2014 17:04
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: UK - Glos
Contact:

Re: Samsung TV control in Domoticz

Post 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.
Zwave - Sigma Z+ stick, Fibaro, Horstmann, Neo Coolcam, EUROtronic
RFlink - IR detectors and temperatures
Wifi - YeeLights, ESP32s, Anoop sockets
Zigbee - lots with zigbee2mqtt and ZbBridge
ptijo
Posts: 4
Joined: Saturday 18 March 2017 11:24
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Samsung TV control in Domoticz

Post 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
User avatar
bueno79
Posts: 83
Joined: Wednesday 08 March 2017 10:26
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.9700
Location: France
Contact:

Re: Samsung TV control in Domoticz

Post 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
woodtrix
Posts: 34
Joined: Saturday 18 February 2017 17:54
Target OS: -
Domoticz version:
Contact:

Re: Samsung TV control in Domoticz

Post 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...
tontze
Posts: 317
Joined: Thursday 12 January 2017 15:30
Target OS: Linux
Domoticz version: Beta Ch
Location: Finland
Contact:

Re: Samsung TV control in Domoticz

Post 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 4018 times
-----------------------------------------
Smartthings
zigbee2mqtt
RFLink 433mhz / Nrf 2.4Ghz
Mi Light
esp8266MiLight Hub
OpenHab/HomeAssistant/Domoticz
HP T610 & Debian 5.10.19-1 x86_64[/b]
User avatar
bueno79
Posts: 83
Joined: Wednesday 08 March 2017 10:26
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.9700
Location: France
Contact:

Re: Samsung TV control in Domoticz

Post 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.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest