Page 2 of 4

Re: Samsung Smart TV (on or off)

Posted: Wednesday 08 July 2015 10:04
by pj-r
Far as I know in the older models the network chip is unpowered while in standby so it cannot be turned on from network.

Has anyone used(or tried to use) HDMI-CEC to turn on samsung tv? I'm wondering if should I use IR-blaster or HDMI-CEC for that task.

Re: Samsung Smart TV (on or off)

Posted: Wednesday 08 July 2015 11:01
by Hesmink
pj-r wrote:Far as I know in the older models the network chip is unpowered while in standby so it cannot be turned on from network.

Has anyone used(or tried to use) HDMI-CEC to turn on samsung tv? I'm wondering if should I use IR-blaster or HDMI-CEC for that task.
I can confirm you cannot turn on a Samsung TV via network.
I don't know about your other solutions, I haven't tried.

Re: Samsung Smart TV (on or off)

Posted: Thursday 09 July 2015 15:07
by kurniawan77
Hesmink wrote:
proohu01 wrote:What is the exact line you entered in the 'off action' field?
And can you share you script?
The off action is:
script://domoticz/scripts/samsung_tv_off.py

The script is a slightly modified version of something I found on the internet:

Code: Select all

#!  /usr/bin/python
#   Title: samsungremote.py
#   Author: Asif Iqbal
#   Date: 05APR2012
#   Info: To send remote control commands to the Samsung tv over LAN
#   TODO:

import socket
import base64
import time, datetime

#
# Variables
#
#IP Address of TV
tvip = "192.168.178.16"
#IP Address of TV
myip = "192.168.178.14"
#Used for the access control/validation, but not after that AFAIK
mymac = "b8-27-eb-f1-5a-f3"
#Might need changing to match your TV type
tvappstring = "iphone.UE46ES8000.iapp.samsung"
#What gets reported when it asks for permission
remotename = "Domoticz Samsung Remote"

#What the iPhone app reports (don't change this)
appstring = "iphone..iapp.samsung"

# Function to send keys
def sendKey(skey, dataSock, appstring):
 messagepart3 = chr(0x00) + chr(0x00) + chr(0x00) + chr(len(
base64.b64encode(skey))) + chr(0x00) + base64.b64encode(skey);
 part3 = chr(0x00) + chr(len(appstring)) + chr(0x00) \
+ appstring + chr(len(messagepart3)) + chr(0x00) + messagepart3
 dataSock.send(part3);

# Open Socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((tvip, 55000))

# First configure the connection
ipencoded = base64.b64encode(myip)
macencoded = base64.b64encode(mymac)
messagepart1 = chr(0x64) + chr(0x00) + chr(len(ipencoded)) \
+ chr(0x00) + ipencoded + chr(len(macencoded)) + chr(0x00) \
+ macencoded + chr(len(base64.b64encode(remotename))) + chr(0x00) \
+ base64.b64encode(remotename)

part1 = chr(0x00) + chr(len(appstring)) + chr(0x00) + appstring \
+ chr(len(messagepart1)) + chr(0x00) + messagepart1
sock.send(part1)

messagepart2 = chr(0xc8) + chr(0x00)
part2 = chr(0x00) + chr(len(appstring)) + chr(0x00) + appstring \
+ chr(len(messagepart2)) + chr(0x00) + messagepart2
sock.send(part2)

# Now send the keys as you like, e.g.,
sendKey("KEY_TVPOWEROFF",sock,tvappstring)

# Close the socket when done
sock.close()
Works!!!

I had to change KEY_TVPOWEROFF to KEY_POWEROFFImage

Re: Samsung Smart TV (on or off)

Posted: Friday 10 July 2015 8:45
by pj-r
There is also a command line client if someone would like to use it:
http://forum.samygo.tv/viewtopic.php?t=5794#p41376

I have it and it works nicely.

Re: Samsung Smart TV (on or off)

Posted: Friday 10 July 2015 22:26
by d4nh
kurniawan77 wrote:
Works!!!

I had to change KEY_TVPOWEROFF to KEY_POWEROFFImage
indeed, nice find, had to change it as well. i dont think my presence detection is working very well, it turns off my tv everytime xD

Re: Samsung Smart TV (on or off)

