Closed Gazelle84 closed 1 month ago
@Gazelle84 ,
The code below registers five endpoints to the device. You can use it as a reference for your project.
esp_zb_on_off_switch_cfg_t switch_cfg = ESP_ZB_DEFAULT_ON_OFF_SWITCH_CONFIG();
esp_zb_ep_list_t *ep_list = esp_zb_ep_list_create();
for (int i = 0; i < 5; i++) {
esp_zb_endpoint_config_t endpoint_config = {
.endpoint = HA_ONOFF_SWITCH_ENDPOINT + i,
.app_profile_id = ESP_ZB_AF_HA_PROFILE_ID,
.app_device_id = ESP_ZB_HA_ON_OFF_SWITCH_DEVICE_ID,
.app_device_version = 0,
};
zcl_basic_manufacturer_info_t info = {
.manufacturer_name = ESP_MANUFACTURER_NAME,
.model_identifier = ESP_MODEL_IDENTIFIER,
};
esp_zb_ep_list_add_ep(ep_list, esp_zb_on_off_switch_clusters_create(&switch_cfg), endpoint_config);
esp_zcl_utility_add_ep_basic_manufacturer_info(ep_list, HA_ONOFF_SWITCH_ENDPOINT + i, &info);
}
esp_zb_device_register(ep_list);
Superb, thanks, i will give it a try and report back.
Doesnt work for me. I only see the first endpoint in coordinator app
@Gazelle84 @xGreenPandax Any update on this issue?
@chshu nothing. Is it possible to provide complete example with multiple different endpoints?
Hello everyone, I've managed to get multiple endpoints working with my home made coordinator. What solved the issue for me, was that In my end device I removed the code which updates the attribute reporting info ie. I removed this line from my end device ESP_ERROR_CHECK(esp_zb_zcl_update_reporting_info(&reporting_info));
and everything started working like a charm. Hope this can help anyone :)
Ive attached the files i ended up with, which appear in mqqt and work as desired.
@xGreenPandax ,
Good job. If the esp-zigbee-lib
and esp-zboss-lib
versions are higher than v1.4.0, the ZCL data model cannot be reused. You'll need to create and register the model for each endpoint, just like the example you provided here.
By the way, I think this issue has been addressed by yourself, could you please consider closing it?
Closing post as this appears to be working for others.
Question
Hi, I’m trying to create multiple endpoints for an esp32-h2 and just cannot get more than one to register in zigbee2mqqt. I’m using the zigbee HA light example which works fine with the provided code. I have used the same code and some snippets to try and add a switch, which compiles but doesn’t register the switch.
if I comment out the light code, it builds and registers the switch, but with both there it only registers the light.
Do I need to create a list of endpoints and register the list? Or do I register them individually? I have tried numbering them from 1 and it behaves the same.
I want to connect around 5 devices to the gpio pins and control them individually. They will be a simple on/off switch. I can’t find any example where multiple endpoints are registered.