Page 4 of 4

Re: Samsung Smart TV (on or off)

Posted: Monday 20 February 2017 16:08
by perwei
For Samsung Series K TVs Wake-on-LAN works ok.
See viewtopic.php?f=28&t=16050&p=120590#p120583

Cheers
Per

Re: Samsung Smart TV (on or off)

Posted: Wednesday 15 March 2017 10:17
by strepfen
Dear All,

I would like to ask some help in case of check Samsung TV state check in Domoticz with LUA code.
First I have used this code to check the state of my TV set (with ping command):

Code: Select all

commandArray = {}
 
 ping_success=os.execute('ping -c1 192.168.1.152')
 if ping_success then
   print("ping success")
   commandArray['Nappali TV']='On'
 else
   print("ping fail")
   commandArray['Nappali TV']='Off'	
 end
 
return commandArray
This code give a good status of my TV set, but if I want to register an event to the turn on function (ex.: e-mail sending), then it is not a good solution.
Because the above code change almost every second (when ping command run again) the state of the switch to ON state (so I got hundreds of mail to mail box).
So I have changed to the bellow code to avoid this, and registered an user variable for the ON state:

Code: Select all

commandArray = {}
 
 ping_success=os.execute('ping -c1 192.168.1.152')

 if ping_success and uservariables['TvStatus'] ~= 'On' then
   print("TV Online")
   commandArray['Variable:TvStatus']='On'
   commandArray['Nappali TV']='On'
 elseif not ping_success and uservariables['TvStatus'] ~= 'Off' then
   print("TV Offline")
   commandArray['Variable:TvStatus']='Off'
   commandArray['Nappali TV']='Off'	
 end
 
return commandArray
My problem is that the above code working on the first turn on state, and then the off state, but after that the switch always show off state (and the the user variable stuck in ON state).
It looks like to me after the first on state the program change the user variable to "ON", and then when I turn off the TV, then the ping command fail, and LUA scrip give an error message, that the script was running more than 10 sec, and shut down.
So because the script shut down the user variable stay in "ON" condition, and even scrip restart the switch status won't change in the future.

Please can you check my code, and give me a good suggestion to solve this problem?!

Thank you for your support!

Re: Samsung Smart TV (on or off)

Posted: Monday 03 April 2017 10:26
by Nicogluck
pj-r wrote: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.
Hi,

How to use this client with a Raspberry Pi ?
I understand that we should compile the source code, but... please remind me how to proceed... :?

Many thanks.

Re: Samsung Smart TV (on or off)

Posted: Monday 03 April 2017 10:47
by mlamie
Nicogluck wrote:
pj-r wrote: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.
Hi,

How to use this client with a Raspberry Pi ?
I understand that we should compile the source code, but... please remind me how to proceed... :?

Many thanks.
There is a new Samsung TV page in the Domoticz wiki based on samsungctl. You can try that.
https://www.domoticz.com/wiki/Plugins/SamsungTV.html

Re: Samsung Smart TV (on or off)

Posted: Tuesday 11 April 2017 12:38
by Nicogluck
mlamie wrote: There is a new Samsung TV page in the Domoticz wiki based on samsungctl. You can try that.
https://www.domoticz.com/wiki/Plugins/SamsungTV.html
Hi,

Sorry, but I don't understand how to install and use the plugin properly.
First, I have install with sudo pip install samsungctl .
When I try the script, I get the following message :

Code: Select all

pi@raspberrypi:~$ samsungctl -i --host 192.168.1.120
Traceback (most recent call last):
  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
Secondly, I don't see any new hardware called 'Samsung TV'. Where and how should I install the plugin ?

Many thanks to all... :cry:

Re: Samsung Smart TV (on or off)

Posted: Wednesday 12 April 2017 7:45
by pj-r

Re: Samsung Smart TV (on or off)

Posted: Thursday 17 May 2018 11:57
by lupo2a
When I run the plugin or try the samnsungctl -i --host=IPADDRESS I'm getting Access Denied message but no request on the TV to allow access to the plugin/command

Any help?

Samnsung UE46F7000 version T-FXPDEUC-1135.0,BT - S

Re: Samsung Smart TV (on or off)

Posted: Tuesday 20 August 2019 8:42
by neevamerk
You can detect your TV is on or off with the help of domoticz