Merge PR #432: GenericThings: Add a totally generic thing

pull/1/head
Jenkins nymea 2021-07-01 17:07:11 +02:00
commit 82e75368bc
4 changed files with 294 additions and 0 deletions

View File

@ -274,6 +274,34 @@ void IntegrationPluginGenericThings::executeAction(ThingActionInfo *info)
Thing *thing = info->thing();
Action action = info->action();
if (thing->thingClassId() == genericThingClassId) {
if (action.actionTypeId() == genericAnalogInputActionTypeId) {
thing->setStateValue(genericAnalogInputStateTypeId, action.paramValue(genericAnalogInputActionAnalogInputParamTypeId));
info->finish(Thing::ThingErrorNoError);
return;
}
if (action.actionTypeId() == genericAnalogOutputActionTypeId) {
thing->setStateValue(genericAnalogOutputStateTypeId, action.paramValue(genericAnalogOutputActionAnalogOutputParamTypeId));
info->finish(Thing::ThingErrorNoError);
return;
}
if (action.actionTypeId() == genericDigitalInputActionTypeId) {
thing->setStateValue(genericDigitalInputStateTypeId, action.paramValue(genericDigitalInputActionDigitalInputParamTypeId));
info->finish(Thing::ThingErrorNoError);
return;
}
if (action.actionTypeId() == genericDigitalOutputActionTypeId) {
thing->setStateValue(genericDigitalOutputStateTypeId, action.paramValue(genericDigitalOutputActionDigitalOutputParamTypeId));
info->finish(Thing::ThingErrorNoError);
return;
}
if (action.actionTypeId() == genericStringStateActionTypeId) {
thing->setStateValue(genericStringStateStateTypeId, action.paramValue(genericStringStateActionStringStateParamTypeId));
info->finish(Thing::ThingErrorNoError);
return;
}
}
if (thing->thingClassId() == awningThingClassId) {
if (action.actionTypeId() == awningOpenActionTypeId) {
thing->setStateValue(awningStatusStateTypeId, "Opening");

View File

@ -8,6 +8,72 @@
"displayName": "nymea",
"id": "2062d64d-3232-433c-88bc-0d33c0ba2ba6",
"thingClasses": [
{
"id": "f5c02d35-b06e-4950-8238-847d50cabfdf",
"name": "generic",
"displayName": "Generic thing",
"createMethods": ["user"],
"stateTypes": [
{
"id": "f477e227-0d2d-4d88-a545-7dedf36266d5",
"name": "stringState",
"displayName": "String state",
"displayNameEvent": "String state changed",
"displayNameAction": "Set string state",
"type": "QString",
"defaultValue": "",
"writable": true
},
{
"id": "3cf5eb01-dae8-49cd-8c5f-b0224be0044f",
"name": "digitalInput",
"displayName": "Digital input",
"displayNameEvent": "Digital input changed",
"displayNameAction": "Set digital input",
"type": "bool",
"defaultValue": false,
"writable": true,
"ioType": "digitalInput"
},
{
"id": "605b4d8e-71a7-441e-900a-e07c305acd93",
"name": "digitalOutput",
"displayName": "Digital output",
"displayNameEvent": "Digital output changed",
"displayNameAction": "Set digital output",
"type": "bool",
"defaultValue": false,
"writable": true,
"ioType": "digitalOutput"
},
{
"id": "810fcd3c-7854-4bb1-82f6-1403ba54875e",
"name": "analogInput",
"displayName": "Analog input",
"displayNameEvent": "Analog input changed",
"displayNameAction": "Set analog input",
"type": "double",
"defaultValue": 0,
"minValue": 0,
"maxValue": 1,
"ioType": "analogInput",
"writable": true
},
{
"id": "de8ec1b1-8026-4fd8-aefb-dedc07616aa4",
"name": "analogOutput",
"displayName": "Analog output",
"displayNameEvent": "Analog output changed",
"displayNameAction": "Set analog output",
"type": "double",
"defaultValue": 0,
"minValue": 0,
"maxValue": 1,
"ioType": "analogOutput",
"writable": true
}
]
},
{
"id": "9e69585f-90ba-44e4-ad90-5b4bffbe345a",
"name": "awning",

View File

@ -1153,6 +1153,106 @@ The name of the StateType ({a61c0328-b982-46a5-9cc0-b4fa4d0ab84d}) of ThingClass
<extracomment>The name of the ActionType ({a61c0328-b982-46a5-9cc0-b4fa4d0ab84d}) of ThingClass battery</extracomment>
<translation>Setze Laden</translation>
</message>
<message>
<source>Analog input</source>
<extracomment>The name of the ParamType (ThingClass: generic, ActionType: analogInput, ID: {810fcd3c-7854-4bb1-82f6-1403ba54875e})
----------
The name of the ParamType (ThingClass: generic, EventType: analogInput, ID: {810fcd3c-7854-4bb1-82f6-1403ba54875e})
----------
The name of the StateType ({810fcd3c-7854-4bb1-82f6-1403ba54875e}) of ThingClass generic</extracomment>
<translation>Analoger Eingang</translation>
</message>
<message>
<source>Analog input changed</source>
<extracomment>The name of the EventType ({810fcd3c-7854-4bb1-82f6-1403ba54875e}) of ThingClass generic</extracomment>
<translation>Analoger Eingang geändert</translation>
</message>
<message>
<source>Analog output</source>
<extracomment>The name of the ParamType (ThingClass: generic, ActionType: analogOutput, ID: {de8ec1b1-8026-4fd8-aefb-dedc07616aa4})
----------
The name of the ParamType (ThingClass: generic, EventType: analogOutput, ID: {de8ec1b1-8026-4fd8-aefb-dedc07616aa4})
----------
The name of the StateType ({de8ec1b1-8026-4fd8-aefb-dedc07616aa4}) of ThingClass generic</extracomment>
<translation>Analoger Ausgang</translation>
</message>
<message>
<source>Analog output changed</source>
<extracomment>The name of the EventType ({de8ec1b1-8026-4fd8-aefb-dedc07616aa4}) of ThingClass generic</extracomment>
<translation>Analoger Ausgang geändret</translation>
</message>
<message>
<source>Digital input</source>
<extracomment>The name of the ParamType (ThingClass: generic, ActionType: digitalInput, ID: {3cf5eb01-dae8-49cd-8c5f-b0224be0044f})
----------
The name of the ParamType (ThingClass: generic, EventType: digitalInput, ID: {3cf5eb01-dae8-49cd-8c5f-b0224be0044f})
----------
The name of the StateType ({3cf5eb01-dae8-49cd-8c5f-b0224be0044f}) of ThingClass generic</extracomment>
<translation>Digitaler Eingang</translation>
</message>
<message>
<source>Digital input changed</source>
<extracomment>The name of the EventType ({3cf5eb01-dae8-49cd-8c5f-b0224be0044f}) of ThingClass generic</extracomment>
<translation>Digitaler Eingang geändert</translation>
</message>
<message>
<source>Digital output</source>
<extracomment>The name of the ParamType (ThingClass: generic, ActionType: digitalOutput, ID: {605b4d8e-71a7-441e-900a-e07c305acd93})
----------
The name of the ParamType (ThingClass: generic, EventType: digitalOutput, ID: {605b4d8e-71a7-441e-900a-e07c305acd93})
----------
The name of the StateType ({605b4d8e-71a7-441e-900a-e07c305acd93}) of ThingClass generic</extracomment>
<translation>Digitaler Ausgang</translation>
</message>
<message>
<source>Digital output changed</source>
<extracomment>The name of the EventType ({605b4d8e-71a7-441e-900a-e07c305acd93}) of ThingClass generic</extracomment>
<translation>Digitaler Ausgang geändert</translation>
</message>
<message>
<source>Generic thing</source>
<extracomment>The name of the ThingClass ({f5c02d35-b06e-4950-8238-847d50cabfdf})</extracomment>
<translation>Generisches &quot;Thing&quot;</translation>
</message>
<message>
<source>Set analog input</source>
<extracomment>The name of the ActionType ({810fcd3c-7854-4bb1-82f6-1403ba54875e}) of ThingClass generic</extracomment>
<translation>Setze Analogen Eingang</translation>
</message>
<message>
<source>Set analog output</source>
<extracomment>The name of the ActionType ({de8ec1b1-8026-4fd8-aefb-dedc07616aa4}) of ThingClass generic</extracomment>
<translation>Setze analogen Ausgang</translation>
</message>
<message>
<source>Set digital input</source>
<extracomment>The name of the ActionType ({3cf5eb01-dae8-49cd-8c5f-b0224be0044f}) of ThingClass generic</extracomment>
<translation>Setze digitalen Eingang</translation>
</message>
<message>
<source>Set digital output</source>
<extracomment>The name of the ActionType ({605b4d8e-71a7-441e-900a-e07c305acd93}) of ThingClass generic</extracomment>
<translation>Setze digitalen Ausgang</translation>
</message>
<message>
<source>Set string state</source>
<extracomment>The name of the ActionType ({f477e227-0d2d-4d88-a545-7dedf36266d5}) of ThingClass generic</extracomment>
<translation>Setze Zeichenkette</translation>
</message>
<message>
<source>String state</source>
<extracomment>The name of the ParamType (ThingClass: generic, ActionType: stringState, ID: {f477e227-0d2d-4d88-a545-7dedf36266d5})
----------
The name of the ParamType (ThingClass: generic, EventType: stringState, ID: {f477e227-0d2d-4d88-a545-7dedf36266d5})
----------
The name of the StateType ({f477e227-0d2d-4d88-a545-7dedf36266d5}) of ThingClass generic</extracomment>
<translation>Zeichenkette</translation>
</message>
<message>
<source>String state changed</source>
<extracomment>The name of the EventType ({f477e227-0d2d-4d88-a545-7dedf36266d5}) of ThingClass generic</extracomment>
<translation>Zeichenkette geändert</translation>
</message>
</context>
<context>
<name>IntegrationPluginGenericThings</name>

View File

@ -1153,6 +1153,106 @@ The name of the StateType ({a61c0328-b982-46a5-9cc0-b4fa4d0ab84d}) of ThingClass
<extracomment>The name of the ActionType ({a61c0328-b982-46a5-9cc0-b4fa4d0ab84d}) of ThingClass battery</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Analog input</source>
<extracomment>The name of the ParamType (ThingClass: generic, ActionType: analogInput, ID: {810fcd3c-7854-4bb1-82f6-1403ba54875e})
----------
The name of the ParamType (ThingClass: generic, EventType: analogInput, ID: {810fcd3c-7854-4bb1-82f6-1403ba54875e})
----------
The name of the StateType ({810fcd3c-7854-4bb1-82f6-1403ba54875e}) of ThingClass generic</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Analog input changed</source>
<extracomment>The name of the EventType ({810fcd3c-7854-4bb1-82f6-1403ba54875e}) of ThingClass generic</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Analog output</source>
<extracomment>The name of the ParamType (ThingClass: generic, ActionType: analogOutput, ID: {de8ec1b1-8026-4fd8-aefb-dedc07616aa4})
----------
The name of the ParamType (ThingClass: generic, EventType: analogOutput, ID: {de8ec1b1-8026-4fd8-aefb-dedc07616aa4})
----------
The name of the StateType ({de8ec1b1-8026-4fd8-aefb-dedc07616aa4}) of ThingClass generic</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Analog output changed</source>
<extracomment>The name of the EventType ({de8ec1b1-8026-4fd8-aefb-dedc07616aa4}) of ThingClass generic</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Digital input</source>
<extracomment>The name of the ParamType (ThingClass: generic, ActionType: digitalInput, ID: {3cf5eb01-dae8-49cd-8c5f-b0224be0044f})
----------
The name of the ParamType (ThingClass: generic, EventType: digitalInput, ID: {3cf5eb01-dae8-49cd-8c5f-b0224be0044f})
----------
The name of the StateType ({3cf5eb01-dae8-49cd-8c5f-b0224be0044f}) of ThingClass generic</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Digital input changed</source>
<extracomment>The name of the EventType ({3cf5eb01-dae8-49cd-8c5f-b0224be0044f}) of ThingClass generic</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Digital output</source>
<extracomment>The name of the ParamType (ThingClass: generic, ActionType: digitalOutput, ID: {605b4d8e-71a7-441e-900a-e07c305acd93})
----------
The name of the ParamType (ThingClass: generic, EventType: digitalOutput, ID: {605b4d8e-71a7-441e-900a-e07c305acd93})
----------
The name of the StateType ({605b4d8e-71a7-441e-900a-e07c305acd93}) of ThingClass generic</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Digital output changed</source>
<extracomment>The name of the EventType ({605b4d8e-71a7-441e-900a-e07c305acd93}) of ThingClass generic</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Generic thing</source>
<extracomment>The name of the ThingClass ({f5c02d35-b06e-4950-8238-847d50cabfdf})</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Set analog input</source>
<extracomment>The name of the ActionType ({810fcd3c-7854-4bb1-82f6-1403ba54875e}) of ThingClass generic</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Set analog output</source>
<extracomment>The name of the ActionType ({de8ec1b1-8026-4fd8-aefb-dedc07616aa4}) of ThingClass generic</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Set digital input</source>
<extracomment>The name of the ActionType ({3cf5eb01-dae8-49cd-8c5f-b0224be0044f}) of ThingClass generic</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Set digital output</source>
<extracomment>The name of the ActionType ({605b4d8e-71a7-441e-900a-e07c305acd93}) of ThingClass generic</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Set string state</source>
<extracomment>The name of the ActionType ({f477e227-0d2d-4d88-a545-7dedf36266d5}) of ThingClass generic</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>String state</source>
<extracomment>The name of the ParamType (ThingClass: generic, ActionType: stringState, ID: {f477e227-0d2d-4d88-a545-7dedf36266d5})
----------
The name of the ParamType (ThingClass: generic, EventType: stringState, ID: {f477e227-0d2d-4d88-a545-7dedf36266d5})
----------
The name of the StateType ({f477e227-0d2d-4d88-a545-7dedf36266d5}) of ThingClass generic</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>String state changed</source>
<extracomment>The name of the EventType ({f477e227-0d2d-4d88-a545-7dedf36266d5}) of ThingClass generic</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>IntegrationPluginGenericThings</name>