ESP-WIFI-MESH, configuration of parent selection

Jan Konecny
Posts: 4
Joined: Tue Jul 08, 2025 10:25 am

ESP-WIFI-MESH, configuration of parent selection

Postby Jan Konecny » Tue Jul 08, 2025 1:00 pm

Hello all over the forum.
I am trying to find a proper set of parameters of configuration for parent node selection within ESP-WIFI-MESH (ESP-IDF version 5.4).

Could anyone describe the meaning of the parameters of parent selection/switching (or even the whole mechanism) with more details, please?


I have found every fragment of information from the official documentation, source code, this forum and many other sources. Then I was trying to deduce the purpose of parameters very hard. I was comparing parameters of configuration of ESP-WIFI-MESH with many other wireless mesh networks. I was trying to study the compiled code of the library (libmesh.a) to find an answer. But I am still not able to understand the proper meaning of configuration parameters and do not know, how to set them.

According to the documentaion, the selection of parent node is controlled with the following structures defined in esp-mesh-internal.h (https://github.com/espressif/esp-idf/bl ... internal.h)

Code: Select all

typedef struct {
    int high;   /**<  high RSSI threshold, used to determine whether the new parent and the current parent are in the same RSSI range */
    int medium; /**<  medium RSSI threshold, used to determine whether the new parent and the current parent are in the same RSSI range */
    int low;    /**<  low RSSI threshold. If the parent's RSSI is lower than low for a period time of duration_ms,
                      then the mesh node will post MESH_WEAK_RSSI event.
                      Also used to determine whether the new parent and the current parent are in the same RSSI range */
} mesh_rssi_threshold_t;

Code: Select all

typedef struct {
    int duration_ms;   /**< parent weak RSSI monitor duration, if the RSSI continues to be weak during this duration_ms,
                          device will search for a new parent. */
    int cnx_rssi;      /**< RSSI threshold for keeping a good connection with parent.
                          If set a value greater than -120 dBm, a timer will be armed to monitor parent RSSI at a period time of duration_ms. */
    int select_rssi;   /**< RSSI threshold for parent selection. It should be a value greater than switch_rssi. */
    int switch_rssi;   /**< Disassociate with current parent and switch to a new parent when the RSSI is greater than this set threshold. */
    int backoff_rssi;  /**< RSSI threshold for connecting to the root */
} mesh_switch_parent_t;

As far as I am able to understand, the mesh_rssi_threshold_t cuts the whole range of RSSI from -120 dB up to (teoretical) +14 dBm to subranges (cathegories). The values are in dBm and default values are -78 dBm, -82 dBm and -85 dBm respectively. Nodes listened with RSSI below low are ignored. Nodes listened with RSSI from higher subrange are prefered as parent candidates over those from lower subrange.

More as I far as I am able to understand, the mesh_switch_parent_t involves parent node selection/swithing in more detail. The *_rssi values are in dBm, the duration_ms is in miliseconds. The default values are 60000 ms for duration_ms, -120 dBm for cnx_rssi and -78 dBm for select_rssi, switch_rssi and backoff_rssi. The cnx_rssi sets a simple threshold for "good connection for current parent node". If it is set to value higher value than -120 dBm, it is being periodically compared to RSSI of every message received from the current parent (e.g. its beacon). If RSSI listened from the parent is below cnx_rssi (at least single-times) during the period of duration_ms, searching for any better parent is triggered.
The meaning of select_rssi and switch_rssi is not reachable for me and I am hesitating about backoff_rssi.

In the code of libmesh.a library I can see that parent selection/switing also depends on layer and number of associated child nodes of parent candidates within the same RSSI subrange. Moreover there are some more constants of time and maximal counts of repeated tryies for certain phases of the whole process and some RSSI quantizations steps. Due to respect to Espressif, I do not mention any other details here.

The main points of my confusion are the following:
  • 1. Is any mechanism for network self-healing active when cnx_rssi is -120 dBm?
  • 2. What is the relation of items of mesh_rssi_threshold_t and mesh_switch_parent_t and which priority they are applied with?
  • 3. What is the relation of switch_rssi and select_rssi to duration_ms and cnx_rssi? Do switch_rssi and select_rssi make any time-independent hysteresis-based mechanims in oposition to time-dependent hysteresis-free mechanism of duration_ms and cnx_rssi?
  • 4. Why is the mechanism of cnx_rssi and duration_ms deactivated by default?
  • 5. Why are the default values of select_rssi and switch_rssi the same while select_rssi should be greater than select_rssi according to its description?
  • 6. Why is connection to the root of a network (i.e. at the layer 2) evaluated in a specially way with backoff_rssi in comparation to all other upper layers and what is its priority agains to all the other parameters?


Thank very much in advance to any help or hint.
Best regards, Jan Konecny.

References of my research:

EricVs
Posts: 4
Joined: Thu Oct 13, 2022 4:30 pm

Re: ESP-WIFI-MESH, configuration of parent selection

Postby EricVs » Mon Jul 14, 2025 9:32 am

Hi,
Welcome to zoo of parameters! (lol)
Your quest seems mostly focused on RSSI logic. I don't have all your answers, but
I like to point out that there are some other important ways to affect parent selection:
- mesh topology
- maximum layers
- max_connection per node
- fixed root
Some of these settings will make RSSI less relevant, and cause rearrangement to fulfill all limitations.
Many trade-offs to make, depending on your situation...
It is my experience that (except for 1 case) the mesh will always try to self-heal. But it may take quite some time before it realizes that it should do that (assoc_expire).
Regarding the RSSI parameters, I got my mesh working fine with the defaults so far.

Jan Konecny
Posts: 4
Joined: Tue Jul 08, 2025 10:25 am

Re: ESP-WIFI-MESH, configuration of parent selection

Postby Jan Konecny » Mon Jul 14, 2025 11:29 am

Hello.
Thank You for response.

I of course know that parent selecting/switching depend on more than RSSI. But as far as I was able to research, those You have mentioned (i.e. mesh topology, maximal layer, ...) just limits list of parent candidates.
I am sure that in my networks neither maximal layer nor maximal connection per node limit self-healing since there is still many unoccupided layers and connections.
I suppose switching is not happening in my networks, just selecting in case of start or reselecting in case of absolute lost of connection (for some portion of time).
By the way, I am really not sure that mesh topology or fixed root could involve parent selection/switching directly.
However, I am very glad to read that accoridnig to Your experiences the mesh always tries to self-heal.

Due to this I think I need to adjust values of mesh_rssi_threshold_t and mesh_switch_parent_t but do not know how.

Jan Konecny
Posts: 4
Joined: Tue Jul 08, 2025 10:25 am

Re: ESP-WIFI-MESH, configuration of parent selection

Postby Jan Konecny » Thu Aug 07, 2025 10:42 am

A month has left. I would like to ask anyone again for a explanation of parent selecting/switiching configuration (or a hint at least).
I am still trying to find the answear myself but not has been successfull yet.
I thank any response in advance.

Who is online

Users browsing this forum: Qwantbot and 7 guests