From 8fb4cda64cf6f0dfb70b0438973738ca745c0458 Mon Sep 17 00:00:00 2001 From: Boernsman Date: Mon, 9 Nov 2020 10:42:42 +0100 Subject: [PATCH 1/3] added sg ready generic thing class --- .../integrationplugingenericthings.cpp | 91 +++++++++++++++++++ .../integrationplugingenericthings.h | 3 + .../integrationplugingenericthings.json | 53 +++++++++++ 3 files changed, 147 insertions(+) diff --git a/genericthings/integrationplugingenericthings.cpp b/genericthings/integrationplugingenericthings.cpp index 6424d1d..0b25873 100644 --- a/genericthings/integrationplugingenericthings.cpp +++ b/genericthings/integrationplugingenericthings.cpp @@ -634,6 +634,7 @@ void IntegrationPluginGenericThings::executeAction(ThingActionInfo *info) } Q_ASSERT_X(false, "executeAction", QString("Unhandled actionTypeId: %1").arg(action.actionTypeId().toString()).toUtf8()); + } else if (thing->thingClassId() == thermostatThingClassId) { if (action.actionTypeId() == thermostatTemperatureSensorInputActionTypeId) { thing->setStateValue(thermostatTemperatureSensorInputStateTypeId, action.param(thermostatTemperatureSensorInputActionTemperatureSensorInputParamTypeId).value()); @@ -647,6 +648,45 @@ void IntegrationPluginGenericThings::executeAction(ThingActionInfo *info) thermostatCheckPowerOutputState(thing); info->finish(Thing::ThingErrorNoError); return; + + } else if (thing->thingClassId() == sgReadyThingClassId) { + if (action.actionTypeId() == sgReadyRelay1ActionTypeId) { + thing->setStateValue(sgReadyRelay1StateTypeId, action.param(sgReadyRelay1ActionRelay1ParamTypeId).value()); + int operatingMode = sgReadyOperatingMode(thing->stateValue(sgReadyRelay1StateTypeId).toBool(), thing->stateValue(sgReadyRelay2StateTypeId).toBool()); + thing->setStateValue(sgReadyOperatingModeStateTypeId, operatingMode); + thing->setStateValue(sgReadyOperatingModeDescriptionStateTypeId, sgReadyOperatingModeDescription(operatingMode)); + info->finish(Thing::ThingErrorNoError); + return; + } + if (action.actionTypeId() == sgReadyRelay2ActionTypeId) { + thing->setStateValue(sgReadyRelay2StateTypeId, action.param(sgReadyRelay2ActionRelay2ParamTypeId).value()); + int operatingMode = sgReadyOperatingMode(thing->stateValue(sgReadyRelay1StateTypeId).toBool(), thing->stateValue(sgReadyRelay2StateTypeId).toBool()); + thing->setStateValue(sgReadyOperatingModeStateTypeId, operatingMode); + thing->setStateValue(sgReadyOperatingModeDescriptionStateTypeId, sgReadyOperatingModeDescription(operatingMode)); + info->finish(Thing::ThingErrorNoError); + return; + } + if (action.actionTypeId() == sgReadyOperatingModeActionTypeId) { + int operatingMode = action.param(sgReadyOperatingModeActionOperatingModeParamTypeId).value().toInt(); + thing->setStateValue(sgReadyOperatingModeStateTypeId, operatingMode); + thing->setStateValue(sgReadyOperatingModeDescriptionStateTypeId, sgReadyOperatingModeDescription(operatingMode)); + if (operatingMode == 1) { + thing->setStateValue(sgReadyRelay1StateTypeId, 1); + thing->setStateValue(sgReadyRelay2StateTypeId, 0); + } else if (operatingMode == 2) { + thing->setStateValue(sgReadyRelay1StateTypeId, 0); + thing->setStateValue(sgReadyRelay2StateTypeId, 0); + } else if (operatingMode == 3) { + thing->setStateValue(sgReadyRelay1StateTypeId, 0); + thing->setStateValue(sgReadyRelay2StateTypeId, 1); + } else if (operatingMode == 4) { + thing->setStateValue(sgReadyRelay1StateTypeId, 1); + thing->setStateValue(sgReadyRelay2StateTypeId, 1); + } + info->finish(Thing::ThingErrorNoError); + return; + } + Q_ASSERT_X(false, "executeAction", QString("Unhandled actionTypeId: %1").arg(action.actionTypeId().toString()).toUtf8()); } else { Q_ASSERT_X(false, "executeAction", QString("Unhandled thingClassId: %1").arg(thing->thingClassId().toString()).toUtf8()); } @@ -801,6 +841,7 @@ void IntegrationPluginGenericThings::moveBlindToAngle(Action action, Thing *thin } } + void IntegrationPluginGenericThings::thermostatCheckPowerOutputState(Thing *thing) { double targetTemperature = thing->stateValue(thermostatTargetTemperatureStateTypeId).toDouble(); @@ -815,3 +856,53 @@ void IntegrationPluginGenericThings::thermostatCheckPowerOutputState(Thing *thin //Possible improvement add boost action where powerState = true is forced inside the hysteresis } } + +QString IntegrationPluginGenericThings::sgReadyOperatingModeDescription(int operatingMode) +{ + if (operatingMode == 1) { + return "Operating mode 1"; + } else if (operatingMode == 2) { + return "Operating mode 2"; + } else if (operatingMode == 3) { + return "Operating mode 3"; + } else if (operatingMode == 4) { + return "Operating mode 4"; + } + return QString("Unknown operating mode %1").arg(operatingMode); +} + +int IntegrationPluginGenericThings::sgReadyOperatingMode(bool relay1, bool relay2) +{ + if (relay1 && !relay2) { + /* + * Betriebszustand 1 (1 Schaltzustand, bei Klemmenlösung: 1:0): + * Dieser Betriebszustand ist abwärtskompatibel zur häufig zu festen Uhrzeiten + * geschalteten EVU-Sperre und umfasst maximal 2 Stunden „harte“ Sperrzeit. + */ + return 1; + } else if (!relay1 && !relay2) { + /* + * Betriebszustand 2 (1 Schaltzustand, bei Klemmenlösungen: 0:0): + * In dieser Schaltung läuft die Wärmepumpe im energieffizienten Normalbetrieb + * mit anteiliger Wärmespeicher-Füllung für die maximal zweistündige EVU-Sperre. + */ + return 2; + } else if (!relay1 && relay2) { + /* + * Betriebszustand 3 (1 Schaltzustand, bei Klemmenlösung 0:1): + * In diesem Betriebszustand läuft die Wärmepumpe innerhalb des Reglers im verstärkten + * Betrieb für Raumheizung und Warmwasserbereitung. Es handelt sich dabei nicht um einen + * definitiven Anlaufbefehl, sondern um eine Einschaltempfehlung entsprechend der heutigen Anhebung. + */ + return 3; + } else { + /* + * Betriebszustand 4 (1 Schaltzustand, bei Klemmenlösung 1:1): + * Hierbei handelt es sich um einen definitiven Anlaufbefehl, insofern dieser im Rahmen der Regeleinstellungen möglich ist. + * Für diesen Betriebszustand müssen für verschiedene Tarif- und Nutzungsmodelle verschiedene Regelungsmodelle am Regler einstellbar sein: + * Variante 1: Die Wärmepumpe (Verdichter) wird aktiv eingeschaltet. + * Variante 2: Die Wärmepumpe (Verdichter und elektrische Zusatzheizungen) wird aktiv eingeschaltet, optional: höhere Temperatur in den Wärmespeichern + */ + return 4; + } +} diff --git a/genericthings/integrationplugingenericthings.h b/genericthings/integrationplugingenericthings.h index 84f188f..8f531d5 100644 --- a/genericthings/integrationplugingenericthings.h +++ b/genericthings/integrationplugingenericthings.h @@ -72,6 +72,9 @@ private: void moveBlindToAngle(Action action, Thing *thing); void thermostatCheckPowerOutputState(Thing *thing); + + int sgReadyOperatingMode(bool relay1, bool relay2); + QString sgReadyOperatingModeDescription(int operatingMode); }; #endif // INTEGRATIONPLUGINGENERICTHINGS_H diff --git a/genericthings/integrationplugingenericthings.json b/genericthings/integrationplugingenericthings.json index 2812ec8..2bcc9ea 100644 --- a/genericthings/integrationplugingenericthings.json +++ b/genericthings/integrationplugingenericthings.json @@ -1088,6 +1088,59 @@ "ioType": "digitalInput" } ] + }, + { + "id": "83cf138d-02dc-4015-9b03-6360c2f3cfb1", + "name": "sgReady", + "displayName": "SG-Ready", + "createMethods": ["user"], + "interfaces": [], + "settingsTypes": [ + ], + "stateTypes": [ + { + "id": "d080466e-7271-441f-9916-1199a6668545", + "name": "relay1", + "displayName": "Relay 1", + "displayNameEvent": "Relay 1 changed", + "displayNameAction": "Set relay 1", + "type": "bool", + "defaultValue": false, + "ioType": "digitalInput", + "writable": true + }, + { + "id": "caf22937-fdf7-41e1-a87b-d11e66c4f4c6", + "name": "relay2", + "displayName": "Relay 2", + "displayNameEvent": "Relay 2 changed", + "displayNameAction": "Set relay 2", + "type": "bool", + "defaultValue": false, + "ioType": "digitalInput", + "writable": true + }, + { + "id": "85667640-d719-4be4-a5fa-e41193eea162", + "name": "operatingMode", + "displayName": "Operating mode", + "displayNameAction": "Set operating mode", + "displayNameEvent": "Operating mode changed", + "type": "int", + "minValue": 1, + "maxValue": 4, + "writable": true, + "defaultValue": 2 + }, + { + "id": "b421d098-f6e9-40e2-b536-58acdb3a49fe", + "name": "operatingModeDescription", + "displayName": "Operating mode description", + "displayNameEvent": "Operating mode description changed", + "type": "QString", + "defaultValue": "" + } + ] } ] } From 9c38777272c348e43e267730b75d3b0d120d1e68 Mon Sep 17 00:00:00 2001 From: Boernsman Date: Mon, 9 Nov 2020 11:50:06 +0100 Subject: [PATCH 2/3] added operating mode description --- .../integrationplugingenericthings.cpp | 60 ++++++++++--------- 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/genericthings/integrationplugingenericthings.cpp b/genericthings/integrationplugingenericthings.cpp index 0b25873..cb96c4a 100644 --- a/genericthings/integrationplugingenericthings.cpp +++ b/genericthings/integrationplugingenericthings.cpp @@ -251,6 +251,12 @@ void IntegrationPluginGenericThings::setupThing(ThingSetupInfo *info) thermostatCheckPowerOutputState(thing); } }); + } else if (thing->thingClassId() == sgReadyThingClassId) { + bool relay1 = thing->stateValue(sgReadyRelay1StateTypeId).toBool(); + bool relay2 = thing->stateValue(sgReadyRelay2StateTypeId).toBool(); + int operatingMode = sgReadyOperatingMode(relay1, relay2); + thing->setStateValue(sgReadyOperatingModeStateTypeId, operatingMode); + thing->setStateValue(sgReadyOperatingModeDescriptionStateTypeId, sgReadyOperatingModeDescription(operatingMode)); } info->finish(Thing::ThingErrorNoError); } @@ -671,17 +677,17 @@ void IntegrationPluginGenericThings::executeAction(ThingActionInfo *info) thing->setStateValue(sgReadyOperatingModeStateTypeId, operatingMode); thing->setStateValue(sgReadyOperatingModeDescriptionStateTypeId, sgReadyOperatingModeDescription(operatingMode)); if (operatingMode == 1) { - thing->setStateValue(sgReadyRelay1StateTypeId, 1); - thing->setStateValue(sgReadyRelay2StateTypeId, 0); + thing->setStateValue(sgReadyRelay1StateTypeId, true); + thing->setStateValue(sgReadyRelay2StateTypeId, false); } else if (operatingMode == 2) { - thing->setStateValue(sgReadyRelay1StateTypeId, 0); - thing->setStateValue(sgReadyRelay2StateTypeId, 0); + thing->setStateValue(sgReadyRelay1StateTypeId, false); + thing->setStateValue(sgReadyRelay2StateTypeId, false); } else if (operatingMode == 3) { - thing->setStateValue(sgReadyRelay1StateTypeId, 0); - thing->setStateValue(sgReadyRelay2StateTypeId, 1); + thing->setStateValue(sgReadyRelay1StateTypeId, false); + thing->setStateValue(sgReadyRelay2StateTypeId, true); } else if (operatingMode == 4) { - thing->setStateValue(sgReadyRelay1StateTypeId, 1); - thing->setStateValue(sgReadyRelay2StateTypeId, 1); + thing->setStateValue(sgReadyRelay1StateTypeId, true); + thing->setStateValue(sgReadyRelay2StateTypeId, true); } info->finish(Thing::ThingErrorNoError); return; @@ -860,13 +866,13 @@ void IntegrationPluginGenericThings::thermostatCheckPowerOutputState(Thing *thin QString IntegrationPluginGenericThings::sgReadyOperatingModeDescription(int operatingMode) { if (operatingMode == 1) { - return "Operating mode 1"; + return "Stop heating."; } else if (operatingMode == 2) { - return "Operating mode 2"; + return "Normal mode, with partial heat storage filling."; } else if (operatingMode == 3) { - return "Operating mode 3"; + return "Increased room and heat storage temperature."; } else if (operatingMode == 4) { - return "Operating mode 4"; + return "Start heating."; } return QString("Unknown operating mode %1").arg(operatingMode); } @@ -875,33 +881,33 @@ int IntegrationPluginGenericThings::sgReadyOperatingMode(bool relay1, bool relay { if (relay1 && !relay2) { /* - * Betriebszustand 1 (1 Schaltzustand, bei Klemmenlösung: 1:0): - * Dieser Betriebszustand ist abwärtskompatibel zur häufig zu festen Uhrzeiten - * geschalteten EVU-Sperre und umfasst maximal 2 Stunden „harte“ Sperrzeit. + * Operating state 1 (Relay state: 1: 0): + * This operating state is downward compatible with the often fixed times + * activated EVU lock and includes a maximum of 2 hours of "hard" lock time. */ return 1; } else if (!relay1 && !relay2) { /* - * Betriebszustand 2 (1 Schaltzustand, bei Klemmenlösungen: 0:0): - * In dieser Schaltung läuft die Wärmepumpe im energieffizienten Normalbetrieb - * mit anteiliger Wärmespeicher-Füllung für die maximal zweistündige EVU-Sperre. + * Operating state 2 (Relay state: 0: 0): + * In this circuit, the heat pump runs in energy-efficient normal mode + * with partial heat storage filling for the maximum two-hour EVU lock. */ return 2; } else if (!relay1 && relay2) { /* - * Betriebszustand 3 (1 Schaltzustand, bei Klemmenlösung 0:1): - * In diesem Betriebszustand läuft die Wärmepumpe innerhalb des Reglers im verstärkten - * Betrieb für Raumheizung und Warmwasserbereitung. Es handelt sich dabei nicht um einen - * definitiven Anlaufbefehl, sondern um eine Einschaltempfehlung entsprechend der heutigen Anhebung. + * Operating state 3 (Relay state: 0: 1): + * In this operating state, the heat pump within the controller runs in amplified mode + * Operation for space heating and hot water preparation. It's not one + * definitive start-up command, but a switch-on recommendation according to the current increase. */ return 3; } else { /* - * Betriebszustand 4 (1 Schaltzustand, bei Klemmenlösung 1:1): - * Hierbei handelt es sich um einen definitiven Anlaufbefehl, insofern dieser im Rahmen der Regeleinstellungen möglich ist. - * Für diesen Betriebszustand müssen für verschiedene Tarif- und Nutzungsmodelle verschiedene Regelungsmodelle am Regler einstellbar sein: - * Variante 1: Die Wärmepumpe (Verdichter) wird aktiv eingeschaltet. - * Variante 2: Die Wärmepumpe (Verdichter und elektrische Zusatzheizungen) wird aktiv eingeschaltet, optional: höhere Temperatur in den Wärmespeichern + * Operating state 4 (Relay state 1: 1): + * This is a definitive start-up command, insofar as this is possible within the framework of the rule settings. + * For this operating state, different control models must be set on the controller for different tariff and usage models: + * Variant 1: The heat pump (compressor) is actively switched on. + * Variant 2: The heat pump (compressor and electrical auxiliary heating) is actively switched on, optional: higher temperature in the heat storage */ return 4; } From 409f9f4fb1472e11b72e6d771c9187383cae7bdb Mon Sep 17 00:00:00 2001 From: Boernsman Date: Mon, 9 Nov 2020 12:05:56 +0100 Subject: [PATCH 3/3] updated translations --- ...b3188696-2585-4806-bf98-30ab576ce5c8-de.ts | 74 +++++++++++++++++++ ...88696-2585-4806-bf98-30ab576ce5c8-en_US.ts | 74 +++++++++++++++++++ 2 files changed, 148 insertions(+) diff --git a/genericthings/translations/b3188696-2585-4806-bf98-30ab576ce5c8-de.ts b/genericthings/translations/b3188696-2585-4806-bf98-30ab576ce5c8-de.ts index 25fd04e..d88fe5e 100644 --- a/genericthings/translations/b3188696-2585-4806-bf98-30ab576ce5c8-de.ts +++ b/genericthings/translations/b3188696-2585-4806-bf98-30ab576ce5c8-de.ts @@ -861,6 +861,80 @@ The name of the StateType ({0f808803-0e63-47df-b024-9685998ba663}) of ThingClass The name of the EventType ({0f808803-0e63-47df-b024-9685998ba663}) of ThingClass thermostat Temperatursensoreingang geändert + + Operating mode + The name of the ParamType (ThingClass: sgReady, ActionType: operatingMode, ID: {85667640-d719-4be4-a5fa-e41193eea162}) +---------- +The name of the ParamType (ThingClass: sgReady, EventType: operatingMode, ID: {85667640-d719-4be4-a5fa-e41193eea162}) +---------- +The name of the StateType ({85667640-d719-4be4-a5fa-e41193eea162}) of ThingClass sgReady + Betriebszustand + + + Operating mode changed + The name of the EventType ({85667640-d719-4be4-a5fa-e41193eea162}) of ThingClass sgReady + Betriebszustand geändert + + + Operating mode description + The name of the ParamType (ThingClass: sgReady, EventType: operatingModeDescription, ID: {b421d098-f6e9-40e2-b536-58acdb3a49fe}) +---------- +The name of the StateType ({b421d098-f6e9-40e2-b536-58acdb3a49fe}) of ThingClass sgReady + Betriebszustandsbeschreibung + + + Operating mode description changed + The name of the EventType ({b421d098-f6e9-40e2-b536-58acdb3a49fe}) of ThingClass sgReady + Betriebszustandsbeschreibung geändert + + + Relay 1 + The name of the ParamType (ThingClass: sgReady, ActionType: relay1, ID: {d080466e-7271-441f-9916-1199a6668545}) +---------- +The name of the ParamType (ThingClass: sgReady, EventType: relay1, ID: {d080466e-7271-441f-9916-1199a6668545}) +---------- +The name of the StateType ({d080466e-7271-441f-9916-1199a6668545}) of ThingClass sgReady + Relais 1 + + + Relay 1 changed + The name of the EventType ({d080466e-7271-441f-9916-1199a6668545}) of ThingClass sgReady + Relais 1 geändert + + + Relay 2 + The name of the ParamType (ThingClass: sgReady, ActionType: relay2, ID: {caf22937-fdf7-41e1-a87b-d11e66c4f4c6}) +---------- +The name of the ParamType (ThingClass: sgReady, EventType: relay2, ID: {caf22937-fdf7-41e1-a87b-d11e66c4f4c6}) +---------- +The name of the StateType ({caf22937-fdf7-41e1-a87b-d11e66c4f4c6}) of ThingClass sgReady + Relais 2 + + + Relay 2 changed + The name of the EventType ({caf22937-fdf7-41e1-a87b-d11e66c4f4c6}) of ThingClass sgReady + Relais 2 geändert + + + SG-Ready + The name of the ThingClass ({83cf138d-02dc-4015-9b03-6360c2f3cfb1}) + SG-Ready + + + Set operating mode + The name of the ActionType ({85667640-d719-4be4-a5fa-e41193eea162}) of ThingClass sgReady + Setze Betriebszustand + + + Set relay 1 + The name of the ActionType ({d080466e-7271-441f-9916-1199a6668545}) of ThingClass sgReady + Setze Relais 1 + + + Set relay 2 + The name of the ActionType ({caf22937-fdf7-41e1-a87b-d11e66c4f4c6}) of ThingClass sgReady + Setze Relais 2 + IntegrationPluginGenericThings diff --git a/genericthings/translations/b3188696-2585-4806-bf98-30ab576ce5c8-en_US.ts b/genericthings/translations/b3188696-2585-4806-bf98-30ab576ce5c8-en_US.ts index 0e11f3d..0843a9b 100644 --- a/genericthings/translations/b3188696-2585-4806-bf98-30ab576ce5c8-en_US.ts +++ b/genericthings/translations/b3188696-2585-4806-bf98-30ab576ce5c8-en_US.ts @@ -861,6 +861,80 @@ The name of the StateType ({0f808803-0e63-47df-b024-9685998ba663}) of ThingClass The name of the EventType ({0f808803-0e63-47df-b024-9685998ba663}) of ThingClass thermostat + + Operating mode + The name of the ParamType (ThingClass: sgReady, ActionType: operatingMode, ID: {85667640-d719-4be4-a5fa-e41193eea162}) +---------- +The name of the ParamType (ThingClass: sgReady, EventType: operatingMode, ID: {85667640-d719-4be4-a5fa-e41193eea162}) +---------- +The name of the StateType ({85667640-d719-4be4-a5fa-e41193eea162}) of ThingClass sgReady + + + + Operating mode changed + The name of the EventType ({85667640-d719-4be4-a5fa-e41193eea162}) of ThingClass sgReady + + + + Operating mode description + The name of the ParamType (ThingClass: sgReady, EventType: operatingModeDescription, ID: {b421d098-f6e9-40e2-b536-58acdb3a49fe}) +---------- +The name of the StateType ({b421d098-f6e9-40e2-b536-58acdb3a49fe}) of ThingClass sgReady + + + + Operating mode description changed + The name of the EventType ({b421d098-f6e9-40e2-b536-58acdb3a49fe}) of ThingClass sgReady + + + + Relay 1 + The name of the ParamType (ThingClass: sgReady, ActionType: relay1, ID: {d080466e-7271-441f-9916-1199a6668545}) +---------- +The name of the ParamType (ThingClass: sgReady, EventType: relay1, ID: {d080466e-7271-441f-9916-1199a6668545}) +---------- +The name of the StateType ({d080466e-7271-441f-9916-1199a6668545}) of ThingClass sgReady + + + + Relay 1 changed + The name of the EventType ({d080466e-7271-441f-9916-1199a6668545}) of ThingClass sgReady + + + + Relay 2 + The name of the ParamType (ThingClass: sgReady, ActionType: relay2, ID: {caf22937-fdf7-41e1-a87b-d11e66c4f4c6}) +---------- +The name of the ParamType (ThingClass: sgReady, EventType: relay2, ID: {caf22937-fdf7-41e1-a87b-d11e66c4f4c6}) +---------- +The name of the StateType ({caf22937-fdf7-41e1-a87b-d11e66c4f4c6}) of ThingClass sgReady + + + + Relay 2 changed + The name of the EventType ({caf22937-fdf7-41e1-a87b-d11e66c4f4c6}) of ThingClass sgReady + + + + SG-Ready + The name of the ThingClass ({83cf138d-02dc-4015-9b03-6360c2f3cfb1}) + + + + Set operating mode + The name of the ActionType ({85667640-d719-4be4-a5fa-e41193eea162}) of ThingClass sgReady + + + + Set relay 1 + The name of the ActionType ({d080466e-7271-441f-9916-1199a6668545}) of ThingClass sgReady + + + + Set relay 2 + The name of the ActionType ({caf22937-fdf7-41e1-a87b-d11e66c4f4c6}) of ThingClass sgReady + + IntegrationPluginGenericThings