var ds18b20 = require('../services/ds18b20.js');
var logger = require('../services/logger.js');
var _ = require('lodash');

var sensors;
var config;

var init = function (cfg) {
    config = cfg || {};

    sensors = _.filter(config.sensors, function (sensor) {
        return sensor.isActive;
    });

    logger.init(config);
};

var run = function () {
    if (!config) {
        console.log('MONITOR', 'No configuration present');
        return;
    }

    sensors.forEach(function (sensor) {
        if (sensor.type == 'temperature') {
            ds18b20.read(sensor)
                .then(function (result) {
                    logger.log('MONITOR\tREADING\t' + result.sensor.displayName + '\t' + result.reading.F + '°F');

                    if (result.sensor.allowedRange) {
                        if (result.reading.F < result.sensor.allowedRange.low || result.reading.F > result.sensor.allowedRange.high) {
                            logger.warn(result.sensor.displayName + ' is out of allowed range: ' + result.reading.F + '°F');
                        }
                    }
                })
                .catch(function (error) {
                    logger.error('MONITOR\tERROR\t' + error);
                });
        }
    });
};

exports.init = init;
exports.run = run;
@@ -200,108 +200,8 @@
 %7D;%0A%0A
-    sensors = _.filter(config.sensors, function (sensor) %7B%0A        return sensor.isActive;%0A    %7D);%0A%0A
     
@@ -221,16 +221,16 @@
 onfig);%0A
+
 %7D;%0A%0Avar 
@@ -355,16 +355,23 @@
  %7D%0A%0A    
+config.
 sensors.
@@ -394,24 +394,63 @@
  (sensor) %7B%0A
+        if (!sensor.isActive) return;%0A%0A
         if (
@@ -653,32 +653,43 @@
 result.reading.F
+.toFixed(2)
  + '%C2%B0F');%0A%0A     
@@ -868,24 +868,24 @@
 nge.high) %7B%0A
-
             
@@ -987,16 +987,27 @@
 eading.F
+.toFixed(2)
  + '%C2%B0F')

Move filter and set fixed precision