knx.js

2019-05-16 admin

knx.js是什么

什么是knx.js,KNXnetIP (KNX over IP) deriver for nodejs.

knx.js使用教程帮助文档

KNXnetIP (KNX over IP) deriver for nodejs.

Based on https://github.com/lifeemotions/knx.net

Right now it not tested in all directions, but KnxConnectionTunneling is working. 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

const KnxConnectionTunneling = require('knx.js').KnxConnectionTunneling;
let connection = new KnxConnectionTunneling('192.168.2.222', 3671, '192.168.2.107', 13671);

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(() => connection.Disconnect(), 7000);
});

License

Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)

本站文章除注明转载外,均为本站原创或编译。欢迎任何形式的转载,但请务必注明出处。

转载请注明:文章转载自 JavaScript中文网 [https://www.javascriptcn.com]

本文地址:https://www.javascriptcn.com/read-65053.html

文章标题:knx.js

回到顶部