请教一下ESP IDF V5.0 BLE MSEH的配置问题

tangguirong
Posts: 10
Joined: Wed Feb 08, 2023 4:23 am

请教一下ESP IDF V5.0 BLE MSEH的配置问题

Postby tangguirong » Sun May 21, 2023 2:15 am

请教一下,我用ble mesh provisioner示例给 onoff cilent配网后无法成功发送消息,报错: BLE_MESH: Model not bound to AppKey 0x0001 ,使用手机APP EspBleMesh或者nRF Mesh给配网的时候都是可以正常发送消息出去的,请问这是什么原因呢?
我用的ESP32开发板,都使用的是官方示例,一字未改,手机配网后按下 GPIO 0按钮消息能够正常发送成功,目标设备也能成功接收,而同一块onoff cilent使用provisioner配网后,按下按钮就会报错,求求哪位大佬帮忙解答一下,感激不尽!

ESP_@In逍遥子
Posts: 132
Joined: Thu Nov 15, 2018 2:06 am

Re: 请教一下ESP IDF V5.0 BLE MSEH的配置问题

Postby ESP_@In逍遥子 » Tue May 23, 2023 9:36 am

Code: Select all

        switch (opcode) {
        case ESP_BLE_MESH_MODEL_OP_APP_KEY_ADD: {
            esp_ble_mesh_cfg_client_set_state_t set_state = {0};
            example_ble_mesh_set_msg_common(&common, node, config_client.model, ESP_BLE_MESH_MODEL_OP_MODEL_APP_BIND);
            set_state.model_app_bind.element_addr = node->unicast;
            set_state.model_app_bind.model_app_idx = prov_key.app_idx;
            set_state.model_app_bind.model_id = ESP_BLE_MESH_MODEL_ID_GEN_ONOFF_SRV;
            set_state.model_app_bind.company_id = ESP_BLE_MESH_CID_NVAL;
            err = esp_ble_mesh_config_client_set_state(&common, &set_state);
            if (err) {
                ESP_LOGE(TAG, "%s: Config Model App Bind failed", __func__);
                return;
            }
            break;
        }
provisioner 上只有对 onoff server bind App key,没有对 onoff client model bind;而 onoff client 示例,使用的是 onoff client model。

tangguirong
Posts: 10
Joined: Wed Feb 08, 2023 4:23 am

Re: 请教一下ESP IDF V5.0 BLE MSEH的配置问题

Postby tangguirong » Tue May 23, 2023 9:54 am

多谢解答,那请问cilent model应该怎么bind appkey呢?

tangguirong
Posts: 10
Joined: Wed Feb 08, 2023 4:23 am

Re: 请教一下ESP IDF V5.0 BLE MSEH的配置问题

Postby tangguirong » Tue May 23, 2023 9:57 am

ESP_@In逍遥子 wrote:
Tue May 23, 2023 9:36 am

Code: Select all

        switch (opcode) {
        case ESP_BLE_MESH_MODEL_OP_APP_KEY_ADD: {
            esp_ble_mesh_cfg_client_set_state_t set_state = {0};
            example_ble_mesh_set_msg_common(&common, node, config_client.model, ESP_BLE_MESH_MODEL_OP_MODEL_APP_BIND);
            set_state.model_app_bind.element_addr = node->unicast;
            set_state.model_app_bind.model_app_idx = prov_key.app_idx;
            set_state.model_app_bind.model_id = ESP_BLE_MESH_MODEL_ID_GEN_ONOFF_SRV;
            set_state.model_app_bind.company_id = ESP_BLE_MESH_CID_NVAL;
            err = esp_ble_mesh_config_client_set_state(&common, &set_state);
            if (err) {
                ESP_LOGE(TAG, "%s: Config Model App Bind failed", __func__);
                return;
            }
            break;
        }
provisioner 上只有对 onoff server bind App key,没有对 onoff client model bind;而 onoff client 示例,使用的是 onoff client model。
多谢解答,那请问cilent model应该怎么bind appkey呢?

tangguirong
Posts: 10
Joined: Wed Feb 08, 2023 4:23 am

Re: 请教一下ESP IDF V5.0 BLE MSEH的配置问题

Postby tangguirong » Tue May 23, 2023 10:08 am

ESP_@In逍遥子 wrote:
Tue May 23, 2023 9:36 am

Code: Select all

        switch (opcode) {
        case ESP_BLE_MESH_MODEL_OP_APP_KEY_ADD: {
            esp_ble_mesh_cfg_client_set_state_t set_state = {0};
            example_ble_mesh_set_msg_common(&common, node, config_client.model, ESP_BLE_MESH_MODEL_OP_MODEL_APP_BIND);
            set_state.model_app_bind.element_addr = node->unicast;
            set_state.model_app_bind.model_app_idx = prov_key.app_idx;
            set_state.model_app_bind.model_id = ESP_BLE_MESH_MODEL_ID_GEN_ONOFF_SRV;
            set_state.model_app_bind.company_id = ESP_BLE_MESH_CID_NVAL;
            err = esp_ble_mesh_config_client_set_state(&common, &set_state);
            if (err) {
                ESP_LOGE(TAG, "%s: Config Model App Bind failed", __func__);
                return;
            }
            break;
        }
provisioner 上只有对 onoff server bind App key,没有对 onoff client model bind;而 onoff client 示例,使用的是 onoff client model。
我尝试将 set_state.model_app_bind.model_id = ESP_BLE_MESH_MODEL_ID_GEN_ONOFF_SRV;改为set_state.model_app_bind.model_id = ESP_BLE_MESH_MODEL_ID_GEN_ONOFF_CLI;已成功给cilent model bind app key,想请问,provisioner怎么判断当前配置的是cilent model还是sever model

tangguirong
Posts: 10
Joined: Wed Feb 08, 2023 4:23 am

Re: 请教一下ESP IDF V5.0 BLE MSEH的配置问题

Postby tangguirong » Tue May 23, 2023 10:28 am

tangguirong wrote:
Tue May 23, 2023 10:08 am
ESP_@In逍遥子 wrote:
Tue May 23, 2023 9:36 am

Code: Select all

        switch (opcode) {
        case ESP_BLE_MESH_MODEL_OP_APP_KEY_ADD: {
            esp_ble_mesh_cfg_client_set_state_t set_state = {0};
            example_ble_mesh_set_msg_common(&common, node, config_client.model, ESP_BLE_MESH_MODEL_OP_MODEL_APP_BIND);
            set_state.model_app_bind.element_addr = node->unicast;
            set_state.model_app_bind.model_app_idx = prov_key.app_idx;
            set_state.model_app_bind.model_id = ESP_BLE_MESH_MODEL_ID_GEN_ONOFF_SRV;
            set_state.model_app_bind.company_id = ESP_BLE_MESH_CID_NVAL;
            err = esp_ble_mesh_config_client_set_state(&common, &set_state);
            if (err) {
                ESP_LOGE(TAG, "%s: Config Model App Bind failed", __func__);
                return;
            }
            break;
        }
provisioner 上只有对 onoff server bind App key,没有对 onoff client model bind;而 onoff client 示例,使用的是 onoff client model。
我尝试将 set_state.model_app_bind.model_id = ESP_BLE_MESH_MODEL_ID_GEN_ONOFF_SRV;改为set_state.model_app_bind.model_id = ESP_BLE_MESH_MODEL_ID_GEN_ONOFF_CLI;已成功给cilent model bind app key,想请问,provisioner怎么判断当前配置的是cilent model还是sever model
我试图获取param->params->model->model_id和param->params->ctx.model->model_id,但是发现似乎都不对,param->params->model->model_id的值不论配置的是cilent或者sever,它始终都是1,而param->params->ctx.model->model_id打印它时就会Core 0 panic

ESP_@In逍遥子
Posts: 132
Joined: Thu Nov 15, 2018 2:06 am

Re: 请教一下ESP IDF V5.0 BLE MSEH的配置问题

Postby ESP_@In逍遥子 » Wed May 31, 2023 10:07 am

provisioner怎么判断当前配置的是cilent model还是sever model
可以获取对方设备的 composition data,然后从 model id 中判断。

ghoshaljayant
Posts: 2
Joined: Tue Nov 21, 2023 12:01 pm

Re: 请教一下ESP IDF V5.0 BLE MSEH的配置问题

Postby ghoshaljayant » Wed Nov 29, 2023 9:44 am

I am still struggling with the same problem, did any of you got any success ?. The provisioner is not able to bind keys for both onoffserver and onoffclient. Does any one of you uploaded any example in github ?

What i want to achieve is:
Device 1 : onoff client
Device 2: onoff server
Device 3: ble mesh provisioner

I am expecting Device3(provisioner) to provision both Device 1 and Device 2 and bind the keys too.

tangguirong
Posts: 10
Joined: Wed Feb 08, 2023 4:23 am

Re: 请教一下ESP IDF V5.0 BLE MSEH的配置问题

Postby tangguirong » Fri Dec 01, 2023 9:56 am

你好,我是通过给节点UUID中加入model_id,provisioner 扫描到节点后获取model_id,将ESP_BLE_MESH_MODEL_OP_APP_KEY_ADD事件中的set_state.model_app_bind.model_id修改成获取到的model_id,可以实现,不知道方法正不正确,但是能用,你可以试试。

gzk_will
Posts: 4
Joined: Tue Dec 26, 2023 3:21 am

Re: 请教一下ESP IDF V5.0 BLE MSEH的配置问题

Postby gzk_will » Tue Dec 26, 2023 3:33 am

node和provisioner共存 使用provisioner就出错

Who is online

Users browsing this forum: No registered users and 198 guests