1.1.1 • Published 7 years ago

vantage-infusion v1.1.1

Weekly downloads
1
License
MIT
Repository
-
Last release
7 years ago

Vantage InFusion

A simple TCP/IP socket with utility methods for communicating effectively with a Vantage InFusion controller. Ensures responses to host commands are returned to the caller.

Install

$ npm install --save vantage-infusion

Usage

const controller = require('vantage-infusion').createConnection({
	host: '10.1.2.10',
	port: 3001
});

controller.set(352, 100, 2)
	.then(response => {
		console.log(response.toString());
		//=> 'R:RAMPLOAD 352 100 2\n'
	})
	.catch(response => {
		console.log(response.toString());
		//=> 'R:ERROR:7 "Invalid VID"\n'
	});

API

createConnection(options)

Creates a socket connection to the controller.

options

Type: object

Any of the net.createConnection options.

controller.set(id, value, duration=3)

Uses the RAMPLOAD host command to change the value of a light. Returns a Promise for a VantageResponse.

id

Type: number

The id of the light to select.

value

Type: number

The percent power to set the light to.

duration

Type: number

Default: 3

The duration (in seconds) over which to change the light power.

controller.get(id)

Uses the GETLOAD host command to retrieve the value of a light. Returns a Promise for a VantageResponse.

id

Type: number

The id of the light to select.

controller.run(command)

Runs an arbitrary host command. Returns a Promise for a VantageResponse.

run is guarded and runs with a maximum concurrency of one. This ensures that the response coming from the controller is always the response to the latest command.

command

Type: string

The host command to append a delimiter to and execute.

Should not be a request for STATUS updates.

VantageResponse

command

Type: string

The host command issued to the controller.

isError

Type: boolean

Whether or not the response was an error.

errorCode

Type: number

The error code associated with the error message. Only available when the response was an error.

errorMessage

Type: string

The error message associated with the error code. Only available when the response was an error.

parameters

Type: array: string

All of the space-separated values after the host command in the response.

toString()

Converts the response to the original string from the controller.

1.1.1

7 years ago

1.1.0

7 years ago

1.0.1

7 years ago