add simple blind simulation
This commit is contained in:
parent
a8f442ffc1
commit
cd34fd80a2
@ -404,6 +404,52 @@ DeviceManager::DeviceError DevicePluginSimulation::executeAction(Device *device,
|
||||
return DeviceManager::DeviceErrorNoError;
|
||||
}
|
||||
}
|
||||
|
||||
if (device->deviceClassId() == simpleBlindDeviceClassId) {
|
||||
if (action.actionTypeId() == simpleBlindOpenActionTypeId) {
|
||||
qCDebug(dcSimulation()) << "Opening simple blind";
|
||||
return DeviceManager::DeviceErrorNoError;
|
||||
}
|
||||
if (action.actionTypeId() == simpleBlindCloseActionTypeId) {
|
||||
qCDebug(dcSimulation()) << "Closing simple blind";
|
||||
return DeviceManager::DeviceErrorNoError;
|
||||
}
|
||||
if (action.actionTypeId() == simpleBlindStopActionTypeId) {
|
||||
qCDebug(dcSimulation()) << "Stopping simple blind";
|
||||
return DeviceManager::DeviceErrorNoError;
|
||||
}
|
||||
}
|
||||
|
||||
if (device->deviceClassId() == extendedBlindDeviceClassId) {
|
||||
if (action.actionTypeId() == extendedBlindOpenActionTypeId) {
|
||||
qCDebug(dcSimulation()) << "Opening extended blind";
|
||||
m_simulationTimers.value(device)->setProperty("targetValue", 100);
|
||||
m_simulationTimers.value(device)->start(500);
|
||||
device->setStateValue(extendedBlindMovingStateTypeId, true);
|
||||
return DeviceManager::DeviceErrorNoError;
|
||||
}
|
||||
if (action.actionTypeId() == extendedBlindCloseActionTypeId) {
|
||||
qCDebug(dcSimulation()) << "Closing extended blind";
|
||||
m_simulationTimers.value(device)->setProperty("targetValue", 0);
|
||||
m_simulationTimers.value(device)->start(500);
|
||||
device->setStateValue(extendedBlindMovingStateTypeId, true);
|
||||
return DeviceManager::DeviceErrorNoError;
|
||||
}
|
||||
if (action.actionTypeId() == extendedBlindStopActionTypeId) {
|
||||
qCDebug(dcSimulation()) << "Stopping extended blind";
|
||||
m_simulationTimers.value(device)->stop();
|
||||
device->setStateValue(extendedBlindMovingStateTypeId, false);
|
||||
return DeviceManager::DeviceErrorNoError;
|
||||
}
|
||||
if (action.actionTypeId() == extendedBlindPercentageActionTypeId) {
|
||||
qCDebug(dcSimulation()) << "Setting extended blind to" << action.param(extendedBlindPercentageActionPercentageParamTypeId);
|
||||
m_simulationTimers.value(device)->setProperty("targetValue", action.param(extendedBlindPercentageActionPercentageParamTypeId).value());
|
||||
m_simulationTimers.value(device)->start(500);
|
||||
device->setStateValue(extendedBlindMovingStateTypeId, true);
|
||||
return DeviceManager::DeviceErrorNoError;
|
||||
}
|
||||
}
|
||||
|
||||
qCWarning(dcSimulation()) << "Unhandled device class" << device->deviceClassId() << "for device" << device->name();
|
||||
|
||||
return DeviceManager::DeviceErrorDeviceClassNotFound;
|
||||
|
||||
@ -312,6 +312,30 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "a13c14f1-361e-4aad-8785-c04b094fb19a",
|
||||
"name": "simpleBlind",
|
||||
"displayName": "Simple blind",
|
||||
"createMethods": ["user"],
|
||||
"interfaces": ["blind"],
|
||||
"actionTypes": [
|
||||
{
|
||||
"id": "06b99eb1-c3b6-4bea-95cf-690078297206",
|
||||
"name": "open",
|
||||
"displayName": "Open"
|
||||
},
|
||||
{
|
||||
"id": "7f1bdeef-a57c-4b82-80ad-e3e31f16027f",
|
||||
"name": "stop",
|
||||
"displayName": "stop"
|
||||
},
|
||||
{
|
||||
"id": "0c55d32d-c916-472b-a03e-66fe7115e85d",
|
||||
"name": "close",
|
||||
"displayName": "close"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "1d7aaa1d-fc50-4d7b-9657-1449322e40d8",
|
||||
"name": "extendedBlind",
|
||||
@ -327,6 +351,8 @@
|
||||
"type": "int",
|
||||
"unit": "Percentage",
|
||||
"displayNameEvent": "percentage changed",
|
||||
"writable": true,
|
||||
"displayNameAction": "set percentage",
|
||||
"defaultValue": 0
|
||||
},
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user