GenericThings: Add a generic door/window sensor
This commit is contained in:
parent
cdff51655f
commit
ca36496b46
@ -693,6 +693,14 @@ void IntegrationPluginGenericThings::executeAction(ThingActionInfo *info)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Q_ASSERT_X(false, "executeAction", QString("Unhandled actionTypeId: %1").arg(action.actionTypeId().toString()).toUtf8());
|
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 {
|
} else {
|
||||||
Q_ASSERT_X(false, "executeAction", QString("Unhandled thingClassId: %1").arg(thing->thingClassId().toString()).toUtf8());
|
Q_ASSERT_X(false, "executeAction", QString("Unhandled thingClassId: %1").arg(thing->thingClassId().toString()).toUtf8());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1141,6 +1141,26 @@
|
|||||||
"defaultValue": ""
|
"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"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user