Statistics

Discussions about RaZberry - Z-Wave board for Raspberry computer
Post Reply
SirLouen
Posts: 2
Joined: 28 Feb 2014 04:34

Statistics

Post by SirLouen »

I have a Fibaro Wall Plug connected to my Z-Way.
It reports the power consumption every 5 seconds
I would like to store the info every 5 seconds in a database or something in order to make some graphs and to know average consumption for a 24 hour period
Maybe there is something already done?
ollfa
Posts: 31
Joined: 12 Jul 2013 11:36

Re: Statistics

Post by ollfa »

You can create a module which does exactly this. I made one a while ago it works but I don´t know if its the right way to do it. This is part of my index.js code.


function MySql (id, controller) {
MySql.super_.call(this, id, controller);
this.eventLog = {};
}

// Module inheritance and setup

_module = MySql;
inherits(MySql, AutomationModule);

// Module methods
MySql.prototype.init = function (config) {
MySql.super_.prototype.init.call(this, config);

var self = this;
this.controller.eventlog = {};
this.controller.onAny(function () {
var newArgs = get_values(arguments);
newArgs.unshift(this.event);
self.logEventMysql.apply(self, newArgs);
});
};


MySql.prototype.logEventsMySql = function(){

//Log events here.

}
SirLouen
Posts: 2
Joined: 28 Feb 2014 04:34

Re: Statistics

Post by SirLouen »

Can u send me the whole code ? im not into js :(
Regards
User avatar
PoltoS
Posts: 7579
Joined: 26 Jan 2011 19:36

Re: Statistics

Post by PoltoS »

@ollfa:

Nice to see you using modules. You can make your module more "universal", add confgurable parameters and propose it as pull request on github. Or we can add it ourself if yousend it to us.
gabrielb
Posts: 13
Joined: 17 Dec 2015 23:45
Location: Sweden

Re: Statistics

Post by gabrielb »

Whats the status for this MySql thing. Did it become a module?
Post Reply