Is my Philips TV on standby

Moderator: leecollings

Post Reply
User avatar
felix63
Posts: 244
Joined: Monday 07 December 2015 9:30
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.1
Location: Gouda
Contact:

Is my Philips TV on standby

Post 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
Abbadon
Posts: 40
Joined: Thursday 01 October 2015 8:25
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Poland, Wrocław
Contact:

Re: Is my Philips TV on standby

Post by Abbadon »

can you post (for my information) model of you philips tv and post you used to connect it?
User avatar
felix63
Posts: 244
Joined: Monday 07 December 2015 9:30
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.1
Location: Gouda
Contact:

Re: Is my Philips TV on standby

Post 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
HansLe
Posts: 25
Joined: Wednesday 13 January 2016 21:12
Target OS: Raspberry Pi / ODroid
Domoticz version: V2.3530
Location: Netherlands
Contact:

Re: Is my Philips TV on standby

Post 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&param=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);
?>
Raspberry Pi B+ | Domoticz v3.4834 | RFXtrx433E | Action sockets and remote control (a cheap solution to start with)
Sonos device: control via Action remote control and EasySonos (via Domoticz scripts)
2 x Chresta TX320, Kaku sensoren, D-link camera
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest