2.3.0 • Published 2 years ago

jmri-client v2.3.0

Weekly downloads
15
License
MIT
Repository
github
Last release
2 years ago

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

2 years ago

2.2.0

2 years ago

2.1.0

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.4.2

4 years ago

1.4.1

4 years ago

1.4.0

4 years ago

1.3.0

5 years ago

1.2.0

5 years ago

1.1.0

5 years ago

1.0.3

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.1.4

9 years ago

0.1.3

11 years ago

0.1.2

11 years ago

0.1.1

11 years ago

0.1.0

11 years ago