ctucx.git: smartied

[nimlang] smarthome server

commit 3628a20c097af535c784b0f4debed86e800a0c82
parent 62cd7210edeaeb400cefdcb2214d4f202fa5cb1f
Author: Leah (ctucx) <leah@ctu.cx>
Date: Thu, 18 Feb 2021 21:21:33 +0100

powermeter: add current to influxexport
1 file changed, 2 insertions(+), 0 deletions(-)
diff --git a/src/devices/modbusPowermeter.nim b/src/devices/modbusPowermeter.nim
@@ -6,6 +6,7 @@ proc updatePowermeter (key: string, device: DeviceConfig) {.async.} =
   let currentTimestamp = toUnix(getTime())
 
   let voltage   = (await mb.asyncReadFloat(deviceAddress, 0)).isaRound(2)
+  let current   = (await mb.asyncReadFloat(deviceAddress, 6)).isaRound(2)
   let frequency = (await mb.asyncReadFloat(deviceAddress, 70)).isaRound(2)
   let `import`  = (await mb.asyncReadFloat(deviceAddress, 72)).isaRound(3)
   let cosphi    = (await mb.asyncReadFloat(deviceAddress, 30)).isaRound(3)

@@ -24,6 +25,7 @@ proc updatePowermeter (key: string, device: DeviceConfig) {.async.} =
       tags["device"] = key
 
       fields["voltage"]   = $voltage
+      fields["current"]   = $current
       fields["frequency"] = $frequency
       fields["import"]    = $`import`
       fields["cosphi"]    = $cosphi