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.

Moderators: leecollings, remb0

User avatar
perwei
Posts: 16
Joined: Monday 13 February 2017 13:22
Target OS: Linux
Domoticz version: 2020.2
Location: Hønefoss, Norway
Contact:

Re: Samsung Smart TV (on or off)

Post by perwei »

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 9:34
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Samsung Smart TV (on or off)

Post 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!
Nicogluck
Posts: 4
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 »

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

Re: Samsung Smart TV (on or off)

Post 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
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: 4
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 »

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: 140
Joined: Wednesday 17 December 2014 17:30
Target OS: Linux
Domoticz version: V3.8650
Location: Jyväskylä, Finland
Contact:

Re: Samsung Smart TV (on or off)

Post by pj-r »

LXC(x64 Ubuntu Xenial), RFXtrx433E, MySensors
lupo2a
Posts: 31
Joined: Thursday 29 September 2016 10:55
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Samsung Smart TV (on or off)

Post 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
Raspberry PI 4
Domoticz: V2023.2
- 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
- pluginn manager
- Netatmo
neevamerk
Posts: 1
Joined: Tuesday 20 August 2019 8:35
Target OS: Windows
Domoticz version:
Contact:

Re: Samsung Smart TV (on or off)

Post by neevamerk »

You can detect your TV is on or off with the help of domoticz
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests