GithubHelp home page GithubHelp logo

node-eibd's Introduction

eibd Build Status

A Node.js client for eib/knx daemon. Implements all functions of eibd client library needed for groupswrite/groupwrite, groupread and groupsocketlisten.

Install

npm install eibd

Test

npm test

Supported Datatypes

  • EIS 1 / DPT 1.xxx
  • EIS 2 / DPT 3.xxx
  • EIS 3 / DPT 10.xxx
  • EIS 4 / DPT 11.xxx
  • EIS 5 / DPT 9.xxx
  • EIS 6 / DPT 5.xxx
  • EIS 8 / DPT 2.xxx
  • EIS 9 / DPT 14.xxx
  • EIS 10.000 / DPT 7.xxx
  • EIS 10.001 / DPT 8.xxx
  • EIS 11 / DPT 12.xxx
  • EIS 11.001 / DPT 3.xxx
  • EIS 13 / DPT 4.xxx
  • EIS 14 / DPT 6.xxx
  • EIS 15 / DPT 16.xxx
  • DPT232

CLI Usage

View source code of cli tools as examples for usage.

groupwrite

./bin/groupwrite host port x/x/x 0..255

e.g. ./bin/groupwrite localhost 6270 1/2/3 100

./bin/groupwrite --socket path x/x/x 0..255

e.g. ./bin/groupwrite --socket /run/knx 1/2/3 100

groupswrite

./bin/groupswrite host port x/x/x 0..1

e.g. ./bin/groupswrite localhost 6270 1/2/4 1

./bin/groupswrite --socket path x/x/x 0..1

e.g. ./bin/grouspwrite --socket /run/knx 1/2/4 1

groupread

(issues a read request telegram to the bus, does not wait for an answer!)

./bin/groupread host port x/x/x

e.g. ./bin/groupread localhost 6270 1/2/4

./bin/groupread --socket path x/x/x

e.g. ./bin/groupread --socket /run/knx 1/2/4

Listening for group telegrams

./bin/groupsocketlisten host port

./bin/groupsocketlisten --socket path

Related projects

eibd documentation

node-eibd's People

Contributors

3sv avatar andreek avatar anlumo avatar cjk avatar ctr49 avatar dependabot[bot] avatar elasticroentgen avatar marcopiraccini avatar moty66 avatar snowdd1 avatar stasee avatar ste99 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-eibd's Issues

More use examples please!

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

/usr/bin/env: ‘node\r’: No such file or directory

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.

DPT14 for thermostat

Hello,

I have a thermostat which returns the humidity only in DPT14 (generic 4 bytes float). Is it long to implement this?

thanks.
Stefano.

trouble getting groupread response

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?

Wrong lenght using DPT10/11

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 :)).

[Enhancement] Use a generic telegram decoder to be able to parse all telegrams

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

Encoding values to dpt types

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!

Missing DPT in telegram

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?

DPT232

Does it support DPT232 (RGB 3byte)?

Documentation link dead

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

Support more dpt / eis types

This list of types needs to be implemented. Main feature for version 0.2.0.

  • DPT2, EIS 8
  • DPT3, EIS 2
  • DPT4, EIS 13
  • DPT6, EIS 14.000
  • DPT7, EIS 10.000
  • DPT8, EIS 10.001
  • DPT10, EIS 3
  • DPT11, EIS 4
  • DPT12, EIS 11.000
  • DPT13, EIS 11.001
  • DPT14, EIS 9
  • DPT16 EIS 15

groupsocketlisten with conn_sep branch of knxd

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

knx connection

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

RangeError (buffer.js)

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>

16 bit group addresses

Hi all,
I just found out that address translations in lib/tools.js support 31/7/255 in line 22 but only 15/7/255 in line 38 - is that a glitch or was that done on purpose?

Once the address is using 0xf and once 0x1f.

Best regards
Raoul

Error when running example code

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?

command line apps have no error handlers

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

groupread executable broken for non-socket reads

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.

KNX "software" devices

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?

KNX telegram buffer received in two or more chunks

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.

Cannot connect

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?

Write a floating value

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 !!

macosx

Hi, has anybody tried this on macosx? what are the dependencies? thanks peter

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.