msb-wmbus

0.1.16 • Public • Published

WMBUS

wm-bus for node.js

License

Example

var WMBUS = require('wm-bus').WMBUS;

var config = [
    { manufacturerId: '60092596', aesKey: '1212121212121212'},
    { manufacturerId: '60092599', aesKey: '3434343434343434'}
];

WMBUS.prototype.updateStates = function(){
    if (this.errorcode !== this.cc.ERR_NO_ERROR) {
        adapter.log.error("Error Code: " + this.errorcode + " " + this.errormsg);
        return;
    }
    console.log('name: ' + this.manufacturer + '-' + this.afield_id);
    console.log('encryptionMode: ' + this.encryptionMode);
    for (var i = 0; i < this.datablocks.length; i++) {
        var data = this.datablocks[i];
        console.log('  type: ' + data.type);
        for (var j in data) {
            switch (j) {
                //case 'type':
                case 'unit':
                case 'value':
                    //case 'extension':
                    //case 'functionFieldText':
                    if (data[i]) {
                        console.log('    ' + j + ': ' + data[i]);
                    }
            }
        }
    }
};

var wmbus = new WMBUS(); //(log: log function, formatDate: formatDate Function);

for (var i=0; i < config.length; i++) {
    var device = config[i];
    wmbus.addAESKey(device.manufacturerId, device.aesKey);
}

wmbus.parse('wmbus message');

Package Sidebar

Install

npm i msb-wmbus

Weekly Downloads

8

Version

0.1.16

License

MIT

Unpacked Size

9.16 MB

Total Files

12

Last publish

Collaborators

  • microservicebus