From 0bacb2efb8c1d6cf96aaa53f444a02e4563bbd41 Mon Sep 17 00:00:00 2001 From: Boernsman Date: Mon, 10 Feb 2020 18:23:38 +0500 Subject: [PATCH] removed QR code scanner and fixed last seen state --- doorbird/README.md | 8 ++ doorbird/deviceplugindoorbird.cpp | 77 ++++++------ doorbird/deviceplugindoorbird.h | 49 ++++---- doorbird/deviceplugindoorbird.json | 13 -- doorbird/doorbird.cpp | 50 ++++---- doorbird/doorbird.h | 49 ++++---- doorbird/qrcodereader.cpp | 0 doorbird/qrcodereader.h | 0 ...1614a-fc47-4eb2-a47c-13c50f1798ee-en_US.ts | 112 +++++++++++++++++- ...68429-e312-4c82-9eab-e1cd996e43d6-en_US.ts | 4 - 10 files changed, 243 insertions(+), 119 deletions(-) delete mode 100644 doorbird/qrcodereader.cpp delete mode 100644 doorbird/qrcodereader.h delete mode 100644 doorbird/translations/b7368429-e312-4c82-9eab-e1cd996e43d6-en_US.ts diff --git a/doorbird/README.md b/doorbird/README.md index e69de29b..bba30f16 100644 --- a/doorbird/README.md +++ b/doorbird/README.md @@ -0,0 +1,8 @@ +# 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. + +It uses a local connection and will work without Internet. + + diff --git a/doorbird/deviceplugindoorbird.cpp b/doorbird/deviceplugindoorbird.cpp index e34eb03a..ef85a647 100644 --- a/doorbird/deviceplugindoorbird.cpp +++ b/doorbird/deviceplugindoorbird.cpp @@ -1,23 +1,32 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * * - * Copyright (C) 2019 Bernhard Trinnes * - * Copyright (C) 2019 Michael Zanetti * - * * - * This file is part of nymea. * - * * - * nymea is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, version 2 of the License. * - * * - * nymea is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with nymea. If not, see . * - * * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* +* Copyright 2013 - 2020, nymea GmbH +* Contact: contact@nymea.io +* +* This file is part of nymea. +* This project including source code and documentation is protected by +* copyright law, and remains the property of nymea GmbH. All rights, including +* reproduction, publication, editing and translation, are reserved. The use of +* this project is subject to the terms of a license agreement to be concluded +* with nymea GmbH in accordance with the terms of use of nymea GmbH, available +* under https://nymea.io/license +* +* GNU Lesser General Public License Usage +* Alternatively, this project may be redistributed and/or modified under the +* terms of the GNU Lesser General Public License as published by the Free +* Software Foundation; version 3. This project is distributed in the hope that +* it will be useful, but WITHOUT ANY WARRANTY; without even the implied +* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License +* along with this project. If not, see . +* +* For any further details and any questions please contact us under +* contact@nymea.io or see our FAQ/Licensing Information on +* https://nymea.io/license/faq +* +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include "deviceplugindoorbird.h" #include "plugininfo.h" @@ -48,7 +57,13 @@ void DevicePluginDoorbird::discoverDevices(DeviceDiscoveryInfo *info) qCDebug(dcDoorBird) << "Found DoorBird device, name: " << serviceEntry.name() << "\n host address:" << serviceEntry.hostAddress().toString() << "\n text:" << serviceEntry.txt() << serviceEntry.protocol() << serviceEntry.serviceType(); DeviceDescriptor deviceDescriptor(doorBirdDeviceClassId, serviceEntry.name(), serviceEntry.hostAddress().toString()); ParamList params; - QString macAddress = serviceEntry.txt().first(); + QString macAddress; + if (serviceEntry.txt().first().split("=").length() == 2) { + macAddress = serviceEntry.txt().first().split("=").last(); + } else { + qCWarning(dcDoorBird()) << "Could not parse MAC Address" << serviceEntry.txt().first(); + return; + } if (!myDevices().filterByParam(doorBirdDeviceSerialnumberParamTypeId, macAddress).isEmpty()) { Device *existingDevice = myDevices().filterByParam(doorBirdDeviceSerialnumberParamTypeId, serviceEntry.hostName()).first(); deviceDescriptor.setDeviceId(existingDevice->id()); @@ -116,7 +131,6 @@ void DevicePluginDoorbird::setupDevice(DeviceSetupInfo *info) connect(doorbird, &Doorbird::deviceConnected, this, &DevicePluginDoorbird::onDoorBirdConnected); connect(doorbird, &Doorbird::eventReveiced, this, &DevicePluginDoorbird::onDoorBirdEvent); connect(doorbird, &Doorbird::requestSent, this, &DevicePluginDoorbird::onDoorBirdRequestSent); - connect(doorbird, &Doorbird::liveImageReceived, this, &DevicePluginDoorbird::onImageReceived); doorbird->connectToEventMonitor(); m_doorbirdConnections.insert(device, doorbird); info->finish(Device::DeviceErrorNoError); @@ -201,9 +215,7 @@ void DevicePluginDoorbird::onDoorBirdEvent(Doorbird::EventType eventType, bool s break; case Doorbird::EventType::Motion: device->setStateValue(doorBirdIsPresentStateTypeId, status); - if (status) { - doorbird->liveImageRequest(); - } + device->setStateValue(doorBirdLastSeenTimeStateTypeId, QDateTime::currentDateTime().toTime_t()); break; case Doorbird::EventType::Doorbell: if (status) { @@ -226,18 +238,3 @@ void DevicePluginDoorbird::onDoorBirdRequestSent(QUuid requestId, bool success) DeviceActionInfo* actionInfo = m_asyncActions.take(requestId); actionInfo->finish(success ? Device::DeviceErrorNoError : Device::DeviceErrorInvalidParameter); } - -void DevicePluginDoorbird::onImageReceived(QImage image) -{ - Q_UNUSED(image); - Doorbird *doorbird = static_cast(sender()); - Device *device = m_doorbirdConnections.key(doorbird); - if (!device) - return; - //TODO add QR code detection - Event event; - event.setDeviceId(device->id()); - event.setEventTypeId(doorBirdQrCodeDetectedEventTypeId); - event.setParams(ParamList() << Param(doorBirdQrCodeDetectedEventDataParamTypeId, "image received")); - emit emitEvent(event); -} diff --git a/doorbird/deviceplugindoorbird.h b/doorbird/deviceplugindoorbird.h index 9be0a4ee..9c7ebd7f 100644 --- a/doorbird/deviceplugindoorbird.h +++ b/doorbird/deviceplugindoorbird.h @@ -1,22 +1,32 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * * - * Copyright (C) 2019 Michael Zanetti * - * * - * This file is part of nymea. * - * * - * nymea is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, version 2 of the License. * - * * - * nymea is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with nymea. If not, see . * - * * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* +* Copyright 2013 - 2020, nymea GmbH +* Contact: contact@nymea.io +* +* This file is part of nymea. +* This project including source code and documentation is protected by +* copyright law, and remains the property of nymea GmbH. All rights, including +* reproduction, publication, editing and translation, are reserved. The use of +* this project is subject to the terms of a license agreement to be concluded +* with nymea GmbH in accordance with the terms of use of nymea GmbH, available +* under https://nymea.io/license +* +* GNU Lesser General Public License Usage +* Alternatively, this project may be redistributed and/or modified under the +* terms of the GNU Lesser General Public License as published by the Free +* Software Foundation; version 3. This project is distributed in the hope that +* it will be useful, but WITHOUT ANY WARRANTY; without even the implied +* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License +* along with this project. If not, see . +* +* For any further details and any questions please contact us under +* contact@nymea.io or see our FAQ/Licensing Information on +* https://nymea.io/license/faq +* +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #ifndef DEVICEPLUGINDOORBIRD_H #define DEVICEPLUGINDOORBIRD_H @@ -58,7 +68,6 @@ private slots: void onDoorBirdConnected(bool status); void onDoorBirdEvent(Doorbird::EventType eventType, bool status); void onDoorBirdRequestSent(QUuid requestId, bool success); - void onImageReceived(QImage image); }; #endif // DEVICEPLUGINDOORBIRD_H diff --git a/doorbird/deviceplugindoorbird.json b/doorbird/deviceplugindoorbird.json index 6e0057c7..caa78c48 100644 --- a/doorbird/deviceplugindoorbird.json +++ b/doorbird/deviceplugindoorbird.json @@ -91,19 +91,6 @@ "id": "9bc89937-a2ab-4e8e-af0e-a9ba41caa89b", "name": "doorbellPressed", "displayName": "Doorbell pressed" - }, - { - "id": "224f1be5-17d3-460d-9bb8-a25fcdf28936", - "name": "qrCodeDetected", - "displayName": "QR code detected", - "paramTypes": [ - { - "id": "c53068b9-604e-4dfc-8d23-26e8bab0233c", - "name": "data", - "displayName": "Data", - "type": "QString" - } - ] } ] } diff --git a/doorbird/doorbird.cpp b/doorbird/doorbird.cpp index 4fb99b79..0d8b591f 100644 --- a/doorbird/doorbird.cpp +++ b/doorbird/doorbird.cpp @@ -1,23 +1,32 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * * - * Copyright (C) 2019 Bernhard Trinnes * - * Copyright (C) 2019 Michael Zanetti * - * * - * This file is part of nymea. * - * * - * nymea is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, version 2 of the License. * - * * - * nymea is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with nymea. If not, see . * - * * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* +* Copyright 2013 - 2020, nymea GmbH +* Contact: contact@nymea.io +* +* This file is part of nymea. +* This project including source code and documentation is protected by +* copyright law, and remains the property of nymea GmbH. All rights, including +* reproduction, publication, editing and translation, are reserved. The use of +* this project is subject to the terms of a license agreement to be concluded +* with nymea GmbH in accordance with the terms of use of nymea GmbH, available +* under https://nymea.io/license +* +* GNU Lesser General Public License Usage +* Alternatively, this project may be redistributed and/or modified under the +* terms of the GNU Lesser General Public License as published by the Free +* Software Foundation; version 3. This project is distributed in the hope that +* it will be useful, but WITHOUT ANY WARRANTY; without even the implied +* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License +* along with this project. If not, see . +* +* For any further details and any questions please contact us under +* contact@nymea.io or see our FAQ/Licensing Information on +* https://nymea.io/license/faq +* +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include "doorbird.h" #include "extern-plugininfo.h" @@ -206,7 +215,6 @@ QUuid Doorbird::liveAudioReceive() QUuid Doorbird::liveAudioTransmit() { - return QUuid::createUuid(); } diff --git a/doorbird/doorbird.h b/doorbird/doorbird.h index 75a8bb18..da95ab56 100644 --- a/doorbird/doorbird.h +++ b/doorbird/doorbird.h @@ -1,23 +1,32 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * * - * Copyright (C) 2019 Bernhard Trinnes * - * Copyright (C) 2019 Michael Zanetti * - * * - * This file is part of nymea. * - * * - * nymea is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, version 2 of the License. * - * * - * nymea is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with nymea. If not, see . * - * * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* +* Copyright 2013 - 2020, nymea GmbH +* Contact: contact@nymea.io +* +* This file is part of nymea. +* This project including source code and documentation is protected by +* copyright law, and remains the property of nymea GmbH. All rights, including +* reproduction, publication, editing and translation, are reserved. The use of +* this project is subject to the terms of a license agreement to be concluded +* with nymea GmbH in accordance with the terms of use of nymea GmbH, available +* under https://nymea.io/license +* +* GNU Lesser General Public License Usage +* Alternatively, this project may be redistributed and/or modified under the +* terms of the GNU Lesser General Public License as published by the Free +* Software Foundation; version 3. This project is distributed in the hope that +* it will be useful, but WITHOUT ANY WARRANTY; without even the implied +* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License +* along with this project. If not, see . +* +* For any further details and any questions please contact us under +* contact@nymea.io or see our FAQ/Licensing Information on +* https://nymea.io/license/faq +* +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #ifndef DOORBIRD_H #define DOORBIRD_H diff --git a/doorbird/qrcodereader.cpp b/doorbird/qrcodereader.cpp deleted file mode 100644 index e69de29b..00000000 diff --git a/doorbird/qrcodereader.h b/doorbird/qrcodereader.h deleted file mode 100644 index e69de29b..00000000 diff --git a/doorbird/translations/6fe1614a-fc47-4eb2-a47c-13c50f1798ee-en_US.ts b/doorbird/translations/6fe1614a-fc47-4eb2-a47c-13c50f1798ee-en_US.ts index f7f66d85..3dbea2ab 100644 --- a/doorbird/translations/6fe1614a-fc47-4eb2-a47c-13c50f1798ee-en_US.ts +++ b/doorbird/translations/6fe1614a-fc47-4eb2-a47c-13c50f1798ee-en_US.ts @@ -1,4 +1,114 @@ - \ No newline at end of file + + DevicePluginDoorbird + + + Please enter the user credentials + + + + + doorBird + + + + Connected + The name of the ParamType (DeviceClass: doorBird, EventType: connected, ID: {186c270b-923c-46e4-a7da-33e45427cdbb}) +---------- +The name of the StateType ({186c270b-923c-46e4-a7da-33e45427cdbb}) of DeviceClass doorBird + + + + + Connected changed + The name of the EventType ({186c270b-923c-46e4-a7da-33e45427cdbb}) of DeviceClass doorBird + + + + + + + DoorBird + The name of the DeviceClass ({0485eb61-2a22-42ba-9dd2-a5961485bf08}) +---------- +The name of the vendor ({2da07435-571e-4956-a387-6caa51d6e845}) +---------- +The name of the plugin doorBird ({6fe1614a-fc47-4eb2-a47c-13c50f1798ee}) + + + + + Doorbell pressed + The name of the EventType ({9bc89937-a2ab-4e8e-af0e-a9ba41caa89b}) of DeviceClass doorBird + + + + + IP address + The name of the ParamType (DeviceClass: doorBird, Type: device, ID: {8873b17d-526e-408d-95d8-6439b501f489}) + + + + + Light on + The name of the ActionType ({3a6cfc5d-804c-4d21-91b5-999913d4f1a5}) of DeviceClass doorBird + + + + + + Motion sensor last seen time + The name of the ParamType (DeviceClass: doorBird, EventType: lastSeenTime, ID: {295c9700-b598-4681-898f-d63e2889cedf}) +---------- +The name of the StateType ({295c9700-b598-4681-898f-d63e2889cedf}) of DeviceClass doorBird + + + + + Motion sensor last seen time changedd + The name of the EventType ({295c9700-b598-4681-898f-d63e2889cedf}) of DeviceClass doorBird + + + + + + Motion sensor presence + The name of the ParamType (DeviceClass: doorBird, EventType: isPresent, ID: {0f5eb200-6c0d-45c5-9156-3060fd66d332}) +---------- +The name of the StateType ({0f5eb200-6c0d-45c5-9156-3060fd66d332}) of DeviceClass doorBird + + + + + Motion sensor presence detected + The name of the EventType ({0f5eb200-6c0d-45c5-9156-3060fd66d332}) of DeviceClass doorBird + + + + + Open door + The name of the ActionType ({b6c3377b-91de-411a-9d48-8b509c39d67c}) of DeviceClass doorBird + + + + + Relay number + The name of the ParamType (DeviceClass: doorBird, ActionType: openDoor, ID: {95dd35d7-0bc3-49e1-af96-d8da8ea5244d}) + + + + + Restart + The name of the ActionType ({e874242e-5acb-4d98-94c7-0a70db65150c}) of DeviceClass doorBird + + + + + Serial number + The name of the ParamType (DeviceClass: doorBird, Type: device, ID: {67ea5534-330a-4291-93b5-0237034e15fa}) + + + + diff --git a/doorbird/translations/b7368429-e312-4c82-9eab-e1cd996e43d6-en_US.ts b/doorbird/translations/b7368429-e312-4c82-9eab-e1cd996e43d6-en_US.ts deleted file mode 100644 index f7f66d85..00000000 --- a/doorbird/translations/b7368429-e312-4c82-9eab-e1cd996e43d6-en_US.ts +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file