From 1e351e4cd0ef6cf94c4e0ad94530fb5a8a5ffe9e Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Fri, 25 Jun 2021 17:41:26 +0200 Subject: [PATCH] GenericThing: Add a generic ventilation thing with flow control support --- .../integrationplugingenericthings.cpp | 12 ++++++ .../integrationplugingenericthings.json | 34 +++++++++++++++++ ...b3188696-2585-4806-bf98-30ab576ce5c8-de.ts | 38 ++++++++++++++++++- ...88696-2585-4806-bf98-30ab576ce5c8-en_US.ts | 37 +++++++++++++++++- 4 files changed, 117 insertions(+), 4 deletions(-) diff --git a/genericthings/integrationplugingenericthings.cpp b/genericthings/integrationplugingenericthings.cpp index fa1dc594..b55238e4 100644 --- a/genericthings/integrationplugingenericthings.cpp +++ b/genericthings/integrationplugingenericthings.cpp @@ -535,6 +535,18 @@ void IntegrationPluginGenericThings::executeAction(ThingActionInfo *info) } else { Q_ASSERT_X(false, "executeAction", QString("Unhandled actionTypeId: %1").arg(action.actionTypeId().toString()).toUtf8()); } + } else if (thing->thingClassId() == ventilationFlowThingClassId) { + if (action.actionTypeId() == ventilationFlowPowerActionTypeId) { + thing->setStateValue(ventilationFlowPowerStateTypeId, action.param(ventilationFlowPowerActionPowerParamTypeId).value()); + info->finish(Thing::ThingErrorNoError); + return; + } else if (action.actionTypeId() == ventilationFlowFlowRateActionTypeId) { + thing->setStateValue(ventilationFlowFlowRateStateTypeId, action.param(ventilationFlowFlowRateActionFlowRateParamTypeId).value()); + info->finish(Thing::ThingErrorNoError); + return; + } else { + Q_ASSERT_X(false, "executeAction", QString("Unhandled actionTypeId: %1").arg(action.actionTypeId().toString()).toUtf8()); + } } else if (thing->thingClassId() == temperatureSensorThingClassId) { if (action.actionTypeId() == temperatureSensorInputActionTypeId) { double value = info->action().param(temperatureSensorInputActionInputParamTypeId).value().toDouble(); diff --git a/genericthings/integrationplugingenericthings.json b/genericthings/integrationplugingenericthings.json index 816233c0..d7a0c321 100644 --- a/genericthings/integrationplugingenericthings.json +++ b/genericthings/integrationplugingenericthings.json @@ -743,6 +743,40 @@ } ] }, + { + "id": "a7eec5f7-3cc3-4edb-baa7-1f6b6f935bf8", + "name": "ventilationFlow", + "displayName": "Generic ventilation with flow control", + "createMethods": ["user"], + "interfaces": ["ventilation"], + "stateTypes": [ + { + "id": "adf9a8dd-da13-4070-a3bd-9d4be26ebcd1", + "name": "power", + "displayName": "Power", + "displayNameEvent": "Turned on or off", + "displayNameAction": "Turn on or off", + "type": "bool", + "defaultValue": false, + "writable": true, + "ioType": "digitalInput" + }, + { + "id": "5a273bba-0bef-49fb-870a-7f2df8fc14b6", + "name": "flowRate", + "displayName": "Air flow rate", + "displayNameEvent": "Air flow rate changed", + "displayNameAction": "Set air flow rate", + "type": "int", + "minValue": 0, + "maxValue": 100, + "unit": "Percentage", + "writable": true, + "defaultValue": 0, + "ioType": "analogOutput" + } + ] + }, { "id": "cf3d65db-6f68-457b-968c-cfb66cbd5311", "name": "temperatureSensor", diff --git a/genericthings/translations/b3188696-2585-4806-bf98-30ab576ce5c8-de.ts b/genericthings/translations/b3188696-2585-4806-bf98-30ab576ce5c8-de.ts index fd83d11c..399d7a88 100644 --- a/genericthings/translations/b3188696-2585-4806-bf98-30ab576ce5c8-de.ts +++ b/genericthings/translations/b3188696-2585-4806-bf98-30ab576ce5c8-de.ts @@ -399,6 +399,12 @@ The name of the EventType ({181df603-d45f-4d3d-a358-97aa3e4ac0bd}) of ThingClass ---------- The name of the StateType ({5983d714-5f80-42d8-bee2-9228b6382b3b}) of ThingClass extendedSmartMeterConsumer ---------- +The name of the ParamType (ThingClass: ventilationFlow, ActionType: power, ID: {adf9a8dd-da13-4070-a3bd-9d4be26ebcd1}) +---------- +The name of the ParamType (ThingClass: ventilationFlow, EventType: power, ID: {adf9a8dd-da13-4070-a3bd-9d4be26ebcd1}) +---------- +The name of the StateType ({adf9a8dd-da13-4070-a3bd-9d4be26ebcd1}) of ThingClass ventilationFlow +---------- The name of the ParamType (ThingClass: ventilation, ActionType: power, ID: {846711b7-ea5a-4c66-a267-001c60406509}) ---------- The name of the ParamType (ThingClass: ventilation, EventType: power, ID: {846711b7-ea5a-4c66-a267-001c60406509}) @@ -598,14 +604,18 @@ The name of the StateType ({d0b6c4be-339e-4b0f-a234-0611b7565395}) of ThingClass Turn on or off - The name of the ActionType ({846711b7-ea5a-4c66-a267-001c60406509}) of ThingClass ventilation + The name of the ActionType ({adf9a8dd-da13-4070-a3bd-9d4be26ebcd1}) of ThingClass ventilationFlow +---------- +The name of the ActionType ({846711b7-ea5a-4c66-a267-001c60406509}) of ThingClass ventilation ---------- The name of the ActionType ({0212a287-c5ae-4644-8803-adfdd8caeb9a}) of ThingClass irrigation Schalte ein oder aus Turned on or off - The name of the EventType ({846711b7-ea5a-4c66-a267-001c60406509}) of ThingClass ventilation + The name of the EventType ({adf9a8dd-da13-4070-a3bd-9d4be26ebcd1}) of ThingClass ventilationFlow +---------- +The name of the EventType ({846711b7-ea5a-4c66-a267-001c60406509}) of ThingClass ventilation ---------- The name of the EventType ({0212a287-c5ae-4644-8803-adfdd8caeb9a}) of ThingClass irrigation Ein- oder Ausgeschalten @@ -1253,6 +1263,30 @@ The name of the StateType ({f477e227-0d2d-4d88-a545-7dedf36266d5}) of ThingClass The name of the EventType ({f477e227-0d2d-4d88-a545-7dedf36266d5}) of ThingClass generic Zeichenkette geändert + + Air flow rate + The name of the ParamType (ThingClass: ventilationFlow, ActionType: flowRate, ID: {5a273bba-0bef-49fb-870a-7f2df8fc14b6}) +---------- +The name of the ParamType (ThingClass: ventilationFlow, EventType: flowRate, ID: {5a273bba-0bef-49fb-870a-7f2df8fc14b6}) +---------- +The name of the StateType ({5a273bba-0bef-49fb-870a-7f2df8fc14b6}) of ThingClass ventilationFlow + Luftfluß + + + Air flow rate changed + The name of the EventType ({5a273bba-0bef-49fb-870a-7f2df8fc14b6}) of ThingClass ventilationFlow + Luftfluß geändert + + + Generic ventilation with flow control + The name of the ThingClass ({a7eec5f7-3cc3-4edb-baa7-1f6b6f935bf8}) + Generische Lüftung mit Luftfluß-Regelung + + + Set air flow rate + The name of the ActionType ({5a273bba-0bef-49fb-870a-7f2df8fc14b6}) of ThingClass ventilationFlow + Luftfluß ändern + 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 e35e1ad3..a714624d 100644 --- a/genericthings/translations/b3188696-2585-4806-bf98-30ab576ce5c8-en_US.ts +++ b/genericthings/translations/b3188696-2585-4806-bf98-30ab576ce5c8-en_US.ts @@ -399,6 +399,12 @@ The name of the EventType ({181df603-d45f-4d3d-a358-97aa3e4ac0bd}) of ThingClass ---------- The name of the StateType ({5983d714-5f80-42d8-bee2-9228b6382b3b}) of ThingClass extendedSmartMeterConsumer ---------- +The name of the ParamType (ThingClass: ventilationFlow, ActionType: power, ID: {adf9a8dd-da13-4070-a3bd-9d4be26ebcd1}) +---------- +The name of the ParamType (ThingClass: ventilationFlow, EventType: power, ID: {adf9a8dd-da13-4070-a3bd-9d4be26ebcd1}) +---------- +The name of the StateType ({adf9a8dd-da13-4070-a3bd-9d4be26ebcd1}) of ThingClass ventilationFlow +---------- The name of the ParamType (ThingClass: ventilation, ActionType: power, ID: {846711b7-ea5a-4c66-a267-001c60406509}) ---------- The name of the ParamType (ThingClass: ventilation, EventType: power, ID: {846711b7-ea5a-4c66-a267-001c60406509}) @@ -598,14 +604,18 @@ The name of the StateType ({d0b6c4be-339e-4b0f-a234-0611b7565395}) of ThingClass Turn on or off - The name of the ActionType ({846711b7-ea5a-4c66-a267-001c60406509}) of ThingClass ventilation + The name of the ActionType ({adf9a8dd-da13-4070-a3bd-9d4be26ebcd1}) of ThingClass ventilationFlow +---------- +The name of the ActionType ({846711b7-ea5a-4c66-a267-001c60406509}) of ThingClass ventilation ---------- The name of the ActionType ({0212a287-c5ae-4644-8803-adfdd8caeb9a}) of ThingClass irrigation Turned on or off - The name of the EventType ({846711b7-ea5a-4c66-a267-001c60406509}) of ThingClass ventilation + The name of the EventType ({adf9a8dd-da13-4070-a3bd-9d4be26ebcd1}) of ThingClass ventilationFlow +---------- +The name of the EventType ({846711b7-ea5a-4c66-a267-001c60406509}) of ThingClass ventilation ---------- The name of the EventType ({0212a287-c5ae-4644-8803-adfdd8caeb9a}) of ThingClass irrigation @@ -1251,6 +1261,29 @@ The name of the StateType ({f477e227-0d2d-4d88-a545-7dedf36266d5}) of ThingClass String state changed The name of the EventType ({f477e227-0d2d-4d88-a545-7dedf36266d5}) of ThingClass generic + + + Air flow rate + The name of the ParamType (ThingClass: ventilationFlow, ActionType: flowRate, ID: {5a273bba-0bef-49fb-870a-7f2df8fc14b6}) +---------- +The name of the ParamType (ThingClass: ventilationFlow, EventType: flowRate, ID: {5a273bba-0bef-49fb-870a-7f2df8fc14b6}) +---------- +The name of the StateType ({5a273bba-0bef-49fb-870a-7f2df8fc14b6}) of ThingClass ventilationFlow + + + + Air flow rate changed + The name of the EventType ({5a273bba-0bef-49fb-870a-7f2df8fc14b6}) of ThingClass ventilationFlow + + + + Generic ventilation with flow control + The name of the ThingClass ({a7eec5f7-3cc3-4edb-baa7-1f6b6f935bf8}) + + + + Set air flow rate + The name of the ActionType ({5a273bba-0bef-49fb-870a-7f2df8fc14b6}) of ThingClass ventilationFlow