Controlling Digital Logger Power Switch
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!
Controlling Digital Data Logger
I believe the driver interprets whatever comes from the switch via HTTP into Boolean false and true. If it’s passing back 0, “0”, “off”, 1, “1”, “on” then it is a bug. The ASCOM standard is Boolean for GetSwitch(). But this driver has been working with the older version switches.
Controlling Digital Data Logger
Knowing me and how I think, the error message is saying that LightCtrlProgram isn’t the right spelling. I’m not in a position to easily check my script (Easter at grandkids). Look carefully at what you have in there. Are there Unicode characters maybe? I could be wrong but double check against the documentation in ACP Help.