From 500f6c6cef4abd9396eb43622263ee3ece980a2b Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Tue, 21 Sep 2021 13:40:50 +0200 Subject: [PATCH] Add energystorage interface --- libnymea/interfaces/battery.json | 10 +++------- libnymea/interfaces/energystorage.json | 12 ++++++++++++ libnymea/interfaces/interfaces.qrc | 1 + 3 files changed, 16 insertions(+), 7 deletions(-) create mode 100644 libnymea/interfaces/energystorage.json diff --git a/libnymea/interfaces/battery.json b/libnymea/interfaces/battery.json index 43399cfe..05eeb387 100644 --- a/libnymea/interfaces/battery.json +++ b/libnymea/interfaces/battery.json @@ -20,13 +20,9 @@ "optional": true }, { - "name": "charging", - "type": "bool", - "optional": true - }, - { - "name": "discharging", - "type": "bool", + "name": "chargingState", + "type": "QString", + "allowdValues": ["idle", "charging", "discharging"], "optional": true } ] diff --git a/libnymea/interfaces/energystorage.json b/libnymea/interfaces/energystorage.json new file mode 100644 index 00000000..866024d5 --- /dev/null +++ b/libnymea/interfaces/energystorage.json @@ -0,0 +1,12 @@ +{ + "description": "Interfaces for devices that store electrical energy and can return it at a later point, such as batteries. The currentPower state follows the usual convention that positive is 'consumed' energy and negative values represent 'produced' or in this case 'returned' energy.", + "extends": ["battery", "smartmeter"], + "states": [ + { + "name": "currentPower", + "type": "double", + "unit": "Watt", + "logged": true + } + ] +} diff --git a/libnymea/interfaces/interfaces.qrc b/libnymea/interfaces/interfaces.qrc index d2996531..3d6ee2ca 100644 --- a/libnymea/interfaces/interfaces.qrc +++ b/libnymea/interfaces/interfaces.qrc @@ -88,5 +88,6 @@ cleaningrobot.json airquality.json indoorairquality.json + energystorage.json