This simple JMRI Jython script can be used to set all defined sensors and turnouts to a known state…
[code language=”Java”]
”’
Start of Day Routine
~~~~~~~~~~~~~~~~~~~~
Sets all sensors to INACTIVE
Sets all turnouts CLOSED
”’
import jarray
import jmri
class SoD(jmri.jmrit.automat.AbstractAutomaton) :
def init(self):
self.sen = sensors.getSystemNameList()
self.tur = turnouts.getSystemNameList()
def handle(self):
print "Setting sensors INACTIVE"
for s in self.sen:
print s
sensors.provideSensor(s).setState(INACTIVE)
print "Setting turnouts CLOSED"
for t in self.tur :
print t
turnouts.provideTurnout(t).setState(CLOSED)
return 0 # one shot, do not loop
SoD().start()
[/code]