Refactor get scene membership indication
@@ -6824,17 +6824,14 @@ void DeRestPluginPrivate::handleSceneClusterIndication(TaskItem &task, const deC
lightNode->setSceneCapacity(capacity);
groupInfo->setSceneCount(count);
- QVector<quint8> responseScenes;
+ std::vector<quint8> scenes;
for (uint i = 0; i < count; i++)
{
if (!stream.atEnd())
{
uint8_t sceneId;
stream >> sceneId;
- responseScenes.push_back(sceneId);
-
- DBG_Printf(DBG_INFO, "0x%016X found scene 0x%02X for group 0x%04X\n", ind.srcAddress().ext(), sceneId, groupId);
-
+ scenes.push_back(sceneId);
foundScene(lightNode, group, sceneId);
}
}
@@ -6849,8 +6846,11 @@ void DeRestPluginPrivate::handleSceneClusterIndication(TaskItem &task, const deC
continue;
}
- if (!responseScenes.contains(i->id))
+ if (std::find(scenes.begin(), scenes.end(), i->id) != scenes.end())
{
+ continue; // exists
+ }
+
std::vector<LightState>::iterator st = i->lights().begin();
std::vector<LightState>::iterator stend = i->lights().end();
@@ -6870,9 +6870,11 @@ void DeRestPluginPrivate::handleSceneClusterIndication(TaskItem &task, const deC
}
}
}
- }
+ if (count > 0)
+ {
lightNode->enableRead(READ_SCENE_DETAILS);
+ }
Q_Q(DeRestPlugin);
q->startZclAttributeTimer(checkZclAttributesDelay);
