Subversion Repositories HomeAutomation

Rev

Rev 2296 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 2296 Rev 2298
Line 456... Line 456...
456
                                }
456
                                }
457
 
457
 
458
                                var timestamp = get_time();
458
                                var timestamp = get_time();
459
                                temp = temp-40.0;
459
                                temp = temp-40.0;
460
                                waterlevel = (crc*256 + humidity)*0.3;
460
                                waterlevel = (crc*256 + humidity)*0.3;
-
 
461
                                /* Using COUNTER as DS in rrdtool does only work if the data is integer,
-
 
462
                                   to work around this let's create a second variable with the water level
-
 
463
                                   multiplied with 10 and rounded to integer.
-
 
464
                                   Then when generating graph, the data must be divided by 10 */
-
 
465
                                var waterlevel10xInt = Math.round(waterlevel*10);
-
 
466
                               
461
                                last_value["Temperature_Celsius"] = { "value" : temp.toString(), "timestamp" : timestamp };
467
                                last_value["Temperature_Celsius"] = { "value" : temp.toString(), "timestamp" : timestamp };
462
                                last_value["WaterAbsolute_mm"] = { "value" : waterlevel.toString(), "timestamp" : timestamp };
468
                                last_value["WaterAbsolute_mm"] = { "value" : waterlevel.toString(), "timestamp" : timestamp };
-
 
469
                                last_value["WaterAbsolute10xInt_mm"] = { "value" : waterlevel10xInt.toString(), "timestamp" : timestamp };
463
 
470
 
464
                                Storage_SetParameter("LastValues", alias_name, JSON.stringify(last_value));
471
                                Storage_SetParameter("LastValues", alias_name, JSON.stringify(last_value));
465
                               
472
                               
466
                                break loopAliases;
473
                                break loopAliases;
467
                            }
474
                            }