Improve sensor reachable check
@@ -1771,6 +1771,57 @@ void DeRestPluginPrivate::checkSensorNodeReachable(Sensor *sensor)
if (it != sensor->node()->endpoints().end())
{
reachable = true;
+
+ // check that all clusters from fingerprint are present
+ for (const deCONZ::SimpleDescriptor &sd : sensor->node()->simpleDescriptors())
+ {
+ if (!reachable)
+ {
+ break;
+ }
+
+ if (sd.endpoint() != sensor->fingerPrint().endpoint)
+ {
+ continue;
+ }
+
+ for (quint16 clusterId : sensor->fingerPrint().inClusters)
+ {
+ bool found = false;
+ for (const deCONZ::ZclCluster &cl : sd.inClusters())
+ {
+ if (clusterId == cl.id())
+ {
+ found = true;
+ break;
+ }
+ }
+ if (!found)
+ {
+ reachable = false;
+ break;
+ }
+ }
+
+ for (quint16 clusterId : sensor->fingerPrint().outClusters)
+ {
+ bool found = false;
+ for (const deCONZ::ZclCluster &cl : sd.outClusters())
+ {
+ if (clusterId == cl.id())
+ {
+ found = true;
+ break;
+ }
+ }
+ if (!found)
+ {
+ reachable = false;
+ break;
+ }
+ }
+
+ }
}
}
