Post 8 made on Friday February 13, 2009 at 15:16 |
Guy Palmer Active Member |
Joined: Posts: | June 2008 648 |
|
|
Here is the code that I use to track the device state of my TV:
if(System.getGlobal("Device_TV")=="on") { System.setGlobal("Device_TV","off"); CF.widget("PS_TVOff","PS_TVCodes","PS_Codes").executeActions(); } else { System.setGlobal("Device_TV","on"); CF.widget("PS_TVOn","PS_TVCodes","PS_Codes").executeActions(); }
This code sits on a button which acts as a power toggle. The two lines with executeActions() each link to link hidden buttons which switch the TV (and cable box) off and on respectively. The variable "Device_TV" monitors the device state and has the value 'on' if the TV is on and 'off' if the TV is 'off'.
In case anyone is wondering why I do this, it is because a) my wife likes toggles rather than discretes and b) there is only one hard button for power.
|
|
|