From 2ed9d18c90062934c88763fb44056a230da6ac8b Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Fri, 25 Jun 2021 13:43:40 +0200 Subject: [PATCH] Rework smartmeter interfaces --- libnymea/interfaces/energymeter.json | 81 +++++++++++++++++++ .../extendedsmartmeterconsumer.json | 12 --- libnymea/interfaces/interfaces.qrc | 5 +- libnymea/interfaces/smartmeter.json | 2 +- libnymea/interfaces/smartmeterconsumer.json | 9 ++- libnymea/interfaces/smartmeterproducer.json | 12 ++- 6 files changed, 102 insertions(+), 19 deletions(-) create mode 100644 libnymea/interfaces/energymeter.json delete mode 100644 libnymea/interfaces/extendedsmartmeterconsumer.json diff --git a/libnymea/interfaces/energymeter.json b/libnymea/interfaces/energymeter.json new file mode 100644 index 00000000..e357f964 --- /dev/null +++ b/libnymea/interfaces/energymeter.json @@ -0,0 +1,81 @@ +{ + "description": "Energy meters measure electric power consumption/production on 3 phases. Often used as root measurements.", + "extends": [ "smartmeterconsumer", "smartmeterproducer" ], + "states": [ + { + "name": "energyConsumedPhaseA", + "type": "double", + "unit": "KiloWattHour" + }, + { + "name": "energyConsumedPhaseB", + "type": "double", + "unit": "KiloWattHour" + }, + { + "name": "energyConsumedPhaseC", + "type": "double", + "unit": "KiloWattHour" + }, + { + "name": "energyProducedPhaseA", + "type": "double", + "unit": "KiloWattHour" + }, + { + "name": "energyProducedPhaseB", + "type": "double", + "unit": "KiloWattHour" + }, + { + "name": "energyProducedPhaseC", + "type": "double", + "unit": "KiloWattHour" + }, + { + "name": "currentPowerPhaseA", + "type": "double", + "unit": "Watt" + }, + { + "name": "currentPowerPhaseB", + "type": "double", + "unit": "Watt" + }, + { + "name": "currentPowerPhaseC", + "type": "double", + "unit": "Watt" + }, + { + "name": "currentPhaseA", + "type": "double", + "unit": "Ampere" + }, + { + "name": "currentPhaseB", + "type": "double", + "unit": "Ampere" + }, + { + "name": "currentPhaseC", + "type": "double", + "unit": "Ampere" + }, + { + "name": "voltagePhaseA", + "type": "double", + "unit": "Volt" + }, + { + "name": "voltagePhaseB", + "type": "double", + "unit": "Volt" + }, + { + "name": "voltagePhaseC", + "type": "double", + "unit": "Volt" + } + ] +} diff --git a/libnymea/interfaces/extendedsmartmeterconsumer.json b/libnymea/interfaces/extendedsmartmeterconsumer.json deleted file mode 100644 index 6aa31b31..00000000 --- a/libnymea/interfaces/extendedsmartmeterconsumer.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "description": "Like smartmeterconsumer, but instead of only providing total consumed energy, this also supports retrieving the current power demand rate. Note that currentPower is negative for consumers but might also be positive if a device implements consumer and producer and currently produces more than it consumes.", - "extends": "smartmeterconsumer", - "states": [ - { - "name": "currentPower", - "type": "double", - "unit": "Watt", - "logged": true - } - ] -} diff --git a/libnymea/interfaces/interfaces.qrc b/libnymea/interfaces/interfaces.qrc index 36de0ac4..c2017c22 100644 --- a/libnymea/interfaces/interfaces.qrc +++ b/libnymea/interfaces/interfaces.qrc @@ -56,11 +56,10 @@ extendedshutter.json smartlock.json system.json + smartmeter.json smartmeterconsumer.json smartmeterproducer.json - smartmeter.json - extendedsmartmeterconsumer.json - extendedsmartmeterproducer.json + energymeter.json accesscontrol.json fingerprintreader.json useraccesscontrol.json diff --git a/libnymea/interfaces/smartmeter.json b/libnymea/interfaces/smartmeter.json index faaddd23..ace40319 100644 --- a/libnymea/interfaces/smartmeter.json +++ b/libnymea/interfaces/smartmeter.json @@ -1,3 +1,3 @@ { - "description": "This interface is used for things that can monitor energy consumption/production. This interface is the base for smartmeter things. Actual things will most likely want to use one of the extending interfaces like smartmeterconsumer and/or smartmeterproducer instead." + "description": "Base interface for things that can monitor energy consumption/production." } diff --git a/libnymea/interfaces/smartmeterconsumer.json b/libnymea/interfaces/smartmeterconsumer.json index 8ecffc4f..e95289c5 100644 --- a/libnymea/interfaces/smartmeterconsumer.json +++ b/libnymea/interfaces/smartmeterconsumer.json @@ -1,11 +1,18 @@ { - "description": "A smartmeterproducer can monitor total energy consumed by this thing.", + "description": "This interface is used for things that can monitor energy consumption. At least the grand total of the consumer energy is provided, optionally live monitoring of the current usage may be available.", "extends": "smartmeter", "states": [ { "name": "totalEnergyConsumed", "type": "double", "unit": "KiloWattHour" + }, + { + "name": "currentPower", + "type": "double", + "unit": "Watt", + "optional": true, + "logged": true } ] } diff --git a/libnymea/interfaces/smartmeterproducer.json b/libnymea/interfaces/smartmeterproducer.json index 9569c4e3..5d825406 100644 --- a/libnymea/interfaces/smartmeterproducer.json +++ b/libnymea/interfaces/smartmeterproducer.json @@ -1,10 +1,18 @@ { - "description": "A smartmeterproducer can monitor total energy produced by this thing.", + "description": "This interface is used for things that can monitor energy production. At least the grand total of the returned energy is provided, optionally live monitoring of the current production may be available. Please note that currentPower is always from a consumer perspective. Thus it will be a negative value for producing devices.", "extends": "smartmeter", "states": [ { "name": "totalEnergyProduced", - "type": "double" + "type": "double", + "unit": "KiloWattHour" + }, + { + "name": "currentPower", + "type": "double", + "unit": "Watt", + "optional": true, + "logged": true } ] }