Offset Multisensor

Discussions about Z-Way software and Z-Wave technology in general
Mike Yeager
Posts: 160
Joined: 03 May 2014 07:02

Re: Offset Multisensor

Post by Mike Yeager »

Ok,
New version of TempF is up. Should now be "update" safe. I'm testing but my system doesn't issue the update command very often so if someone else could give me a hand...
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: Offset Multisensor

Post by pz1 »

Mike Yeager wrote:pz1,

Does arithmetic allow you to actually change the value of the sensor display???
The value of the arithmetic vDev does change, because it is called every minute. It would probably be better to let it update if any of the selected sensors has changed. Since I am not a programmer, I do not have the skills to fix that. Besides Arithmetic was just a toy for me to get some insight on how these modules work.
(Via my signature you can get at the sources without having to install my Apps)
Since 29-12-2016 I am no longer a moderator for this forum
Mike Yeager
Posts: 160
Joined: 03 May 2014 07:02

Re: Offset Multisensor

Post by Mike Yeager »

pz1,

And here I thought you were part of the ZWay development team. Setting it to only update when a sensor value changes is easy. Look at how TempF operates. It only runs when the sensor it's getting it's tempC reading from updates. On my system, that sensor updates every minute (it's supposed to, doesn't always do it but that's the sensor itself).

I wish I'd seen your module before I set out on writing my own. I could have saved myself a bit of time. Might not have learned as much though. I took the liberty of modifying it to update on sensor change instead of every minute. Here's the change you need to make:

this.controller.devices.on(self.config.sensor1, 'change:metrics:level', function() {
self.fetchEquation(self);
});
this.controller.devices.on(self.config.sensor2, 'change:metrics:level', function() {
self.fetchEquation(self);
});
// this.timer = setInterval(function () {
// self.fetchEquation(self);
// }, 60 * 1000); //every minute
// self.fetchEquation(self);

I left the original timer routine there so you'd see where to put the rest. Was going to upload it to you but the system wouldn't let me...
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: Offset Multisensor

Post by pz1 »

Mike Yeager wrote:pz1,
And here I thought you were part of the ZWay development team.
No I am happily retired
I wish I'd seen your module before I set out on writing my own.
It isn't really my own. I started with ZwaveMe's Openweather module that served me as a template.[/quote]
I took the liberty of modifying it to update on sensor change instead of every minute. Here's the change you need to make:

this.controller.devices.on(self.config.sensor1, 'change:metrics:level', function() {
self.fetchEquation(self);
});
this.controller.devices.on(self.config.sensor2, 'change:metrics:level', function() {
self.fetchEquation(self);
});
// this.timer = setInterval(function () {
// self.fetchEquation(self);
// }, 60 * 1000); //every minute
// self.fetchEquation(self);

I left the original timer routine there so you'd see where to put the rest. Was going to upload it to you but the system wouldn't let me...
Feel free to fork my code and improve it. My initial intent was it to be a teaser for more skilled people to take this further. Initially it had the more presumptuous name Mathematica ;)
Pieter

update1 Thanks for the code it seems to work well. I've updated github. App store later after I have fixed the selection of a constant next to a sensor
update2 I am in the process of adding the option where the user can supply one or more constants. I will add a linear calibration with offset like

Code: Select all

sensor1 * constant1 + constant2
where the constants will be signed reals.
Mike Yeager
Posts: 160
Joined: 03 May 2014 07:02

Re: Offset Multisensor

Post by Mike Yeager »

I thought about forking your code but I'm not that familiar with Github and it kept bouncing me back to my own site. I've been modifying quite a few of the stock modules, like DummyDevice, so that they have the cool icons and stuff like that. I keep all of that on Github so I don't lose it.
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: Offset Multisensor

Post by pz1 »

Osorkon wrote:
pz1 wrote:So in essence for you Aritmetic should have the option to select a "real" value instead of a sensor in the field for sensor b ?
Exactly
I have added a linear "calibration" function to module Arithmetic. You can find it here on my github. It is still experimental.
Mike Yeager
Posts: 160
Joined: 03 May 2014 07:02

Re: Offset Multisensor

Post by Mike Yeager »

I'll check it out next week. I got a bit done on my newest project but I'm away for the weekend.
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: Offset Multisensor

Post by pz1 »

pz1 wrote:I have added a linear "calibration" function to module Arithmetic. You can find it here on my github. It is still experimental.
I uploaded the extended module 1.0.4 (=added calibration function) to the online App store.
Mike Yeager
Posts: 160
Joined: 03 May 2014 07:02

Re: Offset Multisensor

Post by Mike Yeager »

Hopefully yours makes it to the store before mine. They've been reviewing for weeks... :-)
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: Offset Multisensor

Post by pz1 »

Mike Yeager wrote:Hopefully yours makes it to the store before mine. They've been reviewing for weeks... :-)
My update has been verified and accepted. Guess something has gone wrong for yours.
Post Reply