¿ªÔÆÌåÓý

Locked Re: Track power switch on Panel


 

On 3/14/2021 11:44 PM, mdieckmann@... wrote:
So I made a sensor that turns on and off track power. However when I first load the panel, the status of track power is unknown. Is there a way to query track power status on startup of the panel?
That depends on the capabilities of the DCC hardware you are using. Some can be queried, while some cannot. Some which can be queried can report incorrect information.

One "workaround" that you may consider is "run a script" at JMRI start-up. Exactly what the script does depends on your hardware:

1) if your hardware is one which allows successful (and reliable) query of track power status, the script would simply execute the appropriate query of your hardware for track power state. This is likely a system-specific problem, with a system-specific solution.

2) if your hardware cannot be queried or its result cannot be trusted, the best "workaround" is to simply execute a script to set DCC track power state to either "on" or "off" to suit your desire. The script "PowerOn.py" (in the jython directory of the JMRI distribution) will set the DCC track power state to "on". If you would prefer to set DCC track power "off" then you would need to create a new script, based on the "PowerOn.py" script, which would request the "off" state.

Once you have a suitable script, configure your JMRI "Preferences" with a start-up operation which "Run"s the appropriate script. This is done via the "Edit"->"Preferences"->"Start Up" window, by "Add"ing a "Run script..." operation.

Regards,
Billybob

Join [email protected] to automatically receive all group messages.