Comparing version 0.7.2 to 0.7.4
@@ -0,0 +0,0 @@ KnxHelper = require('./src/KnxHelper.js'); |
{ | ||
"name": "knx.js", | ||
"version": "0.7.2", | ||
"version": "0.7.4", | ||
"private": false, | ||
@@ -16,2 +16,3 @@ "repository": { | ||
"knx", | ||
"eib", | ||
"eibd", | ||
@@ -18,0 +19,0 @@ "house automation" |
@@ -0,1 +1,3 @@ | ||
KNXnetIP (KNX over IP) deriver for nodejs. | ||
Based on https://github.com/lifeemotions/knx.net | ||
@@ -5,25 +7,29 @@ | ||
One can find Usage example, it tested with KNXnet/IP router: ABB IPR/S 2.1. | ||
# Install | ||
* go to npm's package dir | ||
* `npm i knx.js --save` | ||
* or `yarn add knx.js --save` | ||
#Usage | ||
# Usage | ||
``` | ||
var KnxConnectionTunneling = require('knx.js').KnxConnectionTunneling; | ||
var connection = new KnxConnectionTunneling('192.168.2.222', 3671, '192.168.2.107', 13671); | ||
const KnxConnectionTunneling = require('knx.js').KnxConnectionTunneling; | ||
let connection = new KnxConnectionTunneling('192.168.2.222', 3671, '192.168.2.107', 13671); | ||
var lightValue = false; | ||
function toggleLight() { | ||
lightValue = !lightValue; | ||
connection.Action("1/0/0", lightValue); | ||
} | ||
connection.on('event', event => console.log('Event received', event)); | ||
connection.on('status', status => console.log('Status received', status)); | ||
let lightValue = false; | ||
const toggleLight = () => { | ||
lightValue = !lightValue; | ||
connection.Action('1/0/0', lightValue); | ||
}; | ||
connection.Connect(function () { | ||
setTimeout(toggleLight, 2000); | ||
setTimeout(toggleLight, 5000); | ||
setTimeout(function () { | ||
connection.Disconnect(); | ||
}, 7000); | ||
setTimeout(toggleLight, 2000); | ||
setTimeout(toggleLight, 5000); | ||
setTimeout(() => connection.Disconnect(), 7000); | ||
}); | ||
``` | ||
@@ -33,2 +39,2 @@ | ||
![Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)](https://licensebuttons.net/l/by-nc-sa/4.0/88x31.png "CC BY-NC-SA 4.0") | ||
![Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)](https://licensebuttons.net/l/by-nc-sa/4.0/88x31.png "CC BY-NC-SA 4.0") |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /** |
@@ -87,3 +87,3 @@ /** | ||
buf = new Buffer(1); | ||
buf.writeIntLE(data ? 1 : 0); | ||
buf.writeInt8(data ? 1 : 0, 0); | ||
break | ||
@@ -90,0 +90,0 @@ case 'number': |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /** |
@@ -31,6 +31,6 @@ /** | ||
/* | ||
WTF? Why we send 4 times? | ||
*/ | ||
KnxSenderTunneling.prototype.SendData = function (/*buffer*/datagram, callback) { | ||
if (!datagram) { | ||
return cb(new Error('Cannot send empty datagram')); | ||
} | ||
var that = this; | ||
@@ -45,5 +45,2 @@ | ||
this._udpClient.send(datagram, 0, datagram.length, this._remoteEndpoint.port, this._remoteEndpoint.host, cb); | ||
//this._udpClient.send(datagram, 0, datagram.length, this._remoteEndpoint.port, this._remoteEndpoint.host, callback); | ||
//this._udpClient.send(datagram, 0, datagram.length, this._remoteEndpoint.port, this._remoteEndpoint.host, callback); | ||
//this._udpClient.send(datagram, 0, datagram.length, this._remoteEndpoint.port, this._remoteEndpoint.host, callback); | ||
} | ||
@@ -50,0 +47,0 @@ |
Sorry, the diff of this file is not supported yet
39
66480
1367