Node metrics previous value

Started by mario.almeida, March 25, 2017, 01:21:52 PM

mario.almeida

Hi All,

Can any one here tell me how to get the node metrics previous value?
I have configure REEDSWITCH which update the door status if open and close.
open : { name:'Status', regexp:/(?:STS\:)?(OPN|OPEN)\b/i, value:'OPEN', pin:1, graph:1, logValue:2, graphOptions:{ legendLbl:'Garage door events', yaxis: {ticks:0}, colors:['#4a0'], /*lines: { lineWidth:1 }*/}},
closed : { name:'Status', regexp:/(?:STS\:)?(CLS|CLOSED)/i, value:'CLOSED', pin:1, graphValPrefix:' Door: ', graph:1, logValue:0 },
and accordingly take action to TOGGLE SwitchMote ON/OFF.

I need to check the previous REEDSWITCH status.
eg:-
If the current status of the door is opened, the previous status should return closed and vice versa

Felix

You can't get a previous value directly from the node. It only holds the latest value. Everything else is logged (if enabled) in the individual binary files for each node-metric.
You could write an extension to save the previous value and move the current value to that when a new value comes in .. but then someone might come and want the value before the previous value .. hence something like this was not implemented.