Skip to content

Instantly share code, notes, and snippets.

@micha149
Last active October 3, 2015 01:08
Show Gist options
  • Save micha149/2360108 to your computer and use it in GitHub Desktop.
Save micha149/2360108 to your computer and use it in GitHub Desktop.
Usage prototype for home-js a nodeJS based toolkit for KNX home automation
var latitude = 50.78,
longtitude = 7.15,
timer = new BlendsTimer(address, connection);
up = new RandomTimeOffset({
time: new DayTimeSunrise(latitude, longtitude),
min: "+30m",
max: "+1h"
});
down = new RandomTimeOffset({
time: new DayTime("18:00:00"),
min: "-30m",
max: "+45m"
});
timer.setUpTime(up);
timer.setDownTime(down);
var connection, address,
homelib = require("homelib"),
UsbDriver = homelib.Driver.UsbDriver
Connection = homelib.Connection,
GroupAddress = homelib.GroupAddress;
connection = new Connection(new UsbDriver('usb:1:5:1:0'));
address = new GroupAddress({
address: "1/2/13"
type: "1.001"
title: "Livingroom – Light on ceiling"
});
connection.send(address, true);
connection.on(address, function(message) {
console.log(message.getData());
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment