Generic things: Add a generic thermostat

master
Michael Zanetti 2020-10-31 14:47:01 +01:00 committed by Boernsman
parent 78b0e9a047
commit 6b8fd3ae87
4 changed files with 132 additions and 0 deletions

View File

@ -625,6 +625,18 @@ void IntegrationPluginGenericThings::executeAction(ThingActionInfo *info)
return;
}
Q_ASSERT_X(false, "executeAction", QString("Unhandled actionTypeId: %1").arg(action.actionTypeId().toString()).toUtf8());
} else if (thing->thingClassId() == thermostatThingClassId) {
if (action.actionTypeId() == thermostatTargetTemperatureActionTypeId) {
thing->setStateValue(thermostatTargetTemperatureStateTypeId, action.param(thermostatTargetTemperatureActionTargetTemperatureParamTypeId).value());
info->finish(Thing::ThingErrorNoError);
return;
}
if (action.actionTypeId() == thermostatPowerActionTypeId) {
thing->setStateValue(thermostatPowerStateTypeId, action.param(thermostatPowerActionPowerParamTypeId).value());
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());

View File

@ -1029,6 +1029,40 @@
"ioType": "digitalOutput"
}
]
},
{
"id": "6a34ba99-e5ec-4fc9-a61f-695ed8573fa1",
"name": "thermostat",
"displayName": "Generic thermostat",
"createMethods": ["user"],
"interfaces": ["thermostat", "heating"],
"stateTypes": [
{
"id": "60169ebf-c1e3-41ed-a1bb-4b858e93ec50",
"name": "targetTemperature",
"displayName": "Target temperature",
"displayNameEvent": "Target temperature changed",
"displayNameAction": "Set target temperature",
"type": "double",
"defaultValue": 21,
"minValue": -20,
"maxValue": 50,
"unit": "DegreeCelsius",
"writable": true,
"ioType": "analogInput"
},
{
"id": "1f6a0c39-4417-4e31-86db-9926cf81c345",
"name": "power",
"displayName": "On/off",
"displayNameEvent": "Turned on/off",
"displayNameAction": "Turn on/off",
"type": "bool",
"defaultValue": false,
"writable": true,
"ioType": "digitalInput"
}
]
}
]
}

View File

@ -794,6 +794,49 @@ The name of the StateType ({e645a979-1465-4592-b8b0-f4c123db0800}) of ThingClass
<extracomment>The name of the EventType ({e645a979-1465-4592-b8b0-f4c123db0800}) of ThingClass pressureSensor</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Generic thermostat</source>
<extracomment>The name of the ThingClass ({6a34ba99-e5ec-4fc9-a61f-695ed8573fa1})</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>On/off</source>
<extracomment>The name of the ParamType (ThingClass: thermostat, ActionType: power, ID: {1f6a0c39-4417-4e31-86db-9926cf81c345})
----------
The name of the ParamType (ThingClass: thermostat, EventType: power, ID: {1f6a0c39-4417-4e31-86db-9926cf81c345})
----------
The name of the StateType ({1f6a0c39-4417-4e31-86db-9926cf81c345}) of ThingClass thermostat</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Set target temperature</source>
<extracomment>The name of the ActionType ({60169ebf-c1e3-41ed-a1bb-4b858e93ec50}) of ThingClass thermostat</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Target temperature</source>
<extracomment>The name of the ParamType (ThingClass: thermostat, ActionType: targetTemperature, ID: {60169ebf-c1e3-41ed-a1bb-4b858e93ec50})
----------
The name of the ParamType (ThingClass: thermostat, EventType: targetTemperature, ID: {60169ebf-c1e3-41ed-a1bb-4b858e93ec50})
----------
The name of the StateType ({60169ebf-c1e3-41ed-a1bb-4b858e93ec50}) of ThingClass thermostat</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Target temperature changed</source>
<extracomment>The name of the EventType ({60169ebf-c1e3-41ed-a1bb-4b858e93ec50}) of ThingClass thermostat</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Turn on/off</source>
<extracomment>The name of the ActionType ({1f6a0c39-4417-4e31-86db-9926cf81c345}) of ThingClass thermostat</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Turned on/off</source>
<extracomment>The name of the EventType ({1f6a0c39-4417-4e31-86db-9926cf81c345}) of ThingClass thermostat</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>IntegrationPluginGenericThings</name>

View File

@ -794,6 +794,49 @@ The name of the StateType ({0cc74edb-7116-47cf-953a-409933f26557}) of ThingClass
<extracomment>The name of the EventType ({0cc74edb-7116-47cf-953a-409933f26557}) of ThingClass extendedStatefulGaragedoor</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Generic thermostat</source>
<extracomment>The name of the ThingClass ({6a34ba99-e5ec-4fc9-a61f-695ed8573fa1})</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>On/off</source>
<extracomment>The name of the ParamType (ThingClass: thermostat, ActionType: power, ID: {1f6a0c39-4417-4e31-86db-9926cf81c345})
----------
The name of the ParamType (ThingClass: thermostat, EventType: power, ID: {1f6a0c39-4417-4e31-86db-9926cf81c345})
----------
The name of the StateType ({1f6a0c39-4417-4e31-86db-9926cf81c345}) of ThingClass thermostat</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Set target temperature</source>
<extracomment>The name of the ActionType ({60169ebf-c1e3-41ed-a1bb-4b858e93ec50}) of ThingClass thermostat</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Target temperature</source>
<extracomment>The name of the ParamType (ThingClass: thermostat, ActionType: targetTemperature, ID: {60169ebf-c1e3-41ed-a1bb-4b858e93ec50})
----------
The name of the ParamType (ThingClass: thermostat, EventType: targetTemperature, ID: {60169ebf-c1e3-41ed-a1bb-4b858e93ec50})
----------
The name of the StateType ({60169ebf-c1e3-41ed-a1bb-4b858e93ec50}) of ThingClass thermostat</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Target temperature changed</source>
<extracomment>The name of the EventType ({60169ebf-c1e3-41ed-a1bb-4b858e93ec50}) of ThingClass thermostat</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Turn on/off</source>
<extracomment>The name of the ActionType ({1f6a0c39-4417-4e31-86db-9926cf81c345}) of ThingClass thermostat</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Turned on/off</source>
<extracomment>The name of the EventType ({1f6a0c39-4417-4e31-86db-9926cf81c345}) of ThingClass thermostat</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>IntegrationPluginGenericThings</name>