Page 1 of 1
Is my Philips TV on standby
Posted: Monday 07 December 2015 9:35
by felix63
My Philips TV is working fine with Domoticz. Thanks to helpful posts on this site I have been able to display messages on screen. How cool is that. I am able to toggle standby. The only thing I would like to be able to do is to have a switch that show wether or not my TV is on standby.
Using 'ping' only tells me if the device has power but not if it is on standby. I think the way to go would be to send any Jointspace command and from the answer (or lack thereof) conclude the current state of affairs. But alas both my technical knowledge and Google searches have failed to come up with an concrete approach to realize this switch. Any help?
Cheers,
Lex
Re: Is my Philips TV on standby
Posted: Monday 07 December 2015 10:33
by Abbadon
can you post (for my information) model of you philips tv and post you used to connect it?
Re: Is my Philips TV on standby
Posted: Monday 07 December 2015 17:36
by felix63
Hardware Info:
- Raspberry pi model 2B
- RFXCOM-E
- Philips TV 42PFL6007
Software
- to toggle standby: curl -X POST -H "Content-Type: application/json" -d '{ "key": "Standby"}'
http://ip-address:1925/1/input/key
- to display (using JSTx): /home/pi/JSTx/JSTx -F /home/pi/JSTx/font/decker.ttf -s 40 -W 1280 -H 720 -w 1200 -h 60 -x 100 -y 40 -t " $*" t -T 5 -b "100,100,100,128" -f "255,255,255,255" -i image:alert.png -i image:/home/pi/domoticz/scripts/alert.png --dfb:quiet --remote=ip-address
Re: Is my Philips TV on standby
Posted: Thursday 18 February 2016 23:58
by HansLe
@spatt3r.
I'm using this code to get my TV in standby mode. Save it as a PHP script (f.e. tv.stop.php). I've a tv switch where I defined as "off action" thiss PHP script: script:///home/pi/domoticz/scripts/tv.stop.php <IP TV>
Don't forget to make the PHP scripte executable!
As far as I know it is not possible to wake up the TV with a (JSON) call. Therefore you still have to use the remote control.
Code: Select all
#!/usr/bin/php
<?php
// Stop TV device with given IP adres
//
// Uses curl. Maybe you havbe to install curl: sudo apt-get install php5-curl
//
// check number of arguments; 1 is always the php filename
if ($argc < 2 ) {
$msg = "TV%20stop,%20no%20IP%20as%20argument!" ; // change spaces to %20!
}
else {
$ip = $argv[1];
$url = "http://$ip:1925/1/input/key";
$data = array(
"key" => "Standby",
);
$data_string = json_encode($data);
// open connection
$ch = curl_init();
$userAgent = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)';
curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
// close connection
curl_close($ch);
$msg = "TV%20$ip%20stopped,%20result%20$result"; // changes spaces to %20!
}
//
// Now write $msg to the Domoticz log file via json
//
// After http:// enter your Domoticz server url
//
$url = "http://<DOMOTICS SERVER IP with portnumber>/json.htm?type=command¶m=addlogmessage&message=$msg";
// open connection
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_NOBODY, TRUE);
// execute post
$result = curl_exec($ch);
// close connection
curl_close($ch);
?>