Skip to content

Commit

Permalink
Improve reporting for XAL lights
Browse files Browse the repository at this point in the history
- Use level and color control control reporting
- Don't poll lights when fresh enough values are received
  • Loading branch information
manup committed May 6, 2019
1 parent f6c0d29 commit 2e08a88
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
6 changes: 0 additions & 6 deletions bindings.cpp
Expand Up @@ -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))
{
Expand Down
7 changes: 6 additions & 1 deletion poll_manager.cpp
Expand Up @@ -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"))
{
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 2e08a88

Please sign in to comment.