开云体育

Locked How can I use Script or Sensor to start servers? #webserver #withrottleserver


 

In a panel, I have a momentary sensor to start the Web Server and the WiThrottle server.? I just cannot find a method or way to turn on those servers with either a script or LogixNG action.? I can do this in a profile when starting JMRI, but was hoping for a Panel trigger.
?
I browsed through the sample scripts in JMRI but nothing looked relevant.? I looked at each LogixNG action also, as well as Logix.
?
Is there a way to start the Web Server and WiThrottle servers with a sensor activation?
?
Thanks for any ideas!
?
Phil?


 

I haven’t tried it, but I think this will start the withrottle server:

import jmri
jmri.jmrit.withrottle.WiThrottleCreationAction().actionPerformed(None)

And this should start the regular web server:

import jmri
jmri.web.server.WebServerAction().actionPerformed(None)

Bob


On Sep 18, 2024, at 7:51?AM, Phil in gorgeous Young Harris via groups.io <philabernathy@...> wrote:

In a panel, I have a momentary sensor to start the Web Server and the WiThrottle server. I just cannot find a method or way to turn on those servers with either a script or LogixNG action. I can do this in a profile when starting JMRI, but was hoping for a Panel trigger.
I browsed through the sample scripts in JMRI but nothing looked relevant. I looked at each LogixNG action also, as well as Logix.
Is there a way to start the Web Server and WiThrottle servers with a sensor activation?
Thanks for any ideas!
Phil

Bob Jacobsen
rgj1927@...


 

Bob, thanks again.? Yes, and Yes, each sever started.??
?
Now do you have a LocoNet over TCP startup script???
?
By the way, I am using these startups as a temporary tool while developing the Panels that I want to use.? I start JMRI without the servers and modify things (mostly add something for functionality) then test without the servers. After stand-alone tests, I then start the servers and look at the Panel remotely.? It makes my test, save, restart, test cycles quicker.
?
Much appreciation for the work you've done, as well as the other developers and others who add to this wonderful program.??
?
Phil?


 

On Sep 19, 2024, at 10:43?AM, Phil in gorgeous Young Harris via groups.io <philabernathy@...> wrote:

Now do you have a LocoNet over TCP startup script?
Try

import jmri
jmri.jmrix.loconet.loconetovertcp.LnTcpServerAction().actionPerformed()

Bob


Bob Jacobsen
rgj1927@...


 

Thanks, Bob.? I added the word "None" in the action.Performed() parenthesis like the other statements, then it worked perfectly.? ?
?
I appreciate your help.
?
Phil?