The switch order/pattern numbering system for the Pegasus Ultimate Powerbox v.2 is certainly not intuitive. I discovered the layout by trial and error. I hope I submitted my attachment properly) in which I marked up the switch numbers. I tested each number so it is verified. I hope you find the attachment helpful.
Below is cut-and-past from my StartupObs.js. My StarupObs file has been tested and works fine and the Pegasus opening and switching occurs without a hitch.) Below Ihighlighted the specific changes that relate to opening the Pegasus software and the turning ON of some switches of the UPBv.2 I personally needed. Similar (but "opposite" code was included in my ShutdownObs.js file. Essentially my "true" became "false"
Code:
// ...
// Bob Denny 27-Mar-2017 GEM:1533 Support multiple NetBooter power strips.
//------------------------------------------------------------------------------
var Pegasus = new ActiveXObject("ASCOM.pegasus_upb.Switch"); //this is utilitzing the ASCOM Pegasus ID
var FSO; // FileSystemObject used in several functions
var SWID = "ASCOM.DigitalLoggers.Switch"; // ID of power switch driver (e.g. DigitalLoggers)
var SWT = null; // [sentinel] ASCOM Switch driver
function main()
{
var i;
FSO = new ActiveXObject("Scripting.FileSystemObject");
Console.LogFile = Prefs.LocalUser.DefaultLogDir + "\\Scheduler\\StartupObs-" +
Util.FormatVar(new Date().getVarDate(), "yyyymmdd") + "@" +
Util.FormatVar(new Date().getVarDate(), "HhNnSs") + ".log";
Console.Logging = true;
// =====================================================
// HERE IS WHERE YOU ADD CODE TO TURN POWER ON AS NEEDED
// =====================================================
Console.PrintLine("Starting Ultimate Power Box"); //Starting the Pegasus Software. Make sure in Config Tab that you
if(!StartProgram("C:\\Program Files (x86)\\Pegasus Astro\\Ultimate Powerbox v2\\UPB.exe",1))
{ //check the box "autoconnect to device" under During Startup section
Console.PrintLine("**Failed to start Pegasus");
throw new Error(0x80040001, "==== Startup failed, cannot continue");
}
Pegasus.Connected = true; //Some Switches I personally need to be ON
Console.PrintLine("Pegasus is Connected......");
Pegasus.SetSwitch(0, true);
Console.PrintLine("Gemini Power is ON......");
Pegasus.SetSwitch(2, true);
Console.PrintLine("Camera Power is ON......");
Pegasus.SetSwitch(8, true);
Console.PrintLine("Camera is Connected......");
Pegasus.SetSwitch(11, true);
Console.PrintLine("FlipFlat is Connected......");
Pegasus.SetSwitch(12, true);
Console.PrintLine("UltraStar is Connected......");
// ==================================================================
// Just continuation of the rest of my StartUp script
// CHANGE PATHS TO PROGRAMS AS NEEDED AND ADD OTHER PROGRAMS YOU NEED
// ==================================================================
Console.PrintLine("Starting support programs as needed");
if(!StartProgram("C:\\Program Files (x86)\\Diffraction Limited\\MaxIm DL 6\\MaxIm_DL.exe", 1))
{
Console.PrintLine("**Failed to start MaxIm");
throw new Error(0x80040001, "==== Startup failed, cannot continue"); // the rest is not Pegasus related
}
// ...
}