Posted: Tuesday 14 July 2015 12:01
by brian
pj-r wrote: Has anyone used(or tried to use) HDMI-CEC to turn on samsung tv? I'm wondering if should I use IR-blaster or HDMI-CEC for that task.
i'm using an RPi2 turned on via an SNMP script (PoE switch + TP-Link PoE splitter), CEC commands works flawlessly

Re: Samsung Smart TV (on or off)

Posted: Tuesday 28 July 2015 9:09
by treb0r
Hesmink wrote:

Second, use the python script in this topic (samsungremote.py), and substitute your tv IP address in the script.

Then, use the script as 'off' action for your TV switch:
script:///home/pi/domoticz/scripts/samsung_tv_off.py
I have a quetion to this part of the script

Code: Select all

#IP Address of TV
tvip = "192.168.178.16"
#IP Address of TV
myip = "192.168.178.14"
#Used for the access control/validation, but not after that AFAIK
mymac = "b8-27-eb-f1-5a-f3"
tvip: TV IP abviouse ;)
myip: IP of domoticz server?
mymac: MAC of domoticz server?
thanks
treb0r

Re: Samsung Smart TV (on or off)

Posted: Tuesday 28 July 2015 9:55
by Hesmink
treb0r wrote:
Hesmink wrote:

Second, use the python script in this topic (samsungremote.py), and substitute your tv IP address in the script.

Then, use the script as 'off' action for your TV switch:
script:///home/pi/domoticz/scripts/samsung_tv_off.py
I have a quetion to this part of the script

Code: Select all

#IP Address of TV
tvip = "192.168.178.16"
#IP Address of TV
myip = "192.168.178.14"
#Used for the access control/validation, but not after that AFAIK
mymac = "b8-27-eb-f1-5a-f3"
tvip: TV IP abviouse ;)
myip: IP of domoticz server?
mymac: MAC of domoticz server?
thanks
treb0r
Yes, that is correct.

Re: Samsung Smart TV (on or off)

Posted: Tuesday 10 November 2015 21:00
by thecosmicgate
Is there anybody who got this working on a Samsung UE65HU7500 ?

I tried this pyhton scipt but getting : returned: 32512 everytime

Re: Samsung Smart TV (on or off)

Posted: Friday 04 December 2015 23:08
by thecosmicgate
Is there nobody who also try to run this on the hu7500 series ?

Sent from my MotoG3 using Tapatalk

Re: Samsung Smart TV (on or off)

Posted: Monday 14 December 2015 22:35
by thecosmicgate
Still nobody ?
It would be very handy , but if it isn't possible then I had to think about something else to shutdown this TV using domoticz

Samsung Smart TV (on or off)

Posted: Tuesday 15 December 2015 9:10
by mvzut
As an alternative solution: If you can spare the money, I can highly recommend a Logitech Harmony remote. The hub can be connected to Domoticz, so that you will always know in which state your TV is, and you can also switch it off and even on.

Re: Samsung Smart TV (on or off)

Posted: Saturday 19 December 2015 13:41
by proohu01
I used the Domoticz build-in "System Alive Checker (Ping)" to determine if my Samsung TV's are on or off. However, last week my EU40H6200 got a firmware update. Since then, it always replies to a ping. Even when the TV is turned off.

I did an nmap to check for ports that might be used to find a new way of getting the power state of this TV. These ports seem to be open:
ports
ports
samsung ports.JPG (29.09 KiB) Viewed 24891 times
So I don't want to control the TV. I just want to be able to determine the power state without having to buy a power plug with energy usage reporting capabilities. Is there a simple way? I am not a programmer but could this node.js express framework (port 8001) be of any use?

Re: Samsung Smart TV (on or off)

Posted: Tuesday 22 December 2015 23:50
by juankar
It doesn't wor with UE48H6500 (api ver 2.0) model of 2014. :(
Ah! it has not 55000 port open, it has 15500, but it doesn't obey commands...

Re: Samsung Smart TV (on or off)

Posted: Thursday 28 April 2016 2:09
by trixwood

Re: Samsung Smart TV (on or off)

Posted: Thursday 16 June 2016 18:45
by wokkelp
Hesmink wrote:
proohu01 wrote:What is the exact line you entered in the 'off action' field?
And can you share you script?
The off action is:
script://domoticz/scripts/samsung_tv_off.py

