jmri-client
v2.3.0
Published
node client to connect to a JMRI xmlio webservice
Downloads
39
Maintainers
Readme
jmri-client
node client to connect to a JMRI xmlio webservice this allows basic control of a model railroad layout via DCC
Usage
setup and instantiate client
"use strict";
import { JmriClient } from "jmri-client";
const client = new JmriClient('http', 'jmri.local', 12080);
getPower
get status of layout power (on or off)
await client.getPower().then((res) => {
console.log(res);
});
setPower
turn layout power on/off
await client.setPower(true).then((res) => {
console.log(res);
});
future functionality
getThrottle
get full status data for a given address or array of addresses (eg [11, 38])
await client.getThrottle(addresses);
setThrottleSpeed
set speed for specified throttle address
await client.setThrottleSpeed(address, speed);
setThrottleDirection
set direction for specified address use 'true' for forward, 'false' for backward
await client.setThrottleDirection(address, direction);
setThrottleFunction
set function value specified address and function
await client.setThrottleFunction(address, functionNumber, value);
getTurnouts
list all turnouts with current status
await client.getTurnouts();
setTurnout
set status of specific turnout by address
await client.setTurnout(address, value);