File tree 1 file changed +14
-1
lines changed
1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -314,7 +314,20 @@ void esp_zb_app_signal_handler(esp_zb_app_signal_t *signal_struct) {
314
314
// for each endpoint in the list call the findEndpoint function if not bounded or allowed to bind multiple devices
315
315
for (std::list<ZigbeeEP *>::iterator it = Zigbee.ep_objects .begin (); it != Zigbee.ep_objects .end (); ++it) {
316
316
if (!(*it)->bound () || (*it)->epAllowMultipleBinding ()) {
317
- (*it)->findEndpoint (&cmd_req);
317
+ // Check if the device is already bound
318
+ bool found = false ;
319
+ // Gte the list of devices bound to the EP
320
+ std::list<zb_device_params_t *> bound_devices = (*it)->getBoundDevices ();
321
+ for (std::list<zb_device_params_t *>::iterator device = bound_devices.begin (); device != bound_devices.end (); ++device) {
322
+ if (((*device)->short_addr == dev_annce_params->device_short_addr ) || (memcmp ((*device)->ieee_addr , dev_annce_params->ieee_addr , 8 ) == 0 )) {
323
+ found = true ;
324
+ log_d (" Device already bound to endpoint %d" , (*it)->getEndpoint ());
325
+ break ;
326
+ }
327
+ }
328
+ if (!found) {
329
+ (*it)->findEndpoint (&cmd_req);
330
+ }
318
331
}
319
332
}
320
333
}
You can’t perform that action at this time.
0 commit comments