Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I set WIFI SSID and Password before Firmware is uploaded? #128

Open
AntDX316 opened this issue May 31, 2024 · 4 comments
Open

How do I set WIFI SSID and Password before Firmware is uploaded? #128

AntDX316 opened this issue May 31, 2024 · 4 comments

Comments

@AntDX316
Copy link

00:48:31.285 > AP password was not set.
00:48:31.285 > WiFi SSID was not set.
00:48:31.288 > Will stay in AP mode.

If I can configure it myself, I wouldn't have any issues as it should work??
How is the RTSP URL generated?

@rzeldent
Copy link
Owner

rzeldent commented Jun 1, 2024

Apparently you managed to get to the setup page. You have to set/change the password for the SSID otherwise it is not saved.
More information about setting the configuration can be found at: https://github.com/prampec/IotWebConf.

You can of course modify the code to hard code an access point. See https://docs.arduino.cc/tutorials/uno-wifi-rev2/uno-wifi-r2-web-server-ap-mode/

@AntDX316
Copy link
Author

AntDX316 commented Jun 4, 2024

Apparently you managed to get to the setup page. You have to set/change the password for the SSID otherwise it is not saved. More information about setting the configuration can be found at: https://github.com/prampec/IotWebConf.

You can of course modify the code to hard code an access point. See https://docs.arduino.cc/tutorials/uno-wifi-rev2/uno-wifi-r2-web-server-ap-mode/

How do I do that through PlatformIO?

What file do I edit?

edit, nvm I just had to connect to that WIFI SSID instead

@rzeldent
Copy link
Owner

Hi ant,

You can remove all the wifi configuration code and just use:

WiFi.begin("ap", "pw") to connect to your accesspoint.

@theschles
Copy link

theschles commented Sep 24, 2024

@rzeldent wrote:

You can remove all the wifi configuration code and just use:

WiFi.begin("ap", "pw") to connect to your accesspoint.

Possibly wiser to use Arduino secrets management.

The question is, what needs to be commented-out / replaced?

This would get the process started:

  1. Create an arduino_secrets.h file in src/:
#define WIFI_SSID "your_wifi_ssid"
#define WIFI_PASSWORD "your_wifi_password"
  1. Add the src/arduino_secrets.h file to .gitignore

  2. In src/main.cpp, at the very end of the #include section at the top of that file -- immediately after the line #include <settings.h>:

#include "arduino_secrets.h"

...

Here's where I see the SSID and password being used:

auto thingName = String(WIFI_SSID) + "-" + String(ESP.getEfuseMac(), 16);
IotWebConf iotWebConf(thingName.c_str(), &dnsServer, &web_server, WIFI_PASSWORD, CONFIG_VERSION);

and later on within moustache_variable_t substitutions[] = { :

      {"AccessPoint", WiFi.SSID()},

Would that do the trick?

If not, which lines do we comment out? Where do we stick WiFi.begin("ap", "pw");?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants