From 260ddc14ffc9ae937f322f0acbe3f4cf3e61e374 Mon Sep 17 00:00:00 2001 From: Mitchell Date: Fri, 4 Mar 2016 00:34:29 -0600 Subject: [PATCH] updated message on sensor page - removed humidity readings if null --- public/javascript/sensor_information.js | 7 ++++++- views/sensors.ejs | 4 +--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/public/javascript/sensor_information.js b/public/javascript/sensor_information.js index 217a764..68cc537 100644 --- a/public/javascript/sensor_information.js +++ b/public/javascript/sensor_information.js @@ -114,7 +114,12 @@ function displayChart(chart_id, chart_legend_id, year, month){ data.datasets[0].data.push(json[i].max); data.datasets[1].data.push(json[i].min); - data.datasets[2].data.push(Math.ceil(json[i].humidity)); + + //add humidity to chart if it is not null in the database query + if (json[i].humidity != null){ + data.datasets[2].data.push(Math.ceil(json[i].humidity)); + } + } // Get context with jQuery - using jQuery's .get() method. diff --git a/views/sensors.ejs b/views/sensors.ejs index 4d00edd..18b5444 100644 --- a/views/sensors.ejs +++ b/views/sensors.ejs @@ -15,9 +15,7 @@

ESP8266 Temperature Sensors

-

Note: I am still experimenting with these sensors. It seems that the sensors will have a bad reading every once in while. -For example the low every day for the Grand Meadow sensor is 33.8. From observing the data, it randomly jumps to 33.8 one out of about every few hundred readings or so. -I will continue to investigate this problem when I can get my hands on the sensor as it is currently in my home town. +

Note: I am using a DHT11 analog sensor for both temperature and humidity readings. I am also using a DS18B20 digital sensor, which only takes temperature readings. The digital sensor seems to get more accurate readings. Some of the data may be inconsistent as this is an experimental process.