modified: temp-humid-read-loop.py

modified:   temp-humid-read-single.py
This commit is contained in:
Jonny Ervine
2015-06-24 10:12:48 +08:00
parent 6b4d6251eb
commit 5fd2fc3b9b
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -56,7 +56,7 @@ def sensorRead(hwtype, pin, retries, timeout, maxtemp, mintemp, tempdiff, maxhum
if t and h:
logging.debug('Temperature and humidity read as {0} and {1}'.format(t, h))
logging.debug('Temperature and Humidity differences allowed: {0} and {1}'.format(tempdiff, humiddiff))
if (oldtemp != "NULL") and ((t - oldtemp < tempdiff) or (oldtemp - t < tempdiff)) and ((h - oldhumid < humiddiff) or (oldhumid - h < humiddif)):
if (oldtemp != "NULL") and ((t - oldtemp < tempdiff) or (oldtemp - t < tempdiff)) and ((h - oldhumid < humiddiff) or (oldhumid - h < humiddiff)):
logging.debug('Current temperature close enough to previous temperature and previous temperature is not NULL, it is: %s', oldtemp)
logging.debug('Current humidity close enough to previous humidity and previous humidity is not NULL, it is: %s', oldhumid)
if (t < maxtemp) and (t > mintemp) and (h < maxhumid) and (h > minhumid):
+1 -1
View File
@@ -29,7 +29,7 @@ def sensorRead(hwtype, pin, retries, timeout, maxtemp, mintemp, tempdiff, maxhum
else:
if t and h:
logging.debug('The temperature and humidity have been read as {0} and {1}'.format(t, h))
if (oldtemp != "NULL") and ((t - oldtemp < tempdiff) or (oldtemp - t < tempdiff)) and ((h - oldhumid < humiddiff) or (oldhumid - h < humiddif)):
if (oldtemp != "NULL") and ((t - oldtemp < tempdiff) or (oldtemp - t < tempdiff)) and ((h - oldhumid < humiddiff) or (oldhumid - h < humiddiff)):
logging.debug('Current temperature close enough to previous temperature and previous temperature is not NULL, it is: %s', oldtemp)
logging.debug('Current humidity close enough to previous humidity and previous humidity is not NULL, it is: %s', oldhumid)
if (t < maxtemp) and (t > mintemp) and (h < maxhumid) and (h > minhumid):