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..1670e974
--- /dev/null
+++ b/libnymea/interfaces/energystorage.json
@@ -0,0 +1,17 @@
+{
+ "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
+ },
+ {
+ "name": "capacity",
+ "type": "double",
+ "unit": "KiloWattHour"
+ }
+ ]
+}
diff --git a/libnymea/interfaces/evcharger.json b/libnymea/interfaces/evcharger.json
index 8de3ba15..ed02972e 100644
--- a/libnymea/interfaces/evcharger.json
+++ b/libnymea/interfaces/evcharger.json
@@ -1,6 +1,6 @@
{
"description": "An EV-charger. Extends the power interface for charging/not charging an electric vehicle. Supports regulation of the max. charging current in addition to be powered on or off.",
- "extends": "power",
+ "extends": ["smartmeterconsumer", "power"],
"states": [
{
"name": "maxChargingCurrent",
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
diff --git a/libnymea/interfaces/smartmeterconsumer.json b/libnymea/interfaces/smartmeterconsumer.json
index e95289c5..69456283 100644
--- a/libnymea/interfaces/smartmeterconsumer.json
+++ b/libnymea/interfaces/smartmeterconsumer.json
@@ -5,13 +5,13 @@
{
"name": "totalEnergyConsumed",
"type": "double",
- "unit": "KiloWattHour"
+ "unit": "KiloWattHour",
+ "logged": true
},
{
"name": "currentPower",
"type": "double",
"unit": "Watt",
- "optional": true,
"logged": true
}
]
diff --git a/libnymea/interfaces/smartmeterproducer.json b/libnymea/interfaces/smartmeterproducer.json
index 5d825406..442542ba 100644
--- a/libnymea/interfaces/smartmeterproducer.json
+++ b/libnymea/interfaces/smartmeterproducer.json
@@ -5,13 +5,13 @@
{
"name": "totalEnergyProduced",
"type": "double",
- "unit": "KiloWattHour"
+ "unit": "KiloWattHour",
+ "logged": true
},
{
"name": "currentPower",
"type": "double",
"unit": "Watt",
- "optional": true,
"logged": true
}
]