added outputs to shadings

master
nymea 2019-06-08 22:02:48 +02:00
parent dd465cc6ca
commit 9bda2e8e0d
2 changed files with 73 additions and 13 deletions

View File

@ -1,3 +1,4 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Copyright (C) 2019 Bernhard Trinnes <bernhard.trinnes@nymea.io *
@ -84,12 +85,18 @@ DeviceManager::DeviceError DevicePluginGenericInterfaces::executeAction(Device *
{
if (device->deviceClassId() == awningDeviceClassId) {
if (action.actionTypeId() == awningOpenActionTypeId) {
device->setStateValue(awningClosingOutputStateTypeId, false);
device->setStateValue(awningOpeningOutputStateTypeId, true);
return DeviceManager::DeviceErrorNoError;
}
if (action.actionTypeId() == awningStopActionTypeId) {
device->setStateValue(awningOpeningOutputStateTypeId, false);
device->setStateValue(awningClosingOutputStateTypeId, false);
return DeviceManager::DeviceErrorNoError;
}
if (action.actionTypeId() == awningCloseActionTypeId) {
device->setStateValue(awningOpeningOutputStateTypeId, false);
device->setStateValue(awningClosingOutputStateTypeId, true);
return DeviceManager::DeviceErrorNoError;
}
return DeviceManager::DeviceErrorActionTypeNotFound;
@ -97,12 +104,18 @@ DeviceManager::DeviceError DevicePluginGenericInterfaces::executeAction(Device *
if (device->deviceClassId() == blindDeviceClassId ) {
if (action.actionTypeId() == blindOpenActionTypeId) {
device->setStateValue(blindClosingOutputStateTypeId, false);
device->setStateValue(blindOpeningOutputStateTypeId, true);
return DeviceManager::DeviceErrorNoError;
}
if (action.actionTypeId() == blindStopActionTypeId) {
device->setStateValue(blindOpeningOutputStateTypeId, false);
device->setStateValue(blindClosingOutputStateTypeId, false);
return DeviceManager::DeviceErrorNoError;
}
if (action.actionTypeId() == blindCloseActionTypeId) {
device->setStateValue(blindOpeningOutputStateTypeId, false);
device->setStateValue(blindClosingOutputStateTypeId, true);
return DeviceManager::DeviceErrorNoError;
}
return DeviceManager::DeviceErrorActionTypeNotFound;
@ -110,25 +123,18 @@ DeviceManager::DeviceError DevicePluginGenericInterfaces::executeAction(Device *
if (device->deviceClassId() == shutterDeviceClassId) {
if (action.actionTypeId() == shutterOpenActionTypeId) {
device->setStateValue(shutterClosingOutputStateTypeId, false);
device->setStateValue(shutterOpeningOutputStateTypeId, true);
return DeviceManager::DeviceErrorNoError;
}
if (action.actionTypeId() == shutterStopActionTypeId) {
device->setStateValue(shutterOpeningOutputStateTypeId, false);
device->setStateValue(shutterClosingOutputStateTypeId, false);
return DeviceManager::DeviceErrorNoError;
}
if (action.actionTypeId() == shutterCloseActionTypeId) {
return DeviceManager::DeviceErrorNoError;
}
return DeviceManager::DeviceErrorActionTypeNotFound;
}
if (device->deviceClassId() == awningDeviceClassId) {
if (action.actionTypeId() == awningOpenActionTypeId) {
return DeviceManager::DeviceErrorNoError;
}
if (action.actionTypeId() == awningStopActionTypeId) {
return DeviceManager::DeviceErrorNoError;
}
if (action.actionTypeId() == awningCloseActionTypeId) {
device->setStateValue(shutterOpeningOutputStateTypeId, false);
device->setStateValue(shutterClosingOutputStateTypeId, true);
return DeviceManager::DeviceErrorNoError;
}
return DeviceManager::DeviceErrorActionTypeNotFound;

View File

@ -14,6 +14,24 @@
"displayName": "Awning",
"createMethods": ["user"],
"interfaces": ["awning"],
"stateTypes": [
{
"id": "7cda95f1-beb8-464e-aa75-ef415ed6744c",
"name": "openingOutput",
"displayName": "Opening output",
"displayNameEvent": "Opening output changed",
"type": "bool",
"defaultValue": false
},
{
"id": "9b673430-572d-4a9c-85d3-dafadbe541cd",
"name": "closingOutput",
"displayName": "Closing output",
"displayNameEvent": "Closing output changed",
"type": "bool",
"defaultValue": false
}
],
"actionTypes": [
{
"id": "979e9c51-5a93-4635-85e3-01874306b229",
@ -38,6 +56,24 @@
"displayName": "Blind",
"createMethods": ["user"],
"interfaces": ["blind"],
"stateTypes": [
{
"id": "7cda95f1-beb8-464e-aa75-ef415ed6744c",
"name": "openingOutput",
"displayName": "Opening output",
"displayNameEvent": "Opening output changed",
"type": "bool",
"defaultValue": false
},
{
"id": "9b673430-572d-4a9c-85d3-dafadbe541cd",
"name": "closingOutput",
"displayName": "Closing output",
"displayNameEvent": "Closing output changed",
"type": "bool",
"defaultValue": false
}
],
"actionTypes": [
{
"id": "120dc265-dbbb-4f19-9d31-c372c23479c0",
@ -62,6 +98,24 @@
"displayName": "Shutter",
"createMethods": ["user"],
"interfaces": ["shutter"],
"stateTypes": [
{
"id": "7cda95f1-beb8-464e-aa75-ef415ed6744c",
"name": "openingOutput",
"displayName": "Opening output",
"displayNameEvent": "Opening output changed",
"type": "bool",
"defaultValue": false
},
{
"id": "9b673430-572d-4a9c-85d3-dafadbe541cd",
"name": "closingOutput",
"displayName": "Closing output",
"displayNameEvent": "Closing output changed",
"type": "bool",
"defaultValue": false
}
],
"actionTypes": [
{
"id": "9deb662d-2378-4345-a898-8742d41e43c1",