Get AP MAC address wihout initializing WiFi
Posted: Sun Apr 17, 2022 6:38 am
I have an application which uses AP mode for provisioning, and I am required to provide a unique SSID. The AP SSID, default password and some other details are stored in records in the NVS, which are created upon the very first device boot.
I was thinking of using the last six digits of the device MAC in combination with a string for the AP SSID. The logic is:
1. Upon boot, check if "first_run" variable in NVS is existing
2/ If not existing, set it and create a record for AP SSID using AP interface MAC address
Step 2 above needs to make a call to, which returns ESP_ERR_WIFI_NOT_INIT. I don't want to initialize the WiFi at this point; that will require de-initializing it right away.
Is there a way to get the MAC address without initializing the WiFi?
Also I'd like to hear some other strategy for generating unique (per device) AP SSIDs, if someone can suggest one.
Thanks
I was thinking of using the last six digits of the device MAC in combination with a string for the AP SSID. The logic is:
1. Upon boot, check if "first_run" variable in NVS is existing
2/ If not existing, set it and create a record for AP SSID using AP interface MAC address
Step 2 above needs to make a call to
Code: Select all
esp_wifi_get_mac(ESP_IF_WIFI_AP, mac)
Is there a way to get the MAC address without initializing the WiFi?
Also I'd like to hear some other strategy for generating unique (per device) AP SSIDs, if someone can suggest one.
Thanks