The script is a slightly modified version of something I found on the internet:

Code: Select all

#!  /usr/bin/python
#   Title: samsungremote.py
#   Author: Asif Iqbal
#   Date: 05APR2012
#   Info: To send remote control commands to the Samsung tv over LAN
#   TODO:

import socket
import base64
import time, datetime

#
# Variables
#
#IP Address of TV
tvip = "192.168.178.16"
#IP Address of TV
myip = "192.168.178.14"
#Used for the access control/validation, but not after that AFAIK
mymac = "b8-27-eb-f1-5a-f3"
#Might need changing to match your TV type
tvappstring = "iphone.UE46ES8000.iapp.samsung"
#What gets reported when it asks for permission
remotename = "Domoticz Samsung Remote"

#What the iPhone app reports (don't change this)
appstring = "iphone..iapp.samsung"

# Function to send keys
def sendKey(skey, dataSock, appstring):
 messagepart3 = chr(0x00) + chr(0x00) + chr(0x00) + chr(len(
base64.b64encode(skey))) + chr(0x00) + base64.b64encode(skey);
 part3 = chr(0x00) + chr(len(appstring)) + chr(0x00) \
+ appstring + chr(len(messagepart3)) + chr(0x00) + messagepart3
 dataSock.send(part3);

# Open Socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((tvip, 55000))

# First configure the connection
ipencoded = base64.b64encode(myip)
macencoded = base64.b64encode(mymac)
messagepart1 = chr(0x64) + chr(0x00) + chr(len(ipencoded)) \
+ chr(0x00) + ipencoded + chr(len(macencoded)) + chr(0x00) \
+ macencoded + chr(len(base64.b64encode(remotename))) + chr(0x00) \
+ base64.b64encode(remotename)

part1 = chr(0x00) + chr(len(appstring)) + chr(0x00) + appstring \
+ chr(len(messagepart1)) + chr(0x00) + messagepart1
sock.send(part1)

messagepart2 = chr(0xc8) + chr(0x00)
part2 = chr(0x00) + chr(len(appstring)) + chr(0x00) + appstring \
+ chr(len(messagepart2)) + chr(0x00) + messagepart2
sock.send(part2)

# Now send the keys as you like, e.g.,
sendKey("KEY_TVPOWEROFF",sock,tvappstring)

# Close the socket when done
sock.close()
Steps I took:
I copied your script to the scripts folder on my Raspberry Pi;
I changed tvip to the ip address of my Samsung smart TV;
I changed myip to the ip address of my Raspberry Pi;
I changed mymac to the mac address of my Raspberry Pi;
I changed tvappstring to iphone.UE40F6600.iapp.samsung;
I created a virtual switch with the script:// line in the off action.

It doesn't work, my domoticz log doesn't show any errors and my TV doesn't ask for permission or responds to the command sent from the script.

Re: Samsung Smart TV (on or off)

Posted: Friday 17 June 2016 10:32
by Treve
I use a simpler way to achieve this.

i own a Samsung UE40H6620SV SmartTV and detect by Network if the Samsung is on or of. It also works when Samsung is in standby mode.
I use this to prevent the lights go off when i watch late television, it works perfect.

1 - i installed new hardware type "System Alive Checker" (ping)

2 - I'm attaching the IP Address of the Samsung to "settings"

3 - Result is a virtual switch



When i try to add images as an example, i get the message "Sorry, the board attachment quota has been reached".

Re: Samsung Smart TV (on or off)

Posted: Friday 12 August 2016 17:39
by nigels0
Newer Samsung TVs ( >2014) have a different protocol and the 55000 port is not available any more.

Re: Samsung Smart TV (on or off)

Posted: Friday 19 August 2016 12:21
by bigpea
Hi all,
i'm trying to use this script, but I have one question, for my curiousity:.
What does it mean the string:

Code: Select all

tvappstring = "iphone.UE46ES8000.iapp.samsung"
I tknow that the UE46ES8000 is the model of the TV, "samsung" is the brand (iphone and iapp I don't know), but in practice what they do?

Thanks. :)

Re: Samsung Smart TV (on or off)

Posted: Friday 19 August 2016 12:55
by trixwood
it is used in authentication with the tv.
Change it to something else and you will see a popup on your tv, asking if you want to add this new remote.
And you have to accept it on the tv...