Merge PR #375: GenericThings: Add a generic door/window sensor

pull/1/head
Jenkins nymea 2021-02-26 10:27:53 +01:00
commit bd55aaefc2
4 changed files with 76 additions and 0 deletions

View File

@ -718,6 +718,14 @@ void IntegrationPluginGenericThings::executeAction(ThingActionInfo *info)
return;
}
Q_ASSERT_X(false, "executeAction", QString("Unhandled actionTypeId: %1").arg(action.actionTypeId().toString()).toUtf8());
} else if (thing->thingClassId() == doorSensorThingClassId) {
if (action.actionTypeId() == doorSensorClosedActionTypeId) {
bool closed = action.paramValue(doorSensorClosedActionClosedParamTypeId).toBool();
qCDebug(dcGenericThings()) << "Door sensor is now" << (closed ? "open" : "closed");
thing->setStateValue(doorSensorClosedStateTypeId, closed);
info->finish(Thing::ThingErrorNoError);
return;
}
} else {
Q_ASSERT_X(false, "executeAction", QString("Unhandled thingClassId: %1").arg(thing->thingClassId().toString()).toUtf8());
}

View File

@ -1212,6 +1212,26 @@
"defaultValue": ""
}
]
},
{
"id": "2d936f56-48ee-4be1-9b3e-28a335ad8085",
"name": "doorSensor",
"displayName": "Gerneric door or window sensor",
"createMethods": ["user"],
"interfaces": ["closablesensor"],
"stateTypes": [
{
"id": "7f5fdc2b-7916-4e90-9c24-558162304f71",
"name": "closed",
"displayName": "Closed",
"displayNameEvent": "Opned or closed",
"displayNameAction": "Set open or closed",
"type": "bool",
"defaultValue": false,
"writable": true,
"ioType": "digitalOutput"
}
]
}
]
}

View File

@ -935,6 +935,30 @@ The name of the StateType ({caf22937-fdf7-41e1-a87b-d11e66c4f4c6}) of ThingClass
<extracomment>The name of the ActionType ({caf22937-fdf7-41e1-a87b-d11e66c4f4c6}) of ThingClass sgReady</extracomment>
<translation>Setze Relais 2</translation>
</message>
<message>
<source>Closed</source>
<extracomment>The name of the ParamType (ThingClass: doorSensor, ActionType: closed, ID: {7f5fdc2b-7916-4e90-9c24-558162304f71})
----------
The name of the ParamType (ThingClass: doorSensor, EventType: closed, ID: {7f5fdc2b-7916-4e90-9c24-558162304f71})
----------
The name of the StateType ({7f5fdc2b-7916-4e90-9c24-558162304f71}) of ThingClass doorSensor</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Gerneric door or window sensor</source>
<extracomment>The name of the ThingClass ({2d936f56-48ee-4be1-9b3e-28a335ad8085})</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Opned or closed</source>
<extracomment>The name of the EventType ({7f5fdc2b-7916-4e90-9c24-558162304f71}) of ThingClass doorSensor</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Set open or closed</source>
<extracomment>The name of the ActionType ({7f5fdc2b-7916-4e90-9c24-558162304f71}) of ThingClass doorSensor</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>IntegrationPluginGenericThings</name>

View File

@ -935,6 +935,30 @@ The name of the StateType ({caf22937-fdf7-41e1-a87b-d11e66c4f4c6}) of ThingClass
<extracomment>The name of the ActionType ({caf22937-fdf7-41e1-a87b-d11e66c4f4c6}) of ThingClass sgReady</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Closed</source>
<extracomment>The name of the ParamType (ThingClass: doorSensor, ActionType: closed, ID: {7f5fdc2b-7916-4e90-9c24-558162304f71})
----------
The name of the ParamType (ThingClass: doorSensor, EventType: closed, ID: {7f5fdc2b-7916-4e90-9c24-558162304f71})
----------
The name of the StateType ({7f5fdc2b-7916-4e90-9c24-558162304f71}) of ThingClass doorSensor</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Gerneric door or window sensor</source>
<extracomment>The name of the ThingClass ({2d936f56-48ee-4be1-9b3e-28a335ad8085})</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Opned or closed</source>
<extracomment>The name of the EventType ({7f5fdc2b-7916-4e90-9c24-558162304f71}) of ThingClass doorSensor</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Set open or closed</source>
<extracomment>The name of the ActionType ({7f5fdc2b-7916-4e90-9c24-558162304f71}) of ThingClass doorSensor</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>IntegrationPluginGenericThings</name>