A driver for the Savant LiteTouch lighting control Real Time Control protocol
A driver for the LiteTouch lighting control Real Time Control protocol.
Call the connect function to connect with the LiteTouch controller. After the connection has been established, proceed by interacting with the controller.
var LiteTouch = require'litetouch';var litetouch = LiteTouchconnect'192.168.1.5' 10001// connected to controller// listen for a switch presslitetouchon'press:1,5'console.log'Switch 5 on station 1 has been pressed';;// press switch 5 on station 1litetouchpressSwitch1 5;;
You may also provide a duplex stream to the LiteTouch constructor directly.
var LiteTouch = require'litetouch'net = require'net';var socket = netcreateConnection ip: '192.168.1.5' port: 10001var litetouch = socket;
Events are emitted when the LiteTouch controller sends notifications of state change. Before any notifications are sent
by the controller, the client must use the
internalEventNotify function to instruct the controller to send them. To turn
on all events, call
Clients may register a listener function to be called when any switch is pressed, held or released. The event name
describes the particulars of the event in the following format:
<event type>:<station address>,<switch number>.
litetouchinternalEventNotify3; // can use 2 or 7 instead// listen for specific button eventslitetouchon'press:3,5'console.log'Switch 5 on station 3 has been pressed';;litetouchon'release:3,5'console.log'Switch 5 on station 3 has been released';;litetouchon'hold:1,2'console.log'Switch 2 on station 1 is being held';;// listen to all button events, for every station and switchlitetouchon'press'console.log'Switch ' + switch + ' on station ' + station + ' has been pressed';;litetouchon'release'console.log'Switch ' + switch + ' on station ' + station + ' has been released';;litetouchon'hold'console.log'Switch ' + switch + ' on station ' + station + ' has been held';;
Clients may register a listener function to be called when a timer or user event occurs.
litetouchinternalEventNotify1; // can use 2 or 7 instead// listen to specific timer and user eventslitetouchon'timer:1'console.log'Timer 1 fired';;litetouchon'user:3'console.log'User event 3 fired';;// listen to all timer and user eventslitetouchon'timer'console.log'Timer ' + id + ' fired';;litetouchon'user'console.log'User event ' + id + ' fired';;
LED Update events occur when LEDs on a switch station change. Clients may register a listener function to be called when the LED state changes.
litetouchinternalEventNotify4; // can use 2 or 7 instead// listen to LED events for a particular stationlitetouchon'led:2'console.log'The LEDs on station 2 were updated';stateArrayforEachvar switchNumber = i + 1;console.log'LED ' + switchNumber + ' is now ' + state ? 'on' : 'off';;;// listen to LED events for all stationslitetouchon'led'console.log'The LEDs on station ' + station + ' were updated';;
Module Update events occur when lighting loads on a LiteTouch module are changed. This happens when loads are dimmed, brightened, turned on or turned off.
Clients may register a listener function to be called when loads change on a module.
litetouchinternalEventNotify5; // can use 2 or 7 instead// listen to module update events for a particular modulelitetouchon'loads:2'console.log'The loads on module 2 were changed';levelArrayforEachvar loadNumber = i + 1;console.log'Load ' + loadNumber + level ? ' is now at ' + level '%' : 'was not changed';;// listen to module update events for all moduleslitetouchon'loads'console.log'The loads on module ' + module + ' were changed';;
Pull requests are welcome.
- Fork this repo.
git checkout -B yourbranch
- Make your changes.
- Open a pull request between your branch and master.