node client to connect to a JMRI xmlio webservice this allows basic control of a model railroad layout via DCC
JavaScript
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
.gitignore
README.md
index.js
package.json

README.md

jmri-client

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

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

var client = new JmriClient({
	host: 'http://domain.com: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
});