From d6fd4bfba50b6a61f5b0a8d08ec76b38bcd1eaf3 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Tue, 29 Dec 2020 13:17:08 +0100 Subject: [PATCH] Rework heating/cooling/thermostat interfaces Simple heating/cooling devices are more different to thermostats than one would think at first. This splits heating and thermostat interfaces into two unrelated interfaces and adds a generic cooling interface for simple on/off air conditioners. --- libnymea/interfaces/cooling.json | 15 ++++++++++ libnymea/interfaces/extendedheating.json | 14 --------- libnymea/interfaces/heating.json | 13 ++++++++- libnymea/interfaces/interfaces.qrc | 2 +- libnymea/interfaces/thermostat.json | 37 +++++++++++++++++------- 5 files changed, 55 insertions(+), 26 deletions(-) create mode 100644 libnymea/interfaces/cooling.json delete mode 100644 libnymea/interfaces/extendedheating.json diff --git a/libnymea/interfaces/cooling.json b/libnymea/interfaces/cooling.json new file mode 100644 index 00000000..7b811461 --- /dev/null +++ b/libnymea/interfaces/cooling.json @@ -0,0 +1,15 @@ +{ + "description": "The cooling interface defines basic cooling appliances.", + "extends": "power", + "states": [ + { + "name": "percentage", + "type": "int", + "min": 0, + "max": 100, + "unit": "Percentage", + "writable": true, + "optional": true + } + ] +} diff --git a/libnymea/interfaces/extendedheating.json b/libnymea/interfaces/extendedheating.json deleted file mode 100644 index fe340991..00000000 --- a/libnymea/interfaces/extendedheating.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "description": "The extendedheating interface defines heating appliances which can also be controlled with a percentage range. When implementing such a device class, do not set power to true when the percentage is set.", - "extends": "heating", - "states": [ - { - "name": "percentage", - "type": "int", - "min": 0, - "max": 100, - "unit": "Percentage", - "writable": true - } - ] -} diff --git a/libnymea/interfaces/heating.json b/libnymea/interfaces/heating.json index a4ad2f28..9d4e70a5 100644 --- a/libnymea/interfaces/heating.json +++ b/libnymea/interfaces/heating.json @@ -1,4 +1,15 @@ { "description": "The heating interface defines basic heating appliances.", - "extends": "power" + "extends": "power", + "states": [ + { + "name": "percentage", + "type": "int", + "min": 0, + "max": 100, + "unit": "Percentage", + "writable": true, + "optional": true + } + ] } diff --git a/libnymea/interfaces/interfaces.qrc b/libnymea/interfaces/interfaces.qrc index c0fe0fb8..5e0f4642 100644 --- a/libnymea/interfaces/interfaces.qrc +++ b/libnymea/interfaces/interfaces.qrc @@ -1,6 +1,7 @@ alert.json + cooling.json light.json dimmablelight.json account.json @@ -65,7 +66,6 @@ fingerprintreader.json useraccesscontrol.json heating.json - extendedheating.json evcharger.json extendedevcharger.json noisesensor.json diff --git a/libnymea/interfaces/thermostat.json b/libnymea/interfaces/thermostat.json index 0386290e..ae9dce1d 100644 --- a/libnymea/interfaces/thermostat.json +++ b/libnymea/interfaces/thermostat.json @@ -1,12 +1,29 @@ { - "description": "The thermostat interface describes devices which have a target temperature value and regulate themselves to match that target temperature. Often combined with the power and temperaturesensor interfaces.", - "states": [ - { - "name": "targetTemperature", - "type": "double", - "unit": "DegreeCelsius", - "minValue": "any", - "maxValue": "any" - } - ] + "description": "The thermostat interface describes devices which have a target temperature value and regulate themselves to match that target temperature.", + "states": [ + { + "name": "targetTemperature", + "type": "double", + "unit": "DegreeCelsius", + "minValue": "any", + "maxValue": "any", + "writable": true + }, + { + "name": "temperature", + "type": "double", + "unit": "DegreeCelsius", + "optional": true + }, + { + "name": "heatingOn", + "type": "bool", + "optional": true + }, + { + "name": "coolingOn", + "type": "bool", + "optional": true + } + ] }