Feature #99

Rrd for device with status On/Off

Added by mstranger 3 months ago. Updated 3 months ago.

Status:New Start date:02/14/2012
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:-
Target version:-
Resolution:

History

Updated by mstranger 3 months ago

I Need to graph Device with On/Off value but the rrd data contain U for non int value so i modified rrdtool.module in server and client like this :

PUBLIC SUB CreateUpdateValue(sValue AS String, sCorrection AS String, rDevice AS Result, sValueRRDsType AS String) AS String

  IF CheckNumber(sValue) = FALSE THEN
    IF Upper(sValue) = "ON" THEN
    RETURN 1
    ELSE IF Upper(sValue) = "OFF" THEN
    RETURN 0
    ELSE       
    RETURN "U" 
    ENDIF
  ELSE
    IF sValueRRDsType = "COUNTER" THEN
      RETURN Format(Devices.CorrectValue(sValue, sCorrection, rDevice), "#")
    ELSE
      RETURN CFloat(Devices.CorrectValue(Replace(sValue, ",", ".", gb.String), sCorrection, rDevice))
    ENDIF
  ENDIF

END

Updated by rdnzl 3 months ago

I added support for this to r832, also for motion/no motion and open/closed.
But please keep in mind that RRDtool isn't realtime updated, default only once every 5 mins, so you can miss events easily.
It's better to enable log to database, and do something with that data, in some way.. suggestions welcome.

Also available in: Atom PDF