rzeldent / esp32cam-rtsp

Simple RTSP (streaming image) server for the ESP32CAM. Easy configuration and monitoring through the web interface.
660 stars 117 forks source link

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

Open AntDX316 opened 5 months ago

AntDX316 commented 5 months ago

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 commented 5 months ago

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 commented 5 months ago

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 commented 4 months ago

Hi ant,

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

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

theschles commented 1 month ago

@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"

2) Add the src/arduino_secrets.h file to .gitignore

3) 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");?