No Padding Margin

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

    Install

    npm i jmri-client

    DownloadsWeekly Downloads

    0

    Version

    2.3.0

    License

    MIT

    Unpacked Size

    12.3 kB

    Total Files

    5

    Last publish

    Collaborators

    • yamanote1138