ctucx.git: smartied

[nimlang] smarthome server

commit a313dc1e73650c6048179f9bd025ce5aec6bec20
parent d7ce0e11ee0ab25cd14f752aa98e715e41283c2d
Author: ctucx <ctucx@git.ctu.cx>
Date: Sun, 19 Jan 2020 18:48:15 +0000

„src/frontend_prometheus.nim“ ändern
1 file changed, 8 insertions(+), 8 deletions(-)
M
src/frontend_prometheus.nim
|
16
++++++++--------
diff --git a/src/frontend_prometheus.nim b/src/frontend_prometheus.nim
@@ -28,20 +28,20 @@ proc processPrometheusClient(req: Request) {.async,gcsafe.} =
       var resp = ""
       for key, device in server.config.devices.pairs():
         if device.type == PowerMeter:
-          resp.addVal("powermeter_import", key, $(server.state[key].import), $(server.state[key].lastUpdated))
-          resp.addVal("powermeter_cosphi", key, $(server.state[key].cosphi), $(server.state[key].lastUpdated))
-          resp.addVal("powermeter_power", key, $(server.state[key].power), $(server.state[key].lastUpdated))
-          resp.addVal("powermeter_frequency", key, $(server.state[key].frequency), $(server.state[key].lastUpdated))
-          resp.addVal("powermeter_voltage", key, $(server.state[key].voltage), $(server.state[key].lastUpdated))
+          resp.addVal("powermeter_import", key, $(server.state[key].import), $(server.state[key].lastUpdated * 1000))
+          resp.addVal("powermeter_cosphi", key, $(server.state[key].cosphi), $(server.state[key].lastUpdated * 1000))
+          resp.addVal("powermeter_power", key, $(server.state[key].power), $(server.state[key].lastUpdated * 1000))
+          resp.addVal("powermeter_frequency", key, $(server.state[key].frequency), $(server.state[key].lastUpdated * 1000))
+          resp.addVal("powermeter_voltage", key, $(server.state[key].voltage), $(server.state[key].lastUpdated * 1000))
 
         if device.type == RelayBoard:
           for i, val in server.state[key].relays:
             resp.addVal("relayboard_relay", key & "\",relay=\"" & $(i), fmtBool(val), "")
 
         if device.type == LacrosseTempSensor:
-          resp.addVal("lacrossetempsensor_temperature", key, $(server.state[key].temperature), $(server.state[key].lastUpdated2))
-          resp.addVal("lacrossetempsensor_humidity", key, $(server.state[key].humidity), $(server.state[key].lastUpdated2))
-          resp.addVal("lacrossetempsensor_weakbattery", key, fmtBool(server.state[key].weakBattery), $(server.state[key].lastUpdated2))
+          resp.addVal("lacrossetempsensor_temperature", key, $(server.state[key].temperature), $(server.state[key].lastUpdated2 * 1000))
+          resp.addVal("lacrossetempsensor_humidity", key, $(server.state[key].humidity), $(server.state[key].lastUpdated2 * 1000))
+          resp.addVal("lacrossetempsensor_weakbattery", key, fmtBool(server.state[key].weakBattery), $(server.state[key]. * 1000))
 
       await req.respond(Http200, resp)
     else: