jmri-client
TypeScript icon, indicating that this package has built-in type declarations

2.3.0 • Public • Published

jmri-client Build License NPM Version

node client to connect to a JMRI xmlio webservice this allows basic control of a model railroad layout via DCC

NPM

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);

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 2.3.0
    2
    • latest

Version History

Package Sidebar

Install

npm i jmri-client

Weekly Downloads

2

Version

2.3.0

License

MIT

Unpacked Size

12.3 kB

Total Files

5

Last publish

Collaborators

  • yamanote1138