ble mesh provisioner sample
Posted: Mon Nov 18, 2019 3:52 am
Hi,
I'm developing a ble mesh gateway using esp32, based on example ble_mesh_provisioner.I can now
provision a ble mesh light, bought from market, and control its onoff. After that, I have some problems:
1, How to communite with node again after the provisioner is rebooted? I tried to save theprovisioned
node information, including dev uuid and unicast, to flash, and then poweroff, then power on again. But
when I use the unicast to send onoff message, it failed. What other steps Ineed to do after rebooting?
2. How to control the level? I have followded everything on onoff_client to add a level_client,but it
failed to send level message to the light with return code ESP_ERR_INVALID_ARG. there is the code snip:
Could you provide a sample about the two questions?
BRs,
I'm developing a ble mesh gateway using esp32, based on example ble_mesh_provisioner.I can now
provision a ble mesh light, bought from market, and control its onoff. After that, I have some problems:
1, How to communite with node again after the provisioner is rebooted? I tried to save theprovisioned
node information, including dev uuid and unicast, to flash, and then poweroff, then power on again. But
when I use the unicast to send onoff message, it failed. What other steps Ineed to do after rebooting?
2. How to control the level? I have followded everything on onoff_client to add a level_client,but it
failed to send level message to the light with return code ESP_ERR_INVALID_ARG. there is the code snip:
Code: Select all
static esp_ble_mesh_client_t level_client;
..............................
static esp_ble_mesh_model_t root_models[] = {
ESP_BLE_MESH_MODEL_CFG_SRV(&config_server),
ESP_BLE_MESH_MODEL_CFG_CLI(&config_client),
ESP_BLE_MESH_MODEL_GEN_ONOFF_CLI(NULL, &onoff_client),
ESP_BLE_MESH_MODEL_GEN_LEVEL_CLI(NULL, &level_client),
};
..............................
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 = BLE_MESH_MODEL_ID_GEN_LEVEL_SRV;
set_state.model_app_bind.company_id = CID_NVAL;
err = esp_ble_mesh_config_client_set_state(&common, &set_state);
..............................
err = esp_ble_mesh_set_msg_common(&common, node, level_client.model, ESP_BLE_MESH_MODEL_OP_GEN_LEVEL_SET);
set_state.level_set.op_en = false;
set_state.level_set.level = atoi(argv[2]);
set_state.level_set.tid = (g_tid += 1);
err = esp_ble_mesh_generic_client_set_state(&common, &set_state);
if (err) {
ESP_LOGE(TAG, "%s: Generic Level Set failed: %d", __func__, err);
return;
}
BRs,