I've been tweaking my StartupObs.js and ShutdownObs.js files with particular regard to my Digital Datalogger (DDL). Initially I had no luck controlling the switch until I went to the DDL Setup window in the HTML interface and checked "Allow legacy plaintext login methods." After that, Startup seemed to work fine but Shutdown thought the switches were already off. Looking at the code......

Startup has this code:

if(!SWT.GetSwitch(switchNumber)) {

SWT.SetSwitch(switchNumber, true);
Console.PrintLine("...powered on " + switchName);
} else {
Console.PrintLine("..." + switchName + " already powered up");
}


Shutdown has this code:


if(SWT.GetSwitch(switchNumber)) {

SWT.SetSwitch(switchNumber, false);
Console.PrintLine("...powered off " + switchName);
} else {
Console.PrintLine("..." + switchName + " already powered down");
}


Both codes require the Digital DataLogger (DDL) to report switch status as OFF=0, ON=1.
It appears, though that the DDL is reporting 0 (or possible NULL), regardless of status. This doesn't affect turn on, since the software assumes "OFF" and turns on. It does affect turn off, because ACP assumes it's already off. If I comment out the switch test then the shutdown works fine and turns off the switches. There may be a setting in the DDL that's preventing it from reporting switch status. Not a big issue since turning OFF an already off function or ON an already on function has no effect, but I'd like to get the full intent of the code. Thanks!