add light interface to simulated garageGate

This commit is contained in:
Michael Zanetti 2018-06-01 23:28:21 +02:00
parent 430919f452
commit 4ca8a84ebc
2 changed files with 16 additions and 1 deletions

View File

@ -280,6 +280,11 @@ DeviceManager::DeviceError DevicePluginSimulation::executeAction(Device *device,
qCDebug(dcSimulation()) << "Garage gate not moving";
return DeviceManager::DeviceErrorNoError;
}
if (action.actionTypeId() == garageGatePowerActionTypeId) {
bool power = action.param(garageGatePowerActionParamTypeId).value().toBool();
device->setStateValue(garageGatePowerStateTypeId, power);
return DeviceManager::DeviceErrorNoError;
}
}
if (device->deviceClassId() == rollerShutterDeviceClassId) {

View File

@ -263,7 +263,7 @@
"displayName": "Garage gate",
"createMethods": ["user"],
"deviceIcon": "Garage",
"interfaces": [ "garagegate" ],
"interfaces": [ "garagegate", "light" ],
"paramTypes": [ ],
"stateTypes": [
{
@ -282,6 +282,16 @@
"displayNameEvent": "Intermediate position changed",
"type": "bool",
"defaultValue": false
},
{
"id": "46543561-2690-4072-a6a3-795e1c4f49a8",
"name": "power",
"displayName": "Light power",
"displayNameEvent": "Light power changed",
"displayNameAction": "Set light power",
"type": "bool",
"defaultValue": false,
"writable": true
}
],
"actionTypes": [