Skip to content
Branch: master
Go to file
Code

Latest commit

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
lib
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

jmri-client Build Status

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

NPM

Usage

setup, configure and connect

const JmriClient = require('jmri-client');

let client = new JmriClient({
	host: 'http://domain.com',
  port: 1138
});

get status of layout power (on or off)

client.getPower(function(err, status){
	console.log('the power is ', status);
	// handle error and/or do stuff
});

turn layout power on/off (2=on, 4=off) todo: change to accept 'on', 1, 'off' or 0

client.setPower('1', function(err){
	// handle error and/or do stuff
});

get full status data for a given address or array of addresses (eg [11, 38])

client.getThrottle(addresses, function(err, data){
	// handle error and/or do stuff
});

set speed (0-1) for specified address todo: change this to accept value from 0-100

client.setThrottleSpeed(address, speed, function(err){
	// handle error and/or do stuff
});

set direction for specified address use 'true' for forward, 'false' for backward todo: fix this to use clearer values

client.setThrottleDirection(address, function(err){
	// handle error and/or do stuff
});

set function value specified address and function

client.setThrottleFunction(address, functionNumber, value, function(err){
	// handle error and/or do stuff
});

list all turnouts with current status

client.getTurnouts(function(err, data){
	// handle error and/or do stuff
});

set status of specific turnout by address

client.setTurnout(address, value, function(err, data){
	// handle error and/or do stuff
});

About

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

Resources

You can’t perform that action at this time.