Description
Checklist
- Checked the issue tracker for similar issues to ensure this is not a duplicate
- Read the documentation to confirm the issue is not addressed there and your configuration is set correctly
- Tested with the latest version to ensure the issue hasn't been fixed
How often does this bug occurs?
always
Expected behavior
Initial boot connects x nodes on mesh_id '25'
After setting new id into NVS via any method, my chosen method is MQTT, after a power cycle the mesh should come back online on new mesh_id and create mesh with that id and disregard any other mesh_ids
Code below regarding how it is set on boot
esp_mesh_lite_config_t mesh_lite_config = ESP_MESH_LITE_DEFAULT_INIT();
// Mesh ID
if (nvs_open("MeshUID", NVS_READWRITE, &nvsHandle) != ESP_OK) {
mesh_lite_config.mesh_id = CMSN_MESH_ID;
} else {
uint8_t mesh_id = 0;
err = nvs_get_u8(nvsHandle, "MeshUID", &mesh_id);
if (err == ESP_OK) {
mesh_lite_config.mesh_id = mesh_id; // esp_mesh_lite_set_mesh_id(mesh_id, true);
esp_mesh_lite_set_mesh_id(mesh_id, true);
} else {
ESP_LOGW(TAG, "Problem bringing up MeshUID from memory");
mesh_lite_config.mesh_id = 25; // esp_mesh_lite_set_mesh_id(CMSN_MESH_ID, true);
esp_mesh_lite_set_mesh_id(25, true);
}
}
ESP_LOGW(TAG, "Mesh ID: %d", mesh_lite_config.mesh_id);
nvs_close(nvsHandle);
esp_mesh_lite_init(&mesh_lite_config);
ESP_LOGW(TAG, "Calling softap init");
app_wifi_set_softap_info();
ESP_LOGW(TAG, "Mesh has started");
esp_mesh_lite_start();
my setting of mesh_id in my own nvs memspace is done like so below by parsing a JSON packet from MQTT
if(strcmp(keys[i],"meshUID") == 0){//MeshUID
err = nvs_open("MeshUID", NVS_READWRITE, &HANDLER);
if (err != ESP_OK) {
//printf("Error (%s) opening NVS handle!\n", esp_err_to_name(err));
} else {
MeshUID = atoi(values[i]);
err = nvs_set_u8(HANDLER, "MeshUID", MeshUID);
err = nvs_commit(HANDLER);
// free(MeshUID);
}
}
my SDKConfig is as below for the mesh_lite
#define CONFIG_MESH_LITE_ENABLE 1
#define CONFIG_MESH_LITE_VENDOR_ID_0 71
#define CONFIG_MESH_LITE_VENDOR_ID_1 87
#define CONFIG_MESH_LITE_ID 10
#define CONFIG_MESH_LITE_MAX_ROUTER_NUMBER 3
#define CONFIG_MESH_LITE_MAXIMUM_LEVEL_ALLOWED 5
#define CONFIG_MESH_LITE_NODE_INFO_REPORT 1
#define CONFIG_MESH_LITE_REPORT_INTERVAL 300
#define CONFIG_MESH_LITE_MAXIMUM_NODE_NUMBER 50
#define CONFIG_JOIN_MESH_WITHOUT_CONFIGURED_WIFI_INFO 1
#define CONFIG_JOIN_MESH_IGNORE_ROUTER_STATUS 1
Actual behavior (suspected bug)
Initial boot brings x nodes on mesh_id '25'
set new id in NVS for change of id on re-boot
New id confirmed to have been set via ESP_LOGW on re-boot
log of new parent for the device is a parent on mesh_id '25'
Error logs or terminal output
Log of id taking
W (25332) main: Calling Mesh init func
I (25333) [vendor_ie]: Mesh ID: 30
W (25336) main: Mesh ID: 30
I (25340) Mesh-Lite: esp-mesh-lite component version: 1.0.1
I (25346) ESPNOW: espnow [version: 1.0] init
I (25350) [vendor_ie]: Mesh-Lite commit id: 454ded1
I (25356) [vendor_ie]: Mesh ID: 30
changed mesh_id nodes parent MQTT JSON (mac = fc:01:2c:cc:ce:cc)
{"myLevel":2,"myParent":{"mac":"94:a9:90:27:c0:5d","rssi":-46}}
old mesh_id parent's MQTT JSON after change over
{"myLevel":1,"myParent":{"mac":"10:27:f5:68:9a:be","rssi":-62},"myChildren":[{"mac":"fc:01:2c:cc:ce:cc"}]}
Steps to reproduce the behavior
set nvs via timer or otherwise
bring up nvs between init func and struct call as shown above
reboot device, observe the ID change and behaviour
Project release version
v5.3.2
System architecture
Intel/AMD 64-bit (modern PC, older Mac)
Operating system
Windows
Operating system version
Windows 11
Shell
PowerShell
Additional context
No response