Hello guys, I am trying to publish a message using the API esp_ble_mesh_model_publish(model, opcode, sizeof(data), data, ROLE_NODE) into a group, but the node subscribing it is not receiving the message. The publication is done with a client vendor model I created. The role defined is a Node.
To do that publication in the client node, I set a esp_ble_mesh_model_t model using the esp_ble_mesh_find_vendor_model api, and then manually set the model->pub->publish_addr with the group address I defined (0xC001).
[Codebox] esp_ble_mesh_model_t *model = NULL;
uint32_t opcode = ESP_BLE_MESH_VND_MODEL_OP_TEMPERATURE_ACTUATOR_SET;
uint8_t data[3] = {};
data[DATA_TEMPERATURE_POSITION] = (uint8_t)&dht_state[0].temperature;
ESP_LOGI(TAG,"Inside gen_onoff_set_handler()");
model = esp_ble_mesh_find_vendor_model(&elements[ELEMENT_INDEX],CID_ESP, ESP_BLE_MESH_VND_MODEL_ID_TEMPERATURE_CLIENT);
if (!model) {
return ESP_ERR_INVALID_ARG;
}
// Add the Group address into the model publish_addr in which the message
// will be published
model->pub->publish_addr = TEMPERATURE_GROUP_ADDRESS;
....
err = esp_ble_mesh_model_publish(model, opcode, sizeof(data), data, ROLE_NODE);[/Codebox]
In the server node, the subscribing is done inside ESP_BLE_MESH_MODEL_OP_MODEL_APP_BIND case, in the callback function for configuration server:
[Codebox]
case ESP_BLE_MESH_MODEL_OP_MODEL_APP_BIND:
ESP_LOGI(TAG, "ESP_BLE_MESH_MODEL_OP_MODEL_APP_BIND");
ESP_LOGI(TAG, "elem_addr 0x%04x, app_idx 0x%04x, cid 0x%04x, mod_id 0x%04x",
param->value.state_change.mod_app_bind.element_addr,
param->value.state_change.mod_app_bind.app_idx,
param->value.state_change.mod_app_bind.company_id,
param->value.state_change.mod_app_bind.model_id);
esp_err_t err = esp_ble_mesh_model_subscribe_group_addr(param->value.state_change.mod_app_bind.element_addr,
param->value.state_change.mod_app_bind.company_id,
param->value.state_change.mod_app_bind.model_id,
TEMPERATURE_GROUP_ADDRESS);
if(err != ESP_OK){
ESP_LOGE(TAG, "Failed to subscribe the Group Address");
}
break;
[/Codebox]
When I try to publish the messages in the client node, the ESP_BLE_MESH_MODEL_PUBLISH_COMP_EVT is not generated, according to serial logs:
[Codebox]
I (171980) DHT: model->pub->publish_addr = 49153
I (171980) ESP: Inside ble_mesh_model_send_msg
I (171990) ESP: Inside bt_mesh_model_msg_init
I (171990) ESP: Inside net_buf_simple_add_mem
I (172000) ESP: ble_mesh_model_send_msg: device_role = 0
I (172000) ESP: Inside btc_transfer_context
I (172010) ESP: Inside if (arg)
I (172010) ESP: Inside btc_task_post
I (172020) ESP: btc_task_post: return BT_STATUS_SUCCESS
I (172020) ESP: ble_mesh_model_send_msg status: 0
I (172030) DHT: Publish success. 0
[/Codebox]
Am I missing any step to proceed with the publication.
Server does not receive a publish message
Return to “General Discussion”
Jump to
- English Forum
- Explore
- News
- General Discussion
- FAQ
- Documentation
- Documentation
- Sample Code
- Discussion Forum
- Hardware
- ESP-IDF
- ESP-BOX
- ESP-ADF
- ESP-MDF
- ESP-WHO
- ESP-SkaiNet
- ESP32 Arduino
- IDEs for ESP-IDF
- ESP-AT
- ESP IoT Solution
- ESP RainMaker
- Rust
- ESP8266
- Report Bugs
- Showcase
- Chinese Forum 中文社区
- 活动区
- 乐鑫活动专区
- 讨论区
- 全国大学生物联网设计竞赛乐鑫答疑专区
- ESP-IDF 中文讨论版
- 《ESP32-C3 物联网工程开发实战》书籍讨论版
- 中文文档讨论版
- ESP-AT 中文讨论版
- ESP-BOX 中文讨论版
- ESP IoT Solution 中文讨论版
- ESP-ADF 中文讨论版
- ESP Mesh 中文讨论版
- ESP Cloud 中文讨论版
- ESP-WHO 中文讨论版
- ESP-SkaiNet 中文讨论版
- ESP 生产支持讨论版
- 硬件问题讨论
- 项目展示
Who is online
Users browsing this forum: Kniroxe and 85 guests
- All times are UTC
- Top
- Delete cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. ESP8266EX and ESP32 are some of our products.