andreek / node-eibd Goto Github PK
View Code? Open in Web Editor NEWnode.js eibd client (EIB/KNX daemon)
License: Other
node.js eibd client (EIB/KNX daemon)
License: Other
When I download the library and try to run the example-code provided in the Readme, I get:
(null):0
(null)
RangeError: Maximum call stack size exceeded
I'm using node 0.12.7
Not sure what I'm doing wrong, any pointers?
Looks like when introducing the --socket parameter into ./bin/ executables at least groupread got broken by checking for optional variable value
which is only used for socket-calls.
Thus, something like
node ./node_modules/eibd/bin/groupread somehost 6720 "1/4/2"
... will always fail, since the value-parameter is for sockets only.
Actually, value
is never set in the code so will always be undefined
.
I see that when I generate time/date (DPT10 and DPT11), if I activate the groupsocketlisten, the message is recognized as DPT1. The reason seems to be that the length read by the parser is 1:
var len = telegram.readUInt8(1);
I took a look at the code: it seems that the creator put 1 when not DPT1/2/3:
if(messageAction === 'read') {
//Read message no payload needed
data.writeUInt8(0, 1);
} else if(DPTType.indexOf('DPT1') === 0
|| DPTType.indexOf('DPT2') === 0
|| DPTType.indexOf('DPT3') === 0) {
//Small payload to or with action
data.writeUInt8(firstByte | payload.readUInt8(0) , 1);
} else {
console.log("*******+");
//Big payload to append
data.writeUInt8(firstByte,1);
data = Buffer.concat([data, payload]);
}
Is my analysis of the correct? If so, I can fix it (I need DPT10 / DPT11 :)).
Hi
I', trying to connect to HDL M/IPRT.1 knx router
It use 3671 port in ETS
my code is:
var eibd = require('eibd');
var opts = {
host: "192.168.10.41",
port: 3671
};
function groupsocketlisten(opts, callback) {
var conn = eibd.Connection();
conn.socketRemote(opts, function(err) {
if (err) {
// a fatal error occurred
console.log(err);
throw new Error("Cannot reach knxd or eibd service, please check installation and config.json");
}
conn.openGroupSocket(0, callback);
});
}
groupsocketlisten(opts, function(parser) {
parser.on('write', function(src, dest, dpt, val){
console.log('Write from '+src+' to '+dest+': '+val);
});
parser.on('response', function(src, dest, val) {
console.log('Response from '+src+' to '+dest+': '+val);
});
parser.on('read', function(src, dest) {
console.log('Read from '+src+' to '+dest);
});
});
Try 6720 and 3671 ports in node-eibd, but get this error:
{ [Error: connect ECONNREFUSED 192.168.10.41:3671]
code: 'ECONNREFUSED',
errno: 'ECONNREFUSED',
syscall: 'connect',
address: '192.168.10.41',
port: 3671 }
/home/roman/Project/knx.js:13
throw new Error("Cannot reach knxd or eibd service, please check installation and config.json");
^
Error: Cannot reach knxd or eibd service, please check installation and config.json
at Socket. (/home/roman/Project/knx.js:13:10)
at emitOne (events.js:82:20)
at Socket.emit (events.js:169:7)
at emitErrorNT (net.js:1253:8)
at nextTickCallbackWith2Args (node.js:442:9)
at process._tickCallback (node.js:356:17)
How to solvr this error?
TY
I'm trying to build a KNX listener with Node based on your framework.
Is it possible to reUp the documentation pdf in order to better understand node-eibd ?
Thank in advance
Louison
Hi !
Your module is very good... I can listen the bus and write/read on it. But How I do if I want to write a floating value... ?
var conn = eibd.Connection();
var address = eibd.str2addr('1/0/0');
conn.socketRemote({ host: host, port: port }, function() {
conn.openTGroup(address, 1, function (err) {
if(err) {
callback(err);
} else {
var data = new Array(3);
data[0] = 0;
data[1] = 0x80;
data[2] = (0xff & 20.5);
conn.sendAPDU(data, callback);
}
});
})
parser.on('read') => 20 ?
Thanks for your help !!
The lamp (test object) is off. I try to read its status group address.
I tried using the ETS5 and i receive the correct status (on or off) with DPT1.001 (DPT1).
When using this lib it always results in 0, but not 1 for on when the lamp is on.
Hi André,
have you tried the groupsocketlisten with the latest knxd? I cannot get any telegrams from the bus. Writing works as before, but no answers.
I had my house upgraded recently and all works, except groupsocketlisten from node-eibd.
BTW: I found the actual groupsocketlisten has a flaw - since the introduction of more err
objects the callbacks that do not use an err object might get mixed. openGroupSocket(readOnly, callback) expects the callback have a signature of function(parser), the callback used has a signature of function(err, parser). - I'll put an PR for that, but that doesn't seam to solve the issue.
Regards
Raoul
Refactoring code to prevent using buffer constructor.
I've made an assumption that every telegram is received in 'data' Event as one buffer with 9 or 10 Bytes.
On some machines it can happen that a knx telegram is received splitted in two (or more) chunks and 'data' Event for one telegram is executed multiple times. Node-eibd can't parse this buffer and throws seperated telegrams away.
We need a cache to control this flow.
Normal KNX Buffer
<Buffer 00 08 00 1b 00 00 02 01 00 00>
Example for splitted KNX Buffer
<Buffer 00 08>
<Buffer 00 1b 00 00 02 01 00 00>
The second byte of each buffer is the telegram length. node-eibd required the telegram length on second place of Buffer. Need to write a cache and go to parsing, if telegram length of bytes are received.
Hi andreek, really helpful module you wrote. Thanks a lot. The only thing i am missing or what would be nice in a next version is an encoder for given values to DPT Types. E.g encode(true,Types.DPT_1) or encode(222,DPT_5)
I am really looking forward to it!
Thanks for a great project!
I'm having trouble connecting to my KNX ABB Router. It has IP 192.168.0.100 and i think default port is 3671.
node groupread 192.168.0.100 3671 2/2/60 1
[ERROR]Error: connect ECONNREFUSED 192.168.0.100:3671
Any ideas? Have i missunderstood something?
Hi André,
the command line apps (which usually serve as great examples) have no error handlers for connection.openGroupSocket() and socketRemote(). If IP or port of knxd/eibd are wrong they fail with a cryptic error message.
I stumbled across that as I used that code in my homebridge-knx homekit integration, and users wondered what the strange error message:
(node) warning: possible EventEmitter memory leak detected. 11 data listeners added. Use emitter.setMaxListeners() to increase limit. was about. It should have shouted at them Set your IP and Port numbers for knxd/eibd right!
Do you consider putting an err
variable and an 'if' statement into it?
Regards
Raoul
when I execute "npm install eibd",it's display
`
[email protected] /usr/local/bin/node-v7.1.0-linux-armv7l/lib/node_moudles/npm
|___ [email protected]
`
This list of types needs to be implemented. Main feature for version 0.2.0.
Hi André,
I wanted to pool the writes to the bus in homebridge-knx, but I found that the knxd-Connection is closed after each outgoing data packet in
https://github.com/andreek/node-eibd/blob/master/lib/connection.js#L164
Is this mandatory/given by the protocol?
Thanks
Raoul
As you indicate in the readme the groupread function does not wait for an answer. Why is that and is there another way to recover the answer in the function's callback?
Have to refactoring to be able to parse more than one received telegram from buffer
Calling Connection.end() calls Parser.end(), which does not exist, causing an Exception:
TypeError: Object # has no method 'end'
at Connection.end (/opt/iobroker/adapter/knx/node_modules/eibd/lib/connection.js:57:17)
This is not exactly an "issue". I want to implement a KNX clock using node, I'm wondering if this is possible using node-eibd.
Indeed, excluding the ability of "programming" it through ETS, a timer simply generates at given intervals DPT 10 datatypes, so it should simply write "time"datagrams.
Has anyone an idea how these datagram should be created?
When I use ./bin/groupwrite 1/1/3 0
,it occur the question
`sudo ./groupwrite --socket /tmp/eib 1/1/3 0
/usr/bin/env: ‘node\r’: No such file or directory
`
but When I use ./bin/groupswrite 1/1/3 0
,it's ok;
I don't know how it occur.
Hello,
I have a thermostat which returns the humidity only in DPT14 (generic 4 bytes float). Is it long to implement this?
thanks.
Stefano.
Is it possible to read the exact dpt from a write? Like DPT9.001 instead of just DPT9.
Hello André,
I have been busy writing a parsing algorithm that can take any telegram (as far as known to ETS) and convert it into a interpretable JavaScript object. You might have a look at it, maybe it's worth integrating.
https://github.com/snowdd1/knx-dpt-parser
I have tried to build a simple bus monitor on top of node-eibd and knx-dpt-parser, and had to replicate some of your code to change it, because I needed the raw payload of the telegrams, which was not emitted. Of course one must know the DPTs of the destination group addresses, otherwise the differentiation between a percentage DPT5.001 and a HVAC mode 20.102 is not possible. To facilitate that, I have written a small parser that bring an ETS GroupAddress XML export (ETS5+) into a JavaScript Object Notation JSON file.
Regards
Raoul
Is it true that each telegram contains the DPT the value is encoded in? I have a hardware that sends telegram that I want to read in node-red (using a plugin that uses node-eibd). However, the value turns out being undefined/null and it claims the telegram is in DPT1 (when it should be DPT9 4 byte FP).
When I look in ETS5, the telegram does not have a DPT specified and the value is shown in raw format.
If it's true that DPT should be included in the telegram then the hardware doesn't seem to do the right thing. However, is there any way to work around that? Like specifying what DPT the value should be intepreted as?
Hi Andree and co.
I am trying to build a home automation system using node and eibd. However I am really struggling to implement eibd. Specifically could you demo how to make a simple groupswrite request to the knx bus via node and eibd? I have a working implementation of eibd running on my machine and I can commandline a functioning groupswrite request on the CLI. I just cant implement via node. Sorry this is such a noob question - but I am using the opportunity to build the system to learn node and the mean stack. Thank you for your work with eibd - it looks great (even better if i could use it!)
Thanks
Mark
i am trying to run groupsocketlisten see below but i get this RangeError.
I have run it before but i lost my "code", are you able to assist or is it all out-of-your-league because i read your comment on the enhancement request.
C:\node_modules.bin>groupsocketlisten 10.0.0.11 3671
buffer.js:176
this.length = +subject > 0 ? Math.ceil(subject) : 0;
^
RangeError: Maximum call stack size exceeded
C:\node_modules.bin>
Does it support DPT232 (RGB 3byte)?
Hi, has anybody tried this on macosx? what are the dependencies? thanks peter
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.