From bfc44760192832a4997cab1d2c4205c333f9e020 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Mon, 16 Nov 2020 22:18:19 +0100 Subject: [PATCH] allow the same plugin fetching a zigbeenode multiple times inform the zigbeemanager about things finishing loading --- .../hardware/zigbee/zigbeehardwareresourceimplementation.cpp | 4 ++-- libnymea-core/nymeacore.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libnymea-core/hardware/zigbee/zigbeehardwareresourceimplementation.cpp b/libnymea-core/hardware/zigbee/zigbeehardwareresourceimplementation.cpp index 46d84594..a7ef19a8 100644 --- a/libnymea-core/hardware/zigbee/zigbeehardwareresourceimplementation.cpp +++ b/libnymea-core/hardware/zigbee/zigbeehardwareresourceimplementation.cpp @@ -88,12 +88,12 @@ ZigbeeNode *ZigbeeHardwareResourceImplementation::claimNode(ZigbeeHandler *handl return nullptr; } - if (m_nodeHandlers.contains(node)) { + if (m_nodeHandlers.contains(node) && m_nodeHandlers.value(node) != handler) { qCWarning(dcZigbeeResource()) << "Node with address" << extendedAddress << "is already claimed by another handler (" << m_nodeHandlers.value(node)->name() << "). Not allowing node to be reclaimed."; return nullptr; } - m_nodeHandlers.insert(node, handler); + m_nodeHandlers[node] = handler; return node; } diff --git a/libnymea-core/nymeacore.cpp b/libnymea-core/nymeacore.cpp index 6bedb8c9..35d5f1c3 100644 --- a/libnymea-core/nymeacore.cpp +++ b/libnymea-core/nymeacore.cpp @@ -824,7 +824,7 @@ void NymeaCore::thingManagerLoaded() // Evaluate rules on current time onDateTimeChanged(m_timeManager->currentDateTime()); - // Tell zigbee we're done with loading stuff... + // Tell hardare resources we're done with loading stuff... m_hardwareManager->thingsLoaded(); emit initialized();