LOGIN  |  REGISTER
Smart Living Made Brilliant!
CASTLEOS FORUM

HomeScripting

A forum for information about scripting with CastleOS. Get samples, suggestions, and other help here

Scene - Run a Script On vs. Off Messages in this topic - RSS

Tommy Long
Tommy Long
Posts: 190


3/5/2017
Tommy Long
Tommy Long
Posts: 190
In the Scene editor you can add devices of course as well as add a script to run.
When the scene is activated ON, the devices turn on, and when the scene is deactivated OFF the devices turn off.
There is no "run script X when activated/ON" nor "run script Y when deactivated/OFF", just simply "run this script".
Since the same script is called either way, is there a way for the script to know whether the scene is being activated/ON or deactivated/OFF?
0 link
Chris Cicchitelli
Chris Cicchitelli
Administrator
Posts: 3261


3/5/2017
Chris Cicchitelli
Chris Cicchitelli
Administrator
Posts: 3261
Within the script you can check the current status of the devices in the scene, by calling the GetDevice method. For instance, if your script turns a device on, then when the script is called it checks if the device is on, and then runs the "off" mode, and vice versa if it's off.
0 link