Mercurial > code > home > repos > homeauto
changeset 1037:8d1a8a96e895
more round() workarounds for mismatching literals not patching themselves out
Ignore-this: 9e173ff490ca2b4cea54ffad40beed49
darcs-hash:7af87eaa585900fdbf1a004c3764798171caa28d
author | drewp <drewp@bigasterisk.com> |
---|---|
date | Thu, 28 Jan 2016 02:48:54 -0800 |
parents | 5f56a8c96458 |
children | ffe6a00c6cef |
files | service/piNode/devices.py |
diffstat | 1 files changed, 5 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/service/piNode/devices.py Thu Jan 28 02:48:18 2016 -0800 +++ b/service/piNode/devices.py Thu Jan 28 02:48:54 2016 -0800 @@ -206,13 +206,14 @@ stmts = set() if humid is not None: - stmts.add((self.uri, ROOM['humidity'], Literal(humid))) + stmts.add((self.uri, ROOM['humidity'], Literal(round(humid, 2)))) else: stmts.add((self.uri, RDFS['comment'], Literal('DHT read returned None'))) if tempC is not None: stmts.add((self.uri, ROOM['temperatureF'], - Literal(tempC * 9 / 5 + 32))) + # see round() note in arduinoNode/devices.py + Literal(round(tempC * 9 / 5 + 32, 2)))) else: stmts.add((self.uri, RDFS['comment'], Literal('DHT read returned None'))) @@ -253,7 +254,8 @@ try: tempF = sensor.get_temperature(sensor.DEGREES_F) stmts.append((sensor.uri, ROOM['temperatureF'], - Literal(tempF))) + # see round() note in arduinoNode/devices.py + Literal(round(tempF, 2)))) except w1thermsensor.core.SensorNotReadyError as e: log.warning(e)