Samsung Smart TV (on or off)

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.
User avatar
perwei
Posts: 12
Joined: Monday 13 February 2017 14:22
Target OS: Linux
Domoticz version: 3.5877
Location: Hønefoss, Norway
Contact:

Re: Samsung Smart TV (on or off)

Post by perwei » Monday 20 February 2017 17:08

For Samsung Series K TVs Wake-on-LAN works ok.
See viewtopic.php?f=28&t=16050&p=120590#p120583

Cheers
Per
Raspberry Pi 3/Raspbian GNU/Linux
Z-Wave.Me Razberry2 Z-Wave controller
3 x Aeotec ZW100 Multisensor 6
1 x Aeotec Smart Dimmer 6
2 x FIBARO System FGWPE Wall Plug
2 x FIBARO Dimmer 2 FGD-212
1 x FIBARO System FGK10x Door Sensor
1 x Popp Wall Controller

strepfen
Posts: 1
Joined: Wednesday 15 March 2017 10:34
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Samsung Smart TV (on or off)

Post by strepfen » Wednesday 15 March 2017 11:17

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!

Nicogluck
Posts: 5
Joined: Friday 24 April 2015 17:13
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Samsung Smart TV (on or off)

Post by Nicogluck » Monday 03 April 2017 10:26

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.

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

Re: Samsung Smart TV (on or off)

Post by mlamie » Monday 03 April 2017 10:47

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
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

Nicogluck
Posts: 5
Joined: Friday 24 April 2015 17:13
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Samsung Smart TV (on or off)

Post by Nicogluck » Tuesday 11 April 2017 12:38

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:

pj-r
Posts: 256
Joined: Wednesday 17 December 2014 18:30
Target OS: Linux
Domoticz version: V3.8650
Location: Jyväskylä, Finland
Contact:

Re: Samsung Smart TV (on or off)

Post by pj-r » Wednesday 12 April 2017 7:45

LXC(x64 Ubuntu Xenial), RFXtrx433E, MySensors

lupo2a
Posts: 52
Joined: Thursday 29 September 2016 10:55
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Samsung Smart TV (on or off)

Post by lupo2a » Thursday 17 May 2018 11:57

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
Raspberry PI 3 raspbian stretch
Domoticz: V3.9047
- Aeotec Gen5 EU
- Neo CoolCam Door Detector and plug
- FIBARO FGWPE Wall Plug
- 6 FIBARO System FGRM222 Roller Shutter Controller 2
- Kodi SamnsungTV Yamaha plugin

Post Reply

Who is online

Users browsing this forum: Koploper and 4 guests