From 2e08a8806850add0c7e3c77796c21b28859f7a11 Mon Sep 17 00:00:00 2001 From: Manuel Pietschmann Date: Mon, 6 May 2019 15:46:19 +0200 Subject: [PATCH] Improve reporting for XAL lights - Use level and color control control reporting - Don't poll lights when fresh enough values are received --- bindings.cpp | 6 ------ poll_manager.cpp | 7 ++++++- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/bindings.cpp b/bindings.cpp index f81f88dcb7..21811ea258 100644 --- a/bindings.cpp +++ b/bindings.cpp @@ -1499,12 +1499,6 @@ void DeRestPluginPrivate::checkLightBindingsForAttributeReporting(LightNode *lig continue; } - // support only XAL on/off cluster for now - if (lightNode->manufacturerCode() == VENDOR_XAL && i->id() != ONOFF_CLUSTER_ID) - { - continue; - } - BindingTask bt; if (checkMacVendor(lightNode->address(), VENDOR_DDEL)) { diff --git a/poll_manager.cpp b/poll_manager.cpp index fb90aff8b8..3f036078d6 100644 --- a/poll_manager.cpp +++ b/poll_manager.cpp @@ -298,7 +298,7 @@ void PollManager::pollTimerFired() clusterId = COLOR_CLUSTER_ID; item = r->item(RConfigColorCapabilities); - if ((!item || item->toNumber() <= 0) && (lightNode->haEndpoint().profileId() != HA_PROFILE_ID || lightNode->manufacturerCode() == VENDOR_115F || lightNode->manufacturerCode() == VENDOR_MUELLER)) + if ((!item || item->toNumber() <= 0) && (lightNode->haEndpoint().profileId() == ZLL_PROFILE_ID || lightNode->manufacturerCode() == VENDOR_115F || lightNode->manufacturerCode() == VENDOR_MUELLER || lightNode->manufacturerCode() == VENDOR_XAL)) { if (item && lightNode->modelId() == QLatin1String("lumi.light.aqcn02")) { @@ -458,6 +458,7 @@ void PollManager::pollTimerFired() size_t fresh = 0; const int reportWaitTime = 360; + const int reportWaitTimeXAL = 60 * 30; for (quint16 attrId : attributes) { // force polling after node becomes reachable, since reporting might not be active @@ -476,6 +477,10 @@ void PollManager::pollTimerFired() { fresh++; } + else if (lightNode && lightNode->manufacturerCode() == VENDOR_XAL && val.timestamp.isValid() && val.timestamp.secsTo(now) < reportWaitTimeXAL) + { + fresh++; // rely on reporting for XAL lights + } } // check that cluster exists on endpoint