made actions async
parent
d01a7260bb
commit
b6bb9f41f7
|
|
@ -1,8 +1,14 @@
|
|||
# DoorBird
|
||||
|
||||
This plug-in let'S you capture doorbell pressed and motion events,
|
||||
you are also able to set the power of the IR and the relays.
|
||||
This plugin integrates DoorBird video doorbells into nymea. All the communication between nymea and the DoorBird device happens locally and will work without internet connection.
|
||||
|
||||
It uses a local connection and will work without Internet.
|
||||
Currently supported features are:
|
||||
|
||||
* Doorbell presses
|
||||
* Motion events
|
||||
* Enable/disable IR light
|
||||
* Switching door relays
|
||||
|
||||
The user must have the permission to act as DoorBird API-operator.
|
||||
You can check the permissions in the DoorBird app.
|
||||
|
||||
|
|
|
|||
|
|
@ -195,21 +195,25 @@ void DevicePluginDoorbird::executeAction(DeviceActionInfo *info)
|
|||
if (device->deviceClassId() == doorBirdDeviceClassId) {
|
||||
Doorbird *doorbird = m_doorbirdConnections.value(device->id());
|
||||
if (!doorbird) {
|
||||
qCWarning(dcDoorBird()) << "Doorbird object not found" << device->name();
|
||||
info->finish(Device::DeviceErrorHardwareFailure);
|
||||
return;
|
||||
}
|
||||
if (action.actionTypeId() == doorBirdOpenDoorActionTypeId) {
|
||||
int number = action.param(doorBirdOpenDoorActionNumberParamTypeId).value().toInt();
|
||||
doorbird->openDoor(number);
|
||||
info->finish(Device::DeviceErrorNoError);
|
||||
QUuid requestId = doorbird->openDoor(number);
|
||||
m_asyncActions.insert(requestId, info);
|
||||
connect(info, &DeviceActionInfo::aborted, this, [requestId, this] {m_asyncActions.remove(requestId);});
|
||||
return;
|
||||
} else if (action.actionTypeId() == doorBirdLightOnActionTypeId) {
|
||||
doorbird->lightOn();
|
||||
info->finish(Device::DeviceErrorNoError);
|
||||
QUuid requestId = doorbird->lightOn();
|
||||
m_asyncActions.insert(requestId, info);
|
||||
connect(info, &DeviceActionInfo::aborted, this, [requestId, this] {m_asyncActions.remove(requestId);});
|
||||
return;
|
||||
} else if (action.actionTypeId() == doorBirdRestartActionTypeId) {
|
||||
doorbird->restart();
|
||||
info->finish(Device::DeviceErrorNoError);
|
||||
QUuid requestId = doorbird->restart();
|
||||
m_asyncActions.insert(requestId, info);
|
||||
connect(info, &DeviceActionInfo::aborted, this, [requestId, this] {m_asyncActions.remove(requestId);});
|
||||
return;
|
||||
} else {
|
||||
qCWarning(dcDoorBird()) << "Unhandled ActionTypeId:" << action.actionTypeId();
|
||||
|
|
|
|||
Loading…
Reference in New Issue