INVALID NETKEY INDEX - 0x0000 (ESP BLE MESH)

dhari99
Posts: 5
Joined: Mon Jul 04, 2022 8:36 am

INVALID NETKEY INDEX - 0x0000 (ESP BLE MESH)

Postby dhari99 » Wed Aug 24, 2022 1:00 pm

Hi,

I am trying to control an LED on/off with ESP BLE MESH. I have implemented and tested our setup before and it worked fine. But when i try to implement it now, I am getting "Invalid netkey index - 0x0000" while using the API - "esp_ble_mesh_generic_client_set_state()". The msg opcode I am using to publish a message is "ESP_BLE_MESH_MODEL_OP_GEN_ONOFF_SET_UNACK".

Code snippet:
esp_ble_mesh_generic_client_set_state_t set = {0};
esp_ble_mesh_client_common_param_t common = {0};
esp_err_t err = ESP_OK;

common.opcode = ESP_BLE_MESH_MODEL_OP_GEN_ONOFF_SET_UNACK;
common.model = onoff_client_1.model;
common.ctx.net_idx = store.net_idx;
common.ctx.app_idx = store.app_idx;
//common.ctx.addr = 0xFFFF; /* to all nodes */
common.ctx.addr = addr;
common.ctx.send_ttl = board.default_ttl;
common.ctx.send_rel = false;
common.msg_timeout = 0;
common.msg_role = ROLE_NODE;

set.onoff_set.op_en = false;
set.onoff_set.onoff = 0;
set.onoff_set.tid = store.tid++;

err = esp_ble_mesh_generic_client_set_state(&common, &set);
if (err) {
ESP_LOGE(TAG, "Send Generic OnOff Set Unack failed");
return;
}

Would be really great, if I could get some help in this. Thanks in advance

esp-idf version - 4.4.0
Provisioner - Raspberry pi (Using mesh-cfgclient tool in Bluez)

Who is online

Users browsing this forum: No registered users and 75 guests