juerd / esp-wifisettings Goto Github PK
View Code? Open in Web Editor NEWWiFi Manager for the ESP32 Arduino environment
License: Other
WiFi Manager for the ESP32 Arduino environment
License: Other
Whenever I try to compile this library, I get compile errors saying it cannot convert const char []
to const __FlashStringHelper*
in assignment #define F(string_literal) (string_literal)
.
This is my Platformio.ini file:
[env:esp32thing]
platform = espressif32
board = esp32thing
framework = arduino
lib_deps =
juerd/ESP-WiFiSettings@^3.8.0
And this is the file being compiled:
https://github.com/Juerd/ESP-WiFiSettings/blob/master/examples/Basic/Basic.ino
Can anyone help me?
Using version 3.3.0 of the library on an ESP-WROOM-32 board, specifically the AWS ESP32 Lanyard, the SSID is being truncated at an apostrophe character.
Steps to reproduce:
code:
#include <WiFiSettings.h>
void setup() {
Serial.begin(115200);
SPIFFS.begin(true); // On first run, will format after failing to mount
WiFiSettings.connect();
}
void loop() {
Serial.println("Hello World");
delay(2000);
}
House Bettis's Wi-Fi Network
House Bettis
is not in rangeI'm trying to get CA root certificates configured using the WiFiSettings.string()
, but I keep getting the error that the certificate is invalid, while hardcoding the certificate string in code works.
String hardcoded_cert = "-----BEGIN CERTIFICATE-----\nMIIFYDCCBEigAwIBAgIQQAF3ITfU6UK47naqPGQKtzANBgkqhkiG9w0BAQsFADA/MSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMTDkRTVCBSb290IENBIFgzMB4XDTIxMDEyMDE5MTQwM1oXDTI0MDkzMDE4MTQwM1owTzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2VhcmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCt6CRz9BQ385ueK1coHIe+3LffOJCMbjzmV6B493XCov71am72AE8o295ohmxEk7axY/0UEmu/H9LqMZshftEzPLpI9d1537O4/xLxIZpLwYqGcWlKZmZsj348cL+tKSIG8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FVDC5WxCu2+b9LRPwkSICHXM6webFGJueN7sJ7o5XPWioW5WlHAQU7G75K/QosMrAdSW9MUgNTP52GE24HGNtLi1qoJFlcDyqSMo59ahy2cI2qBDLKobkx/J3vWraV0T9VuGWCLKTVXkcGdtwlfFRjlBz4pYg1htmf5X6DYO8A4jqv2Il9DjXA6USbW1FzXSLr9Ohe8Y4IWS6wY7bCkjCWDcRQJMEhg76fsO3txE+FiYruq9RUWhiF1myv4Q6W+CyBFCDfvp7OOGAN6dEOM4+qR9sdjoSYKEBpsr6GtPAQw4dy753ec5\n-----END CERTIFICATE-----\n";
void setup() {
/*
Setup WiFiSettings
*/
// Set the value of this string the same as the hardcoded_cert
String rest_cert = WiFiSettings.string("rest_cert", 2000, "", T.config_rest_cert);
// Noticed that `\`s gets escaped
rest_cert.replace("\\n", "\n");
WiFiClientSecure wificlient;
// The one from the settings does not work
wificlient.setCACert(rest_cert.c_str());
// The hardcoded cert works
wificlient.setCACert(hardcoded_cert.c_str());
/*
Begin and wait for WiFi Connection
*/
// Will error with the rest_cert configured
wificlient.connect("webscripts-io.waylay.io", 443)
}
I see in the library that the setting values get stored to disk, is it possible that this step encodes the string in some way? Maybe I'm missing something obvious.
Not sure if this is a problem with the library or the ESP32 support from Espressif.
When trying the minimal usage example with the esp32 package v 3.0.1 and an ESP32-C3 board, I get continuously the error
task_wdt: esp_task_wdt_reset(763): task not found
Removing the call to esp_task_wdt_reset() in WiFiSettings.cpp fixes the problem.
Trying the minimal usage example with an ESP32 DEVKIT V1 board, I always get the error, with or without the call to esp_task_wdt_reset().
Hi,
It would be great to be able to manually enter the ssid, this would allow hidden ssid's to be used.
Thanks.
HI Jured,
After connecte to my router, i don't have web interface to change SSID
it is possible to make a modification in the code?
if so how can i do it
thank you
Hello, I'd like to be able to reconfigure some parameters on the portal even after initial configuration by having the portal brought up again after a button press. The button press function to open the portal works but for some reason, I'm not able to open the portal after successfully connecting to the soft AP. The .portal() function was called in the loop function when the button is pressed for 3 seconds. Thanks in advance for the help!
Regards,
Ameer
Hi Jeud,
Is PubSubClient compatible with ESP-WiFiSettings? If so, could you perhaps share a very basic example?
Hello!
This library uses SPIFFS as the only filesystem for ESP32. But in many sources SPIFFS marked as deprecated and it is recommended to move to LittleFS.
Now LittleFS is added to arduino-esp32 and may be preffered filesystem for many projects.
Necessary changes in WiFiSettings.cpp to work using LittleFS:
#ifdef ESP32
#define ESPFS SPIFFS
#define ESPMAC (Sprintf("%06" PRIx64, ESP.getEfuseMac() >> 24))
#include <SPIFFS.h>
should be changed with:
#ifdef ESP32`
#define ESPFS LittleFS
#define ESPMAC (Sprintf("%06" PRIx64, ESP.getEfuseMac() >> 24))
#include <LittleFS.h>
Using this changes everything works fine with LittleFS
Maybe filesystem type should be configurable or lib should work with both filesystems?
Hi,
I came across your useful library and started testing it. Getting the portal and doing what is need is fine however when WiFi network is configured I saw 2 things
First after succesfull config followed by a reboot, connection to my WiFi network failed. Doublechecked pw and that's not the issue.
19:28:53.054 -> Connecting to WiFi SSID Engrie.............................. failed.
19:29:10.139 -> Starting access point for configuration portal
But, this one might not be related to your lib as I have it with the normal WiFi library as well where I need a second reboot to get connected.
However the second reboot gives me an IP (I guess) of 255.255.255.255.
19:29:18.989 -> Connecting to WiFi SSID Engrie.255.255.255.255
I came across that one some weeks ago after upgrading to the new core. The solution was simple but re-create a previous issue. See my comments in one of my apps written
// Next line was needed before Core 1.0.5 to set the hostname correctly
// since Core 1.0.5 rc6 no longer. see espressif/arduino-esp32#4732
// leaving the line will result in getting 255.255.255.255 as IP-address.
// WiFi.config(INADDR_NONE, INADDR_NONE, INADDR_NONE, INADDR_NONE);
// removing line above curres getting ip 255.255.255.255 but
// brings back the issue of hostname not being set in DHCP - DAMMED!!!!
WiFi.mode(WIFI_STA);
WiFi.setHostname(hostname);
WiFi.begin(wifiSSID, wifiPassword, WIFI_ALL_CHANNEL_SCAN);
Is this related or do I have another problem?
NB: The issue I had was I could not get the hostname in my DHCP. with previous core(s) adding the line WiFi.config(INADDR_NONE, INADDR_NONE, INADDR_NONE, INADDR_NONE); curred that one.
Is there a way to make it so when you have a custom password input string field in the AP configuration page, like an MQTT password it ************'s out the password when a user logs into the AP Configuration page like it does the WiFi password. Or is there any easy way to add this functionality to the WiFiSettings.cpp file to have another function like WiFiSettings.passwordstring() in addition to the .string() and .integer() functions?
Hi,
After connecting to AP, I get the message "Connecting to WiFi SSID 'acesspoint'..255.255.255.255", so something went wrong and no connections could be established.
When I commented the line 346 in file WiFiSettings.cpp the issue was gone.
... However there's still this warning:
.../ESP-WiFiSettings/WiFiSettings.cpp: In lambda function:
.../ESP-WiFiSettings/WiFiSettings.cpp:313:40: warning: comparison is always false due to limited range of data type [-Wtype-limits]
313 | opt.replace("{1x}", mode == WIFI_AUTH_WPA2_ENTERPRISE ? "(won't work: 802.1x is not supported)" : "");
| ^
which is solved by this non-invasive change:
--- a/WiFiSettings.cpp
+++ b/WiFiSettings.cpp
@@ -16,7 +16,7 @@
#define esp_task_wdt_reset wdt_reset
#define wifi_auth_mode_t uint8_t // wl_enc_type
#define WIFI_AUTH_OPEN ENC_TYPE_NONE
- #define WIFI_AUTH_WPA2_ENTERPRISE -1337 // not available on ESP8266
+ constexpr auto WIFI_AUTH_WPA2_ENTERPRISE = -1337; // not available on ESP8266
#define setHostname hostname
#define INADDR_NONE IPAddress(0,0,0,0)
Originally posted by @d-a-v in #10 (comment)
I know this library is pretty old and most likely no longer maintained but I find it to be the most versatile library among all the WiFi connection managers for ESP32.
The issue that I have is that I cannot set the AP name of ESP32 device using the WiFiSettings.hostname function. Maybe I am doing something wrong but would really appreciate if someone could guide me with an example on how to properly add hostname (AP name) definition function in my arduino sketch. Thank you!
Hello!
After updating espressif8266 platform to the latest version 3.1.0 can't compile my sketch. I have error, located in ESP-WiFiSettings\WiFiSettings.cpp file.
The error output:
.pio\libdeps\d1_mini_E22-400M30S\ESP-WiFiSettings\WiFiSettings.cpp: In member function 'void WiFiSettingsClass::begin()'
:
.pio\libdeps\d1_mini_E22-400M30S\ESP-WiFiSettings\WiFiSettings.cpp:11:35: error: expected ')' before '__INT32'
11 | #define ESPMAC (Sprintf("%06" PRIx32, ESP.getChipId()))
| ^~~~~~
Environment:
- wemos d1 mini
- CLion + platformio
- platform espressif8266 version 3.1.0
Hi,
This is not really an issue but a request for help.
The library works fine, it is simple and as a good looking interface. I use custom variables with success.
However I need a variable that must be on drop down list (use must choose from one of 20 or more values) on the portal.
This will be similar to the one that appears when we choose the SSID.
It is any way to implement it? I have tried with HTML but without success.
I don' have the skills to modify the library..
Thanks in advance for any help.
Joaquim
Hi,
I just try advanced and OTA version form your sample.
I did compile and run
Serial give me AP and SSID ESP-xxxxx and a password
But this device is not really on air ????
On multiple ESP32's on multiple different Wi-Fi networks, I cannot get the device to connect to Wifi unless I hit "restart" through the portal interface. If I remove the timeout, it never connects and just fills the serial output with periods.
Hi,
Please consider including WPS support.
I googled it and it doesn't look too complicated:
https://bbs.espressif.com/viewtopic.php?t=1096
The reason I'm asking: I found that "end-users" often find it problematic to enter the password for their wifi. Like casing, O versus 0, etc. and wps takes that problem supposedly away.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.