hobbyquaker / binrpc Goto Github PK
View Code? Open in Web Editor NEWHomeMatic xmlrpc_bin:// protocol server and client
License: MIT License
HomeMatic xmlrpc_bin:// protocol server and client
License: MIT License
Line 414 in 1afb786
My iobroker hm-rpc adapter crashes on startup with BIN-RPc enabled. In fact it is a NPE in the line above and 'res' is null. Commenting out the logging fixed the problem and everything works like a charm.
I am using the iobroker HM-RPC adapter to connect to Homegear.
Further information here: http://forum.iobroker.net/viewtopic.php?p=115883#p115883
Hi,
I am using the test-snippet below to connect to my CCU2.
My goal is to receive events from window sensors (whenever they detect open or close).
The subscription seems work fine and I am also receving "listDevices" with my devices initially
after the subscription, but I do not receive any "event" or "system.multicall" calls.
My CCU2 is in version "2.31.25", I am using version 3.1.2 of this lib with Node.js 9.8.0.
I am pretty sure the lib is working fine and I am messing up somewhere, do I have to create any kind of links or mappings in the CCU2 to receive events from the devices?
Danke für Deine Hilfe :)
const thisHost = '192.168.1.2';
const rpcServer = rpc.createServer({host: thisHost, port: '2031'}); // Host running rpc server
const rpcClient = rpc.createClient({host: this.config.host, port: '2001'}); // CCU
rpcServer.on('system.listMethods', function (err, params, callback) {
console.log(' < system.listMethods');
callback(null, ['system.listMethods', 'system.multicall', 'event', 'listDevices', "newDevices", "deletedDevices"]);
});
rpcServer.on('NotFound', function (method, params) {
console.log("Notfound: " + method + " with " + params);
});
rpcServer.on('newDevices', function (err, params, callback) {
console.log("newDevices", params);
callback(null, '');
});
rpcServer.on('deletedDevices', function (err, params, callback) {
console.log("deletedDevices", params);
callback(null, '');
});
rpcServer.on('listDevices', function (err, params, callback) {
console.log("list devices");
callback(null, []);
});
rpcServer.on('event', function (err, params, callback) {
console.log(' < event', JSON.stringify(params));
callback(null, '');
});
rpcServer.on('system.multicall', function (err, params, callback) {
console.log(' < system.multicall', JSON.stringify(params));
const response = [];
params[0].forEach(function (call) {
console.log(' <', call.methodName, JSON.stringify(call.params));
response.push('');
});
callback(null, '');
});
function subscribe() {
console.log(' > ', 'init', ['xmlrpc_bin://' + thisHost + ':2031', 'rf2wired']);
rpcClient.methodCall('init', ['xmlrpc_bin://' + thisHost + ':2031', 'rf2wired'], function (err, res) {
console.log("init sub res", err, res);
});
}
process.on('SIGINT', function () {
unsubscribe();
});
function unsubscribe() {
console.log(' > ', 'init', ['xmlrpc_bin://' + thisHost + ':2031', '']);
rpcClient.methodCall('init', ['xmlrpc_bin://' + thisHost + ':2031', ''], function (err, res) {
console.log(err, res);
process.exit(0);
});
setTimeout(function () {
console.log('force quit');
process.exit(1);
}, 1000);
}
subscribe();
I created an issue in the hm-rpc repository but maybe it's caused by this library:
the package homematic-xmlrpc allows developers to provide a callback
function in it's constructor which then gets invoked when server is actually listening. (also available via factory)
I was wondering if anything speaks against implementing the same here as well... esp. since this package aims for being a drop-in replacement.
Happy to provide PR as well.
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.