added status state to shading devices

pull/1/head
nymea 2019-06-09 00:54:55 +02:00
parent 2d1ff9ab42
commit 0ceefdb218
2 changed files with 48 additions and 0 deletions

View File

@ -85,16 +85,19 @@ DeviceManager::DeviceError DevicePluginGenericInterfaces::executeAction(Device *
{
if (device->deviceClassId() == awningDeviceClassId) {
if (action.actionTypeId() == awningOpenActionTypeId) {
device->setStateValue(awningStatusStateTypeId, "Opening");
device->setStateValue(awningClosingOutputStateTypeId, false);
device->setStateValue(awningOpeningOutputStateTypeId, true);
return DeviceManager::DeviceErrorNoError;
}
if (action.actionTypeId() == awningStopActionTypeId) {
device->setStateValue(awningStatusStateTypeId, "Stopped");
device->setStateValue(awningOpeningOutputStateTypeId, false);
device->setStateValue(awningClosingOutputStateTypeId, false);
return DeviceManager::DeviceErrorNoError;
}
if (action.actionTypeId() == awningCloseActionTypeId) {
device->setStateValue(awningStatusStateTypeId, "Closing");
device->setStateValue(awningOpeningOutputStateTypeId, false);
device->setStateValue(awningClosingOutputStateTypeId, true);
return DeviceManager::DeviceErrorNoError;
@ -104,16 +107,19 @@ DeviceManager::DeviceError DevicePluginGenericInterfaces::executeAction(Device *
if (device->deviceClassId() == blindDeviceClassId ) {
if (action.actionTypeId() == blindOpenActionTypeId) {
device->setStateValue(blindStatusStateTypeId, "Opening");
device->setStateValue(blindClosingOutputStateTypeId, false);
device->setStateValue(blindOpeningOutputStateTypeId, true);
return DeviceManager::DeviceErrorNoError;
}
if (action.actionTypeId() == blindStopActionTypeId) {
device->setStateValue(blindStatusStateTypeId, "Stopped");
device->setStateValue(blindOpeningOutputStateTypeId, false);
device->setStateValue(blindClosingOutputStateTypeId, false);
return DeviceManager::DeviceErrorNoError;
}
if (action.actionTypeId() == blindCloseActionTypeId) {
device->setStateValue(blindStatusStateTypeId, "Closing");
device->setStateValue(blindOpeningOutputStateTypeId, false);
device->setStateValue(blindClosingOutputStateTypeId, true);
return DeviceManager::DeviceErrorNoError;
@ -123,16 +129,19 @@ DeviceManager::DeviceError DevicePluginGenericInterfaces::executeAction(Device *
if (device->deviceClassId() == shutterDeviceClassId) {
if (action.actionTypeId() == shutterOpenActionTypeId) {
device->setStateValue(shutterStatusStateTypeId, "Opening");
device->setStateValue(shutterClosingOutputStateTypeId, false);
device->setStateValue(shutterOpeningOutputStateTypeId, true);
return DeviceManager::DeviceErrorNoError;
}
if (action.actionTypeId() == shutterStopActionTypeId) {
device->setStateValue(shutterStatusStateTypeId, "Stopped");
device->setStateValue(shutterOpeningOutputStateTypeId, false);
device->setStateValue(shutterClosingOutputStateTypeId, false);
return DeviceManager::DeviceErrorNoError;
}
if (action.actionTypeId() == shutterCloseActionTypeId) {
device->setStateValue(shutterStatusStateTypeId, "Closing");
device->setStateValue(shutterOpeningOutputStateTypeId, false);
device->setStateValue(shutterClosingOutputStateTypeId, true);
return DeviceManager::DeviceErrorNoError;

View File

@ -30,6 +30,19 @@
"displayNameEvent": "Closing output changed",
"type": "bool",
"defaultValue": false
},
{
"id": "13c6dd56-368e-41be-873e-1c1706fe78a9",
"name": "status",
"displayName": "Status",
"displayNameEvent": "Status changed",
"type": "QString",
"possibleValues": [
"Opening",
"Stopped",
"Closing"
],
"defaultValue": "Stopped"
}
],
"actionTypes": [
@ -72,6 +85,19 @@
"displayNameEvent": "Closing output changed",
"type": "bool",
"defaultValue": false
},
{
"id": "13c6dd56-368e-41be-873e-1c1706fe78a9",
"name": "status",
"displayName": "Status",
"displayNameEvent": "Status changed",
"type": "QString",
"possibleValues": [
"Opening",
"Stopped",
"Closing"
],
"defaultValue": "Stopped"
}
],
"actionTypes": [
@ -114,6 +140,19 @@
"displayNameEvent": "Closing output changed",
"type": "bool",
"defaultValue": false
},
{
"id": "13c6dd56-368e-41be-873e-1c1706fe78a9",
"name": "status",
"displayName": "Status",
"displayNameEvent": "Status changed",
"type": "QString",
"possibleValues": [
"Opening",
"Stopped",
"Closing"
],
"defaultValue": "Stopped"
}
],
"actionTypes": [