ctucx.git: smartied

[nimlang] smarthome server

commit 2f540e4a04b9ae36bd14c52d181f6e1e1055d090
parent 5f16dddda552f8b79c9488385ef82e553059164f
Author: Milan Pässler <me@pbb.lc>
Date: Fri, 13 Sep 2019 06:47:53 +0200

support sensors without humidity value
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/backend_lacrosse.nim b/src/backend_lacrosse.nim
@@ -22,7 +22,10 @@ proc lacrosseHandleLoop(sock: AsyncSocket) {.async.} =
         if device.id != msg.id:
           continue
 
-        server.state[key].humidity = msg.hum
+        if msg.hum == 106:
+          server.state[key].humidity = -1
+        else:
+          server.state[key].humidity = msg.hum
         server.state[key].temperature = msg.temp
         server.state[key].weakBattery = bool(msg.weakBatt)
         server.state[key].lastUpdated2 = toUnix(getTime())

@@ -30,7 +33,7 @@ proc lacrosseHandleLoop(sock: AsyncSocket) {.async.} =
         broadcast($(%*server.state))
     except:
       let e = getCurrentException()
-      echo("error while updating lacrosse: ", e.msg)
+      #echo("error while updating lacrosse: ", e.msg)
 
 proc lacrosseConnectLoop() {.async.} =
   while true: