diff --git a/de_web_plugin.cpp b/de_web_plugin.cpp index dcce1d3052..0dc1ebbe58 100644 --- a/de_web_plugin.cpp +++ b/de_web_plugin.cpp @@ -18063,19 +18063,31 @@ uint8_t DeRestPluginPrivate::endpoint() return haEndpoint; } + if (!apsCtrl) + { + return 1; + } + const deCONZ::Node *node; - if (apsCtrl && apsCtrl->getNode(0, &node) == 0) + const auto coordMac = apsCtrl->getParameter(deCONZ::ParamMacAddress); + + int i = 0; + while (apsCtrl->getNode(i, &node) == 0) { - std::vector eps = node->endpoints(); + i++; - std::vector::const_iterator i = eps.begin(); - std::vector::const_iterator end = eps.end(); + if (node->address().ext() != coordMac) + { + continue; + } - for (; i != end; ++i) + const auto eps = node->endpoints(); + + for (quint8 ep : eps) { deCONZ::SimpleDescriptor sd; - if (node->copySimpleDescriptor(*i, &sd) == 0) + if (node->copySimpleDescriptor(ep, &sd) == 0) { if (sd.profileId() == HA_PROFILE_ID) {