From 3e1bc11f6e0bd8420d0f660a44944a0d85293005 Mon Sep 17 00:00:00 2001 From: Sam Stenvall Date: Sat, 17 Feb 2024 19:39:01 +0200 Subject: [PATCH] Publish apparent power and power factor to InfluxDB Fixes #45 --- src/publisher/influxdb.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/publisher/influxdb.ts b/src/publisher/influxdb.ts index 64d7ae2..19681b6 100644 --- a/src/publisher/influxdb.ts +++ b/src/publisher/influxdb.ts @@ -42,6 +42,15 @@ export class InfluxDBPublisherImpl implements PublisherImpl { .floatField('power', data.power) .timestamp(data.timestamp) + // Optional data + if (data.apparentPower) { + power.floatField('apparentPower', data.apparentPower) + } + + if (data.powerFactor) { + power.floatField('powerFactor', data.powerFactor) + } + // Optional tags if (data.circuit.group) { power.tag('group', data.circuit.group)