Page 1 of 1

Power on if no ping response ?

Posted: Fri Jan 13, 2017 4:56 pm
by Magnusnu

I have both a TV and a IPTV box which use IR toggle power on/off.
I can ping them if they are alive - and would like to be able to send a power on if it's off, and off if it's on..
How can that be done ?
IR signals sent with Global Caché IR transmitters.



Re: Power on if no ping response ?

Posted: Thu Jan 19, 2017 5:08 am
by Dave
Hi Magnus. I've been thinking this one over. There is an issue with a ping type of interaction, in that it is inherently asynchronous. Send a request (ping) and wait some length of time for a response. I assume that you would like to be able to send a command and based on the result of that command either send power on or power off to your devices. However, with an asynchronous process like a ping, it would need to send the ping and then wait, and at some later time then decide what to do. If you send a TC command to a device that it is not currently connected to, it will attempt to connect, and then if it is successful, will send the command. But it really isn't architected to do something if it can't connect (other than let you know that it couldn't connect). So I think this might take an update to TC to provide this type of interaction, and not really sure at the moment what that would look like.

With that said, if your devices respond to SSDP requests, it would be possible with the current app to send an SSDP M-SEARCH request, which should prompt any devices on your network that support SSDP to respond immediately, and then kick off a timer to check a couple seconds later to see if the desired device has responded, and if not, send the power on, etc. This will only work if your device sends the SSDP response if it is on, and does not send it if it is off. Some devices only go into stand-by, which still might send a response even if it is "off", just depends on your devices. If you'd like more info on SSDP, let me know. There is a sample SSDP activity on the download page on the web site that might help.

Re: Power on if no ping response ?

Posted: Thu Jan 19, 2017 9:30 pm
by Magnusnu
Hi Dave!

My TV does respond to a SSDP if it's powered on, and no response at all when off.
It also responds to http requests on port 8001 :-)

Response can be like this:
"DUID": "07270e01-0078-1000-8cd0-e47dbdce8006",
"Model": "14_X14_2D",
"ModelName": "UE22H5600",
"ModelDescription": "Samsung TV RCR",
"NetworkType": "wireless",
"SSID": "Strom-a",
"IP": "",
"FirmwareVersion": "Unknown",
"DeviceName": "[TV] Kitchen",
"DeviceID": "07270e01-0078-1000-8cd0-e47dbdce8006",
"UDN": "07270e01-0078-1000-8cd0-e47dbdce8006",
"Resolution": "1920x1080",
"CountryCode": "SE",
"SmartHubAgreement": "true",
"ServiceURI": "",
"DialURI": "",
"Capabilities": [
"name": "samsung:multiscreen:1",
"port": "8001",
"location": "/ms/1.0/"
Just need to find out what the command is to set it for switching to the right input now.
I (still) only use it as display from my Sony Receiver - so should come up right after power on.

Thinking I can send a http request first:
If I get a response = TV is on, carry on and turn on Zone2 for TV
If I get no response = TV is off - send the power toggle command to Global Caché
Test again, if I get response - turn on TV for Zone 2.

I also have a remote controlled power switch for it (Telldus Znet Lite V2 and 433 MHz pwoer socket) which I want to integrate - but am still trying to get my head around that part. So maybe I can just give the TV power and it will come back powered on - if that was the state when power was taken away..

Many thanks for good feedback

Re: Power on if no ping response ?

Posted: Fri Jan 20, 2017 5:48 am
by Dave
Yes, the HTTP request would definitely be easiest. You would just need an HTTP Request button set for feedback, with the following feedback script:

Code: Select all

if (_feedback.indexOf('timed out') > 0) {
  // send power on
  return '[#]PowerOnButton';
} else {
  // send power off
  return '[#]PowerOffButton';
the [notimeout] just tells TC to ignore any timeouts and not present an alert message, but it will still receive the feedback from the timeout. The only issue is that this will wait for the feedback timeout duration before executing the power on button. The power off will execute immediately since HTTP response will come back right away. I would suggest setting the "Feedback Timeout" option in TC settings to something really small so you don't have to wait very long for the request to timeout when the device is powered off. Let me know how this works for you.