hobbyquaker / cul Goto Github PK
View Code? Open in Web Editor NEWnodejs module to interact with busware cul / culfw
License: GNU General Public License v2.0
nodejs module to interact with busware cul / culfw
License: GNU General Public License v2.0
I used the sample code from the readme and adapted it a bit, but I don't get an answer and the ready event isn't fired.
var Cul = require('cul');
var cul = new Cul({
serialport: '/dev/ttyACM0',
mode: 'AskSin'
});
cul.on('close', function () {
console.log('serial connection closed');
});
cul.on('ready', function () {
console.log('ready');
cul.write('V');
});
cul.on('data', function (raw) {
console.log(raw);
});
console.log('all events registered');
It only outputs all events registered
.
node version: v0.10.29
Hi,
I have a strange error with the CUL Adapter with a flashed MAX! Cube as CUNO.
My window switches are found correctly but if I want to pair a MAX Radiator Thermostat basic, I got an error and the MAX Cube restarts.
Error:
MAX! Radiator Thermostat basic
cul.0 | 2018-07-16 20:36:54.377 | error | } |
---|---|---|---|
cul.0 | 2018-07-16 20:36:54.377 | error | } |
cul.0 | 2018-07-16 20:36:54.377 | error | } |
cul.0 | 2018-07-16 20:36:54.377 | error | return prop; |
cul.0 | 2018-07-16 20:36:54.377 | error | if (this[prop] === value) |
cul.0 | 2018-07-16 20:36:54.377 | error | if (this.hasOwnProperty(prop)) { |
cul.0 | 2018-07-16 20:36:54.377 | error | for (var prop in this) { |
cul.0 | 2018-07-16 20:36:54.377 | error | at TCP.onread (net.js:559:20) getKeyByValue=function (value) { |
cul.0 | 2018-07-16 20:36:54.377 | error | at Socket.Readable.push (_stream_readable.js:134:10) |
cul.0 | 2018-07-16 20:36:54.377 | error | at readableAddChunk (_stream_readable.js:176:18) |
cul.0 | 2018-07-16 20:36:54.377 | error | at Socket.emit (events.js:188:7) |
cul.0 | 2018-07-16 20:36:54.377 | error | at emitOne (events.js:96:13) |
cul.0 | 2018-07-16 20:36:54.377 | error | at Socket.telnet.on.data (/opt/iobroker/node_modules/iobroker.cul/node_modules/cul/cul.js:218:17) |
cul.0 | 2018-07-16 20:36:54.377 | error | at parse (/opt/iobroker/node_modules/iobroker.cul/node_modules/cul/cul.js:297:43) |
cul.0 | 2018-07-16 20:36:54.377 | error | at Object.module.exports.parse (/opt/iobroker/node_modules/iobroker.cul/node_modules/cul/lib/moritz.js:183:50) |
cul.0 | 2018-07-16 20:36:54.377 | error | TypeError: Cannot read property 'type' of undefined |
cul.0 | 2018-07-16 20:36:54.377 | error | } |
cul.0 | 2018-07-16 20:36:54.377 | error | } |
cul.0 | 2018-07-16 20:36:54.377 | error | } |
And every few seconds this appears in the LOG:
cul.0 | 2018-07-16 20:36:41.034 | info | } |
---|---|---|---|
cul.0 | 2018-07-16 20:36:41.034 | info | } |
cul.0 | 2018-07-16 20:36:41.034 | info | } |
cul.0 | 2018-07-16 20:36:41.034 | info | return prop; |
cul.0 | 2018-07-16 20:36:41.034 | info | if (this[prop] === value) |
cul.0 | 2018-07-16 20:36:41.034 | info | if (this.hasOwnProperty(prop)) { |
cul.0 | 2018-07-16 20:36:41.034 | info | for (var prop in this) { |
cul.0 | 2018-07-16 20:36:41.034 | info | -> getKeyByValue=function (value) { |
cul.0 | 2018-07-16 20:36:41.034 | info | } |
cul.0 | 2018-07-16 20:36:41.034 | info | } |
cul.0 | 2018-07-16 20:36:41.034 | info | } |
when installing cul dependency the serialport lib will be translated. I get compile errors with serialport module 1.4.10:
`> [email protected] install /usr/local/lib/node_modules/serialport
> node-pre-gyp install --fallback-to-build
make: Entering directory '/usr/local/lib/node_modules/serialport/build'
CXX(target) Release/obj.target/serialport/src/serialport.o
In file included from ../src/serialport.h:5:0,
from ../src/serialport.cpp:3:
../node_modules/nan/nan.h:261:25: error: redefinition of ‘template<class T> v8::Local<T> _NanEnsureLocal(v8::Local<T>)’
NAN_INLINE v8::Local<T> _NanEnsureLocal(v8::Local<T> val) {
^
../node_modules/nan/nan.h:256:25: note: ‘template<class T> v8::Local<T> _NanEnsureLocal(v8::Handle<T>)’ previously declared here
NAN_INLINE v8::Local<T> _NanEnsureLocal(v8::Handle<T> val) {
^
../node_modules/nan/nan.h:661:13: error: ‘node::smalloc’ has not been declared
, node::smalloc::FreeCallback callback
^
../node_modules/nan/nan.h:661:35: error: expected ‘,’ or ‘...’ before ‘callback’
, node::smalloc::FreeCallback callback
^
../node_modules/nan/nan.h: In function ‘v8::Local<v8::Object> NanNewBufferHandle(char*, size_t, int)’:
../node_modules/nan/nan.h:665:50: error: ‘callback’ was not declared in this scope
v8::Isolate::GetCurrent(), data, length, callback, hint);
^
../node_modules/nan/nan.h:665:60: error: ‘hint’ was not declared in this scope
v8::Isolate::GetCurrent(), data, length, callback, hint);
^
../node_modules/nan/nan.h: In function ‘v8::Local<v8::Object> NanNewBufferHandle(const char*, uint32_t)’:
../node_modules/nan/nan.h:672:67: error: call of overloaded ‘New(v8::Isolate*, const char*&, uint32_t&)’ is ambiguous
return node::Buffer::New(v8::Isolate::GetCurrent(), data, size);
^
../node_modules/nan/nan.h:672:67: note: candidates are:
In file included from ../node_modules/nan/nan.h:25:0,
from ../src/serialport.h:5,
from ../src/serialport.cpp:3:
/root/.node-gyp/4.2.1/include/node/node_buffer.h:31:40: note: v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate*, v8::Local<v8::String>, node::encoding) <near match>
NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
^
/root/.node-gyp/4.2.1/include/node/node_buffer.h:31:40: note: no known conversion for argument 3 from ‘uint32_t {aka unsigned int}’ to ‘node::encoding’
/root/.node-gyp/4.2.1/include/node/node_buffer.h:43:40: note: v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate*, char*, size_t) <near match>
NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
^
/root/.node-gyp/4.2.1/include/node/node_buffer.h:43:40: note: no known conversion for argument 2 from ‘const char*’ to ‘char*’
In file included from ../src/serialport.h:5:0,
from ../src/serialport.cpp:3:
../node_modules/nan/nan.h: In function ‘v8::Local<v8::Object> NanNewBufferHandle(uint32_t)’:
../node_modules/nan/nan.h:676:61: error: could not convert ‘node::Buffer::New(v8::Isolate::GetCurrent(), size)’ from ‘v8::MaybeLocal<v8::Object>’ to ‘v8::Local<v8::Object>’
return node::Buffer::New(v8::Isolate::GetCurrent(), size);
^
../node_modules/nan/nan.h: In function ‘v8::Local<v8::Object> NanBufferUse(char*, uint32_t)’:
../node_modules/nan/nan.h:683:12: error: ‘Use’ is not a member of ‘node::Buffer’
return node::Buffer::Use(v8::Isolate::GetCurrent(), data, size);
^
serialport.target.mk:90: recipe for target 'Release/obj.target/serialport/src/serialport.o' failed
make: *** [Release/obj.target/serialport/src/serialport.o] Error 1
make: Leaving directory '/usr/local/lib/node_modules/serialport/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:270:23)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 3.18.0-trunk-rpi2
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/usr/local/lib/node_modules/serialport/build/serialport/v1.7.4/Release/node-v46-linux-arm/serialport.node" "--module_name=serialport" "--module_path=/usr/local/lib/node_modules/serialport/build/serialport/v1.7.4/Release/node-v46-linux-arm"
gyp ERR! cwd /usr/local/lib/node_modules/serialport
gyp ERR! node -v v4.2.1
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/usr/local/lib/node_modules/serialport/build/serialport/v1.7.4/Release/node-v46-linux-arm/serialport.node --module_name=serialport --module_path=/usr/local/lib/node_modules/serialport/build/serialport/v1.7.4/Release/node-v46-linux-arm' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/serialport/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at emitTwo (events.js:87:13)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:172:7)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:818:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
node-pre-gyp ERR! System Linux 3.18.0-trunk-rpi2
node-pre-gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/serialport/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /usr/local/lib/node_modules/serialport
node-pre-gyp ERR! node -v v4.2.1
node-pre-gyp ERR! node-pre-gyp -v v0.6.7
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/usr/local/lib/node_modules/serialport/build/serialport/v1.7.4/Release/node-v46-linux-arm/serialport.node --module_name=serialport --module_path=/usr/local/lib/node_modules/serialport/build/serialport/v1.7.4/Release/node-v46-linux-arm' (1)
npm ERR! Linux 3.18.0-trunk-rpi2
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "--unsafe-perm" "[email protected]"
npm ERR! node v4.2.1
npm ERR! npm v2.14.7
npm ERR! code ELIFECYCLE
npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-pre-gyp install --fallback-to-build'.
npm ERR! This is most likely a problem with the serialport package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-pre-gyp install --fallback-to-build
npm ERR! You can get their info via:
npm ERR! npm owner ls serialport
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /root/npm-debug.log
`
Hi,
with 0.5.0 you removed nodejs 4.x support. For ioBroker I had the idea to update to 0.5 of the lib for the ioBroker.cul adapter, but loosing nodejs 4 is hard.
You can bring back nodejs 4 support by simply using sctrict mode (add "'use strict';" to all fixes on top). Then you get back nodejs 4: https://travis-ci.org/Apollon77/cul/builds/332285922
But I needed to remove the "xo" checks because it seems that they get "harder" when files are in strict mode (e.g. https://travis-ci.org/Apollon77/cul/jobs/332284580) ... wanted to clarify it first before bringing in an PR :-)
What do you think?
Hi
Is there an option to associate a wall mounted thermostat with a heatint thermostat like in fhem ?
thx
regards
Chris
I would love to find support for stacked CUL's/CUNO's here.
I have here for example a MAX!cube with a-culfw (CUBEx4_BL.bin) and 2 additional transmitters that communicates over lan with just one port (stacked).
In general it would just demand to add "*" to the raw command and detect and remove them from the reply.
Can we somehow get compatibility with node.js 16 or 18?
I use node-red-contrib-cul and when starting node-red everything looks fine, but commands are actually not sent to the device.
Great work!
I'm currently using FHEM as gateway from EIB/KNX to InterTechno (via CUL433) and from EnOcean (via EUL), however I plan to switch to Node-Red as logic engine (and as result also as gateway replacement). Do you plan to also provide a node-red wrapper for cul.js?
Pairing with Max! Thermostats seems to be unsupported. Is this feature planned?
thank you!
Hey Sebastian,
I have checked a bit. "Complete" testing for CUL-Net is kind of easy. Setup Net-Server and communication can be handled from both sides.
For serial it is more interesting:
One option is to use the Mock-Features from Serialport ... but as I tested for this we need access to the serialport instance of the cul instance ... because of strict mode and such it is not accessible directly, it would be needed to add some kind of "getSerialport" method ... for testing only ... not great :-(
But only alternative I found would be some kind of virtual serialports using socat or something like this. But this would be needed to be installed and started anytime tests are executed. Not very comfortable
What do you think about the options ?! ;-)
The messages of KS300 are nearly the same as S300TH + rain and wind info:
https://github.com/mhop/fhem-mirror/blob/master/fhem/FHEM/13_KS300.pm
Please add support for KS300TH...
options.initCmd = 0x01;
^
TypeError: Cannot set property 'initCmd' of undefined
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.