changeset 232:4e91f3ec460b

more round() workarounds for mismatching literals not patching themselves out Ignore-this: 9e173ff490ca2b4cea54ffad40beed49
author drewp@bigasterisk.com
date Thu, 28 Jan 2016 02:48:54 -0800
parents c89f88cbdcc6
children 4ebb5cc30002
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)