Skip to content

A NodeJS library for controlling devices using the LightwaveRF Wi-Fi Link

License

Notifications You must be signed in to change notification settings

rooi/node-lightwaverf

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-lightwaverf

A NodeJS library for controlling devices using the LightwaveRF Wi-Fi Link

Installation

npm install lightwaverf

Usage

Initialize

var LightwaveRF = require("lightwaverf");
var lw = new LightwaveRF({ip:"192.168.1.123",email:"name@host.com",pin:"0123"});

Or to read from a LightwareRF Gem format YAML file:

var lw = new LightwaveRF({ip:"192.168.1.123", file:"/a/config/file.yml"});

Turn a device on

To turn a device on you need to have set it up using the mobile or web app. You need the room ID and the device ID.

lw.turnDeviceOn(1 /*roomId*/, 1 /*deviceId*/, function(error, content) {
    if (error) {
        console.log("Error turning device on " + error.message);
    } else {
        console.log("Response: " + content);
    }
});

Turn a device off

To turn a device off you need to have set it up using the mobile or web app. You need the room ID and the device ID.

lw.turnDeviceOff(1 /*roomId*/, 1 /*deviceId*/, function(error, content) {
    if (error) {
        console.log("Error turning device off " + error.message);
    } else {
        console.log("Response: " + content);
    }
});

Dim the device in a room

To turn a dim the device in a room you need to have set it up using the mobile or web app. You need the room ID and device ID.

lw.setDeviceDim(1 /*roomId*/, 1 /*deviceId*/, 50 /*percentage from 0-100*/, function(error, content) {
    if (error) {
        console.log("Error changing dim of device " + error.message);
    } else {
        console.log("Response: " + content);
    }
});

Turn a room off

To turn a room off you need to have set it up using the mobile or web app. You need the room ID.

lw.turnRoomOff(1 /*roomId*/, function(error, content) {
    if (error) {
        console.log("Error turning room off " + error.message);
    } else {
        console.log("Response: " + content);
    }
});

Request the energy status

To get the current status from the LightwaveRF Energy Monitor Smart Meter you need to have linked it to the Wi-Fi Link first.

lw.requestEnergy(function(error, data) {
    if (error) {
        console.log("Error turning device off " + error.message);
    } else {
        //data: { current: 300, max: 620, today: 850, yesterday: 0 }
        console.log("Energy ", data);
    }
});

About

A NodeJS library for controlling devices using the LightwaveRF Wi-Fi Link

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%