7,711 views

lirc_client module for nodejs

Ever wanted to process infrared commands in your nodejs program. Now this is possible using the famous lirc interface on operating systems supporting lirc.

Try the lirc_client nodejs module:

npm install lirc_client

Or download the sources from github: https://github.com/1stsetup/node-lirc_client

It will require nodejs version >= 0.10.0 and to compile it you need the development files/packages of lirc.

When you see issues with it please post them to https://github.com/1stsetup/node-lirc_client/issues

Following is an example of the code

var lirc_client = require('lirc_client');

try {
    var client = new lirc_client.client("clienttest", true);
    client.on("data", function(data) {
        console.log("Received data from lirc:",data);
        client.close();
    });
    client.on("closed", function() {
        console.log("Lirc daemon closed our connection. We need to reconnect.");
    });
    console.log("client.isConnected:", client.isConnected);
    console.log("client.mode:", client.mode);
}
catch (err) {
    console.log("Error on new client:",err);
}

Leave a Reply

Your email address will not be published.