Giter Club home page Giter Club logo

binrpc's People

Contributors

angelnu avatar apollon77 avatar benkroeger avatar hobbyquaker avatar mik- avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

binrpc's Issues

Adapter Startup-Crash with 'res' being null here

console.log('<-- binrpc error: unknow data type ' + res.dataType.toString(16) + ' :(');

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

No events from CCU2

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();

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.