comparison py/sensor_ds18b20.py @ 287:97d99eb42d27 py3client

temp == 0 is a problem
author Matt Johnston <matt@ucc.asn.au>
date Wed, 26 Jun 2019 22:52:03 +0800
parents 20c89630be6c
children
comparison
equal deleted inserted replaced
285:9e2181e3ce6d 287:97d99eb42d27
60 match = self.THERM_RE.match(contents) 60 match = self.THERM_RE.match(contents)
61 if match is None: 61 if match is None:
62 D("no match") 62 D("no match")
63 return None 63 return None
64 temp = int(match.groups(1)[0]) / 1000.0 64 temp = int(match.groups(1)[0]) / 1000.0
65 if temp > 80: 65 if temp > 80 or temp == 0:
66 E("Problem reading sensor '%s': %f" % (s, temp)) 66 E("Problem reading sensor '%s': %f" % (s, temp))
67 return None 67 return None
68 return temp 68 return temp
69 except Exception as e: 69 except Exception as e:
70 EX("Problem reading sensor '%s': %s" % (s, str(e))) 70 EX("Problem reading sensor '%s': %s" % (s, str(e)))