From 0ceefdb2186baac90eb431080862eb6bbaf3be49 Mon Sep 17 00:00:00 2001 From: nymea Date: Sun, 9 Jun 2019 00:54:55 +0200 Subject: [PATCH] added status state to shading devices --- .../deviceplugingenericinterfaces.cpp | 9 +++++ .../deviceplugingenericinterfaces.json | 39 +++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/genericinterfaces/deviceplugingenericinterfaces.cpp b/genericinterfaces/deviceplugingenericinterfaces.cpp index fa4163d..8dae75c 100644 --- a/genericinterfaces/deviceplugingenericinterfaces.cpp +++ b/genericinterfaces/deviceplugingenericinterfaces.cpp @@ -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; diff --git a/genericinterfaces/deviceplugingenericinterfaces.json b/genericinterfaces/deviceplugingenericinterfaces.json index fd292ba..02be8b3 100644 --- a/genericinterfaces/deviceplugingenericinterfaces.json +++ b/genericinterfaces/deviceplugingenericinterfaces.json @@ -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": [