Razberry app that I received made work no more.
Unable to load data error box
App does not exists or has no valid parameters
How can get downgraded or is it something new site version that makes my app does not work more?
Code: Select all
function ElMeterLogging (id, controller) {
// Call superconstructor first (AutomationModule)
ElMeterLogging.super_.call(this, id, controller);
};
inherits(ElMeterLogging, AutomationModule);
_module = ElMeterLogging;
ElMeterLogging.prototype.init = function (config) {
// Call superclass' init (this will process config argument and so on)
ElMeterLogging.super_.prototype.init.call(this, config);
// Remember "this" for detached callbacks (such as event listener callbacks)
var self = this;
// Here we assume that period is factor of minute and less than hour, or factor of hours and less than day, or factor of days
var p = Math.round(this.config.period);
var m = (p < 60) ? [0, 59, p] : 0;
var h = p >= 24*60 ? 0 : (p/60 >=1 ? [0, 59, Math.round(p/60)] : null);
var wd = p/24/60 >=1 ? [0, 6, Math.round(p/24/60)] : null;
if (this.config.deviceid !== 0 )
{
var deviceid = parseInt(this.config.deviceid,10);
}
else {
console.log ("ERROR: ElMeterLogging Device Id not correct");
}
if (this.config.devinstance >= 0 )
{
var devinstance = parseInt(this.config.devinstance,10);
}
else {
console.log ("ERROR: ElMeterLogging Device Instance not correct");
}
if (this.config.devcommandclass !== 0 )
{
var devcommandclass = parseInt(this.config.devcommandclass,10);
}
else {
console.log ("ERROR: ElMeterLogging Device Id not correct");
}
this.controller.emit("cron.addTask", "ElMeterLogging.poll", {
minute: m,
hour: h,
weekDay: wd,
day: null,
month: null
});
this.onPoll = function () {
//CurrentDataGet(1) gets only first parameter. This should be bitmask, see table at end of PDF,
// but it doesn't works. To get all params, use CurrentDataGet();
zway.devices[deviceid].instances[devinstance].commandClasses[devcommandclass].CurrentDataGet();
};
// Setup metric update event listener
this.controller.on('ElMeterLogging.poll', this.onPoll);
this.bindFunc = function(zwayName) {
if (zwayName != "zway") return; // you want to bind to default zway instance
var devices = global.ZWave[zwayName].zway.devices;
devices[deviceid].instances[devinstance].commandClasses[devcommandclass].data[1].val.bind(function() {
// debugPrint("Power " + this.value + " " +this.updateTime);
system("php /opt/z-way-server/automation/modules/ElMeterLogging/savedb.php " + this.value + " " + this.updateTime);
});
//Instantaneous Primary Active Power (kW) ,Current power consumption.
devices[deviceid].instances[devinstance].commandClasses[devcommandclass].data[5].val.bind(function() {
// debugPrint("Instant " + this.value + " " +this.updateTime);
system("php /opt/z-way-server/automation/modules/ElMeterLogging/savedb.php " + this.value + " " + this.updateTime + " instantkw");
});
};
global.controller.on("ZWave.register", this.bindFunc);
};
ElMeterLogging.prototype.stop = function () {
SensorValueLogging.super_.prototype.stop.call(this);
this.controller.off('ElMeterLogging.poll', this.onPoll);
};