Merge branch 'master' into update-tasks
This commit is contained in:
10
.github/workflows/build.yml
vendored
10
.github/workflows/build.yml
vendored
@@ -33,6 +33,11 @@ jobs:
|
||||
run: pip install --upgrade platformio
|
||||
- name: Install ESPTool
|
||||
run: pip install --upgrade esptool
|
||||
- name: Add version info
|
||||
env:
|
||||
Version: ${{ github.run_id }}.${{ github.run_number }}.${{ github.run_attempt }}
|
||||
run: |
|
||||
sed -i "s/unknownbuildnr/$Version (release)/g" src/Config.h
|
||||
- name: Build PlatformIO Project esp32dev
|
||||
run: |
|
||||
pio run --environment esp32dev
|
||||
@@ -96,6 +101,11 @@ jobs:
|
||||
with:
|
||||
name: esp32solo1-assets
|
||||
path: release/esp32solo1
|
||||
- name: Add version info
|
||||
env:
|
||||
Version: ${{ github.run_id }}.${{ github.run_number }}.${{ github.run_attempt }}
|
||||
run: |
|
||||
sed -i "s/$Version (release)/$Version (debug)/g" src/Config.h
|
||||
- name: Build PlatformIO Project esp32dev_dbg
|
||||
run: |
|
||||
pio run --environment esp32dev_dbg
|
||||
|
||||
@@ -10,7 +10,7 @@ It exposes the lock state (and much more) through MQTT and allows executing comm
|
||||
|
||||
***Nuki Hub does not integrate with the Nuki mobile app, it can't register itself as a bridge in the official Nuki mobile app.***
|
||||
|
||||
Feel free to join us on Discord: https://discord.gg/24HxpGBJ
|
||||
Feel free to join us on Discord: https://discord.gg/9nPq85bP4p
|
||||
|
||||
## Supported devices
|
||||
|
||||
@@ -116,6 +116,7 @@ In a browser navigate to the IP address assigned to the ESP32.
|
||||
- MQTT SSL Client Key: Optionally set to the Client SSL key of the MQTT broker, see the "[MQTT Encryption](#mqtt-encryption-optional-wi-fi-and-lan8720-only)" section of this README.
|
||||
- Network hardware: "Wi-Fi only" by default, set to one of the specified ethernet modules if available, see the "Supported Ethernet devices" and "[Connecting via Ethernet](#connecting-via-ethernet-optional)" section of this README.
|
||||
- Disable fallback to Wi-Fi / Wi-Fi config portal: By default the Nuki Hub will fallback to Wi-Fi and open the Wi-Fi configuration portal when the network connection fails. Enable this setting to disable this fallback.
|
||||
- Connect to AP with the best signal in an environment with multiple APs with the same SSID: Enable to perform a scan for the Access Point with the best signal strenght for the specified SSID in a multi AP/Mesh environment.
|
||||
- RSSI Publish interval: Set to a positive integer to set the amount of seconds between updates to the maintenance/wifiRssi MQTT topic with the current Wi-Fi RSSI, set to -1 to disable, default 60.
|
||||
- Network Timeout until restart: Set to a positive integer to restart the Nuki Hub after the set amount of seconds has passed without an active connection to the MQTT broker, set to -1 to disable, default 60.
|
||||
- Restart on disconnect: Enable to restart the Nuki Hub after 60 seconds without a connection to a network.
|
||||
|
||||
@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.5)
|
||||
idf_component_register(
|
||||
SRCS "WiFiManager.cpp"
|
||||
INCLUDE_DIRS "."
|
||||
REQUIRES arduino
|
||||
PRIV_REQUIRES arduino
|
||||
)
|
||||
|
||||
project(WiFiManager)
|
||||
|
||||
@@ -5,7 +5,8 @@ Espressif ESPx WiFi Connection manager with fallback web configuration portal
|
||||
|
||||
:warning: This Documentation is out of date, see notes below
|
||||
|
||||

|
||||
<a name="release"></a>
|
||||
[](#release)
|
||||
|
||||
[](https://github.com/tzapu/WiFiManager/actions/workflows/compile_library.yml)
|
||||
|
||||
@@ -20,6 +21,7 @@ Espressif ESPx WiFi Connection manager with fallback web configuration portal
|
||||
[](https://www.espressif.com/en/products/socs/esp32)
|
||||
[](https://www.espressif.com/en/products/socs/esp32-s2)
|
||||
[](https://www.espressif.com/en/products/socs/esp32-c3)
|
||||
[](https://www.espressif.com/en/products/socs/esp32-S3)
|
||||
|
||||
Member to Member Support / Chat
|
||||
|
||||
@@ -28,15 +30,10 @@ Member to Member Support / Chat
|
||||
[](https://discord.gg/nS5WGkaQH5)
|
||||
The configuration portal is of the captive variety, so on various devices it will present the configuration dialogue as soon as you connect to the created access point.
|
||||
|
||||
**This works with the ESP8266 Arduino platform**
|
||||
|
||||
[https://github.com/esp8266/Arduino](https://github.com/esp8266/Arduino)
|
||||
|
||||
**This works with the ESP32 Arduino platform**
|
||||
|
||||
[https://github.com/espressif/arduino-esp32](https://github.com/espressif/arduino-esp32)
|
||||
Works with the [ESP8266 Arduino](https://github.com/esp8266/Arduino) and [ESP32 Arduino](https://github.com/espressif/arduino-esp32) platforms.
|
||||
|
||||
### Known Issues
|
||||
|
||||
* Documentation needs to be updated, see [https://github.com/tzapu/WiFiManager/issues/500](https://github.com/tzapu/WiFiManager/issues/500)
|
||||
-------
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -51,10 +51,10 @@
|
||||
// #warning ESP32S3
|
||||
// #endif
|
||||
|
||||
#if defined(ARDUINO_ESP32S3_DEV) || defined(CONFIG_IDF_TARGET_ESP32S3)
|
||||
#warning "WM_NOTEMP"
|
||||
#define WM_NOTEMP // disabled temp sensor, have to determine which chip we are on
|
||||
#endif
|
||||
// #if defined(ARDUINO_ESP32S3_DEV) || defined(CONFIG_IDF_TARGET_ESP32S3)
|
||||
// #warning "WM_NOTEMP"
|
||||
// #define WM_NOTEMP // disabled temp sensor, have to determine which chip we are on
|
||||
// #endif
|
||||
|
||||
// #include "soc/efuse_reg.h" // include to add efuse chip rev to info, getChipRevision() is almost always the same though, so not sure why it matters.
|
||||
|
||||
@@ -222,19 +222,28 @@ class WiFiManagerParameter {
|
||||
protected:
|
||||
void init(const char *id, const char *label, const char *defaultValue, int length, const char *custom, int labelPlacement);
|
||||
|
||||
private:
|
||||
WiFiManagerParameter& operator=(const WiFiManagerParameter&);
|
||||
const char *_id;
|
||||
const char *_label;
|
||||
char *_value;
|
||||
int _length;
|
||||
int _labelPlacement;
|
||||
protected:
|
||||
|
||||
const char *_customHTML;
|
||||
friend class WiFiManager;
|
||||
};
|
||||
|
||||
|
||||
// debugging
|
||||
typedef enum {
|
||||
WM_DEBUG_SILENT = 0, // debug OFF but still compiled for runtime
|
||||
WM_DEBUG_ERROR = 1, // error only
|
||||
WM_DEBUG_NOTIFY = 2, // default stable,INFO
|
||||
WM_DEBUG_VERBOSE = 3, // move verbose info
|
||||
WM_DEBUG_DEV = 4, // development useful debugging info
|
||||
WM_DEBUG_MAX = 5 // MAX extra dev auditing, var dumps etc (MAX+1 will print timing,mem and frag info)
|
||||
} wm_debuglevel_t;
|
||||
|
||||
class WiFiManager
|
||||
{
|
||||
public:
|
||||
@@ -340,6 +349,7 @@ class WiFiManager
|
||||
// toggle debug output
|
||||
void setDebugOutput(boolean debug);
|
||||
void setDebugOutput(boolean debug, String prefix); // log line prefix, default "*wm:"
|
||||
void setDebugOutput(boolean debug, wm_debuglevel_t level ); // log line prefix, default "*wm:"
|
||||
|
||||
//set min quality percentage to include in scan, defaults to 8% if not specified
|
||||
void setMinimumSignalQuality(int quality = 8);
|
||||
@@ -402,6 +412,9 @@ class WiFiManager
|
||||
|
||||
// if true (default) then stop the config portal from autoConnect when wifi is saved
|
||||
void setDisableConfigPortal(boolean enable);
|
||||
|
||||
// if true then find the AP with the best RSSI for the given SSID
|
||||
void setFindBestRSSI(boolean enabled);
|
||||
|
||||
// set a custom hostname, sets sta and ap dhcp client id for esp32, and sta for esp8266
|
||||
bool setHostname(const char * hostname);
|
||||
@@ -499,7 +512,7 @@ class WiFiManager
|
||||
|
||||
std::unique_ptr<WM_WebServer> server;
|
||||
|
||||
private:
|
||||
protected:
|
||||
// vars
|
||||
std::vector<uint8_t> _menuIds;
|
||||
std::vector<const char *> _menuIdsParams = {"wifi","param","info","exit"};
|
||||
@@ -550,7 +563,7 @@ class WiFiManager
|
||||
uint16_t _httpPort = 80; // port for webserver
|
||||
// uint8_t _retryCount = 0; // counter for retries, probably not needed if synchronous
|
||||
uint8_t _connectRetries = 1; // number of sta connect retries, force reconnect, wait loop (connectimeout) does not always work and first disconnect bails
|
||||
bool _aggresiveReconn = true; // use an agrressive reconnect strategy, WILL delay conxs
|
||||
bool _aggresiveReconn = false; // use an agrressive reconnect strategy, WILL delay conxs
|
||||
// on some conn failure modes will add delays and many retries to work around esp and ap bugs, ie, anti de-auth protections
|
||||
// https://github.com/tzapu/WiFiManager/issues/1067
|
||||
bool _allowExit = true; // allow exit in nonblocking, else user exit/abort calls will be ignored including cptimeout
|
||||
@@ -584,6 +597,7 @@ class WiFiManager
|
||||
boolean _showBack = false; // show back button
|
||||
boolean _enableConfigPortal = true; // FOR autoconnect - start config portal if autoconnect failed
|
||||
boolean _disableConfigPortal = true; // FOR autoconnect - stop config portal if cp wifi save
|
||||
boolean _findBestRSSI = false; // find best rssi ap in wifiscan
|
||||
String _hostname = ""; // hostname for esp8266 for dhcp, and or MDNS
|
||||
|
||||
const char* _customHeadElement = ""; // store custom head element html from user isnide <head>
|
||||
@@ -608,9 +622,15 @@ class WiFiManager
|
||||
// but not limited to, we could run continuous background scans on various page hits, or xhr hits
|
||||
// which would be better coupled with asyncscan
|
||||
// atm preload is only done on root hit and startcp
|
||||
boolean _preloadwifiscan = true; // preload wifiscan if true
|
||||
//
|
||||
// preload scanning causes AP to delay showing for users, but also caches and lets the cp load faster once its open
|
||||
// my scan takes 7-10 seconds
|
||||
public:
|
||||
boolean _preloadwifiscan = false; // preload wifiscan if true
|
||||
unsigned int _scancachetime = 30000; // ms cache time for preload scans
|
||||
boolean _asyncScan = true; // perform wifi network scan async
|
||||
boolean _asyncScan = false; // perform wifi network scan async
|
||||
|
||||
protected:
|
||||
|
||||
boolean _autoforcerescan = false; // automatically force rescan if scan networks is 0, ignoring cache
|
||||
|
||||
@@ -647,13 +667,16 @@ class WiFiManager
|
||||
void updateConxResult(uint8_t status);
|
||||
|
||||
// webserver handlers
|
||||
void HTTPSend(String content);
|
||||
public:
|
||||
void handleNotFound();
|
||||
protected:
|
||||
void HTTPSend(const String &content);
|
||||
void handleRoot();
|
||||
void handleWifi(boolean scan);
|
||||
void handleWifiSave();
|
||||
void handleInfo();
|
||||
void handleReset();
|
||||
void handleNotFound();
|
||||
|
||||
void handleExit();
|
||||
void handleClose();
|
||||
// void handleErase();
|
||||
@@ -748,8 +771,15 @@ class WiFiManager
|
||||
boolean abort = false;
|
||||
boolean reset = false;
|
||||
boolean configPortalActive = false;
|
||||
|
||||
|
||||
// these are state flags for portal mode, we are either in webportal mode(STA) or configportal mode(AP)
|
||||
// these are mutually exclusive as STA+AP mode is not supported due to channel restrictions and stability
|
||||
// if we decide to support this, these checks will need to be replaced with something client aware to check if client origin is ap or web
|
||||
// These state checks are critical and used for internal function checks
|
||||
boolean webPortalActive = false;
|
||||
boolean portalTimeoutResult = false;
|
||||
|
||||
boolean portalAbortResult = false;
|
||||
boolean storeSTAmode = true; // option store persistent STA mode in connectwifi
|
||||
int timer = 0; // timer for debug throttle for numclients, and portal timeout messages
|
||||
@@ -759,26 +789,17 @@ class WiFiManager
|
||||
int _max_params;
|
||||
WiFiManagerParameter** _params = NULL;
|
||||
|
||||
// debugging
|
||||
typedef enum {
|
||||
DEBUG_ERROR = 0,
|
||||
DEBUG_NOTIFY = 1, // default stable
|
||||
DEBUG_VERBOSE = 2,
|
||||
DEBUG_DEV = 3, // default dev
|
||||
DEBUG_MAX = 4
|
||||
} wm_debuglevel_t;
|
||||
|
||||
boolean _debug = true;
|
||||
String _debugPrefix = FPSTR(S_debugPrefix);
|
||||
|
||||
wm_debuglevel_t debugLvlShow = DEBUG_VERBOSE; // at which level start showing [n] level tags
|
||||
wm_debuglevel_t debugLvlShow = WM_DEBUG_VERBOSE; // at which level start showing [n] level tags
|
||||
|
||||
// build debuglevel support
|
||||
// @todo use DEBUG_ESP_x?
|
||||
|
||||
// Set default debug level
|
||||
#ifndef WM_DEBUG_LEVEL
|
||||
#define WM_DEBUG_LEVEL DEBUG_NOTIFY
|
||||
#define WM_DEBUG_LEVEL WM_DEBUG_NOTIFY
|
||||
#endif
|
||||
|
||||
// override debug level OFF
|
||||
@@ -820,7 +841,7 @@ class WiFiManager
|
||||
std::function<void()> _resetcallback;
|
||||
std::function<void()> _preotaupdatecallback;
|
||||
std::function<void()> _configportaltimeoutcallback;
|
||||
|
||||
|
||||
bool _hasCredentials = false;
|
||||
char _credUser[31] = {0};
|
||||
char _credPassword[31] = {0};
|
||||
|
||||
@@ -31,6 +31,8 @@ bool ALLOWONDEMAND = true; // enable on demand
|
||||
int ONDDEMANDPIN = 0; // gpio for button
|
||||
bool WMISBLOCKING = true; // use blocking or non blocking mode, non global params wont work in non blocking
|
||||
|
||||
uint8_t BUTTONFUNC = 1; // 0 resetsettings, 1 configportal, 2 autoconnect
|
||||
|
||||
// char ssid[] = "*************"; // your network SSID (name)
|
||||
// char pass[] = "********"; // your network password
|
||||
|
||||
@@ -72,15 +74,24 @@ void saveParamCallback(){
|
||||
}
|
||||
|
||||
void bindServerCallback(){
|
||||
wm.server->on("/custom",handleRoute); // this is now crashing esp32 for some reason
|
||||
// wm.server->on("/info",handleRoute); // you can override wm!
|
||||
wm.server->on("/custom",handleRoute);
|
||||
|
||||
// you can override wm route endpoints, I have not found a way to remove handlers, but this would let you disable them or add auth etc.
|
||||
// wm.server->on("/info",handleNotFound);
|
||||
// wm.server->on("/update",handleNotFound);
|
||||
wm.server->on("/erase",handleNotFound); // disable erase
|
||||
}
|
||||
|
||||
void handleRoute(){
|
||||
Serial.println("[HTTP] handle route");
|
||||
Serial.println("[HTTP] handle custom route");
|
||||
wm.server->send(200, "text/plain", "hello from user code");
|
||||
}
|
||||
|
||||
void handleNotFound(){
|
||||
Serial.println("[HTTP] override handle route");
|
||||
wm.handleNotFound();
|
||||
}
|
||||
|
||||
void handlePreOtaUpdateCallback(){
|
||||
Update.onProgress([](unsigned int progress, unsigned int total) {
|
||||
Serial.printf("CUSTOM Progress: %u%%\r", (progress / (total / 100)));
|
||||
@@ -92,9 +103,11 @@ void setup() {
|
||||
|
||||
// put your setup code here, to run once:
|
||||
Serial.begin(115200);
|
||||
|
||||
delay(3000);
|
||||
// Serial.setDebugOutput(true);
|
||||
|
||||
// WiFi.setTxPower(WIFI_POWER_8_5dBm);
|
||||
|
||||
Serial.println("\n Starting");
|
||||
// WiFi.setSleepMode(WIFI_NONE_SLEEP); // disable sleep, can improve ap stability
|
||||
|
||||
@@ -109,7 +122,7 @@ void setup() {
|
||||
// WiFi.setSortMethod(WIFI_CONNECT_AP_BY_SIGNAL); // wifi_sort_method_t sortMethod - WIFI_CONNECT_AP_BY_SIGNAL,WIFI_CONNECT_AP_BY_SECURITY
|
||||
// WiFi.setMinSecurity(WIFI_AUTH_WPA2_PSK);
|
||||
|
||||
wm.setDebugOutput(true);
|
||||
wm.setDebugOutput(true, WM_DEBUG_DEV);
|
||||
wm.debugPlatformInfo();
|
||||
|
||||
//reset settings - for testing
|
||||
@@ -127,7 +140,7 @@ void setup() {
|
||||
WiFiManagerParameter custom_input_type("input_pwd", "input pass", "", 15,"type='password'"); // custom input attrs (ip mask)
|
||||
|
||||
const char _customHtml_checkbox[] = "type=\"checkbox\"";
|
||||
WiFiManagerParameter custom_checkbox("my_checkbox", "My Checkbox", "T", 2, _customHtml_checkbox,WFM_LABEL_AFTER);
|
||||
WiFiManagerParameter custom_checkbox("my_checkbox", "My Checkbox", "T", 2, _customHtml_checkbox, WFM_LABEL_AFTER);
|
||||
|
||||
const char *bufferStr = R"(
|
||||
<!-- INPUT CHOICE -->
|
||||
@@ -205,7 +218,7 @@ void setup() {
|
||||
*/
|
||||
|
||||
std::vector<const char *> menu = {"wifi","wifinoscan","info","param","custom","close","sep","erase","update","restart","exit"};
|
||||
wm.setMenu(menu); // custom menu, pass vector
|
||||
// wm.setMenu(menu); // custom menu, pass vector
|
||||
|
||||
// wm.setParamsPage(true); // move params to seperate page, not wifi, do not combine with setmenu!
|
||||
|
||||
@@ -226,7 +239,7 @@ void setup() {
|
||||
|
||||
// set Hostname
|
||||
|
||||
wm.setHostname(("WM_"+wm.getDefaultAPName()).c_str());
|
||||
// wm.setHostname(("WM_"+wm.getDefaultAPName()).c_str());
|
||||
// wm.setHostname("WM_RANDO_1234");
|
||||
|
||||
// set custom channel
|
||||
@@ -245,9 +258,10 @@ void setup() {
|
||||
wm.setConfigPortalBlocking(false);
|
||||
}
|
||||
|
||||
|
||||
//sets timeout until configuration portal gets turned off
|
||||
//useful to make it all retry or go to sleep in seconds
|
||||
wm.setConfigPortalTimeout(120);
|
||||
wm.setConfigPortalTimeout(TESP_CP_TIMEOUT);
|
||||
|
||||
// set min quality to show in web list, default 8%
|
||||
// wm.setMinimumSignalQuality(50);
|
||||
@@ -313,12 +327,13 @@ void setup() {
|
||||
|
||||
void wifiInfo(){
|
||||
// can contain gargbage on esp32 if wifi is not ready yet
|
||||
Serial.println("[WIFI] WIFI INFO DEBUG");
|
||||
// WiFi.printDiag(Serial);
|
||||
Serial.println("[WIFI] WIFI_INFO DEBUG");
|
||||
WiFi.printDiag(Serial);
|
||||
Serial.println("[WIFI] MODE: " + (String)(wm.getModeString(WiFi.getMode())));
|
||||
Serial.println("[WIFI] SAVED: " + (String)(wm.getWiFiIsSaved() ? "YES" : "NO"));
|
||||
Serial.println("[WIFI] SSID: " + (String)wm.getWiFiSSID());
|
||||
Serial.println("[WIFI] PASS: " + (String)wm.getWiFiPass());
|
||||
Serial.println("[WIFI] HOSTNAME: " + (String)WiFi.getHostname());
|
||||
// Serial.println("[WIFI] HOSTNAME: " + (String)WiFi.getHostname());
|
||||
}
|
||||
|
||||
void loop() {
|
||||
@@ -327,31 +342,40 @@ void loop() {
|
||||
wm.process();
|
||||
}
|
||||
|
||||
|
||||
#ifdef USEOTA
|
||||
ArduinoOTA.handle();
|
||||
#endif
|
||||
// is configuration portal requested?
|
||||
if (ALLOWONDEMAND && digitalRead(ONDDEMANDPIN) == LOW ) {
|
||||
delay(100);
|
||||
if ( digitalRead(ONDDEMANDPIN) == LOW ){
|
||||
if ( digitalRead(ONDDEMANDPIN) == LOW || BUTTONFUNC == 2){
|
||||
Serial.println("BUTTON PRESSED");
|
||||
|
||||
// button reset/reboot
|
||||
// wm.resetSettings();
|
||||
// wm.reboot();
|
||||
// delay(200);
|
||||
// return;
|
||||
|
||||
wm.setConfigPortalTimeout(140);
|
||||
wm.setParamsPage(false); // move params to seperate page, not wifi, do not combine with setmenu!
|
||||
|
||||
// disable captive portal redirection
|
||||
// wm.setCaptivePortalEnable(false);
|
||||
|
||||
if (!wm.startConfigPortal("OnDemandAP","12345678")) {
|
||||
Serial.println("failed to connect and hit timeout");
|
||||
delay(3000);
|
||||
if(BUTTONFUNC == 0){
|
||||
wm.resetSettings();
|
||||
wm.reboot();
|
||||
delay(200);
|
||||
return;
|
||||
}
|
||||
|
||||
// start configportal
|
||||
if(BUTTONFUNC == 1){
|
||||
if (!wm.startConfigPortal("OnDemandAP","12345678")) {
|
||||
Serial.println("failed to connect and hit timeout");
|
||||
delay(3000);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
//test autoconnect as reconnect etc.
|
||||
if(BUTTONFUNC == 2){
|
||||
wm.setConfigPortalTimeout(TESP_CP_TIMEOUT);
|
||||
wm.autoConnect();
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
//if you get here you have connected to the WiFi
|
||||
|
||||
@@ -227,6 +227,7 @@ button:hover{
|
||||
<form action='/erase' method='post'><button class='D'>Erase</button></form><br/>
|
||||
<form action='/restart' method='post'><button>Restart</button></form><br/>
|
||||
<form action='/exit' method='post'><button>Exit</button></form><br/>
|
||||
<form action='/exit' method='post'><button>Update</button></form><br/>
|
||||
<form action='/' method='post'><button>Back</button></form><br/>
|
||||
<!-- /HTTP_PORTAL_MENU -->
|
||||
<!-- SAMPLE -->
|
||||
@@ -251,7 +252,7 @@ button:hover{
|
||||
<div><a href='#p' onclick='c(this)'>{v}</a><div role='img' aria-label='{r}%' title='{r}%' class='q q-{q} {i}'></div></div>
|
||||
<!-- /HTTP_ITEM -->
|
||||
<!-- HTTP_FORM_START -->
|
||||
<form method='get' action='wifisave'><label for='s'>SSID</label><br/><input id='s' name='s' length=32 placeholder='SSID'><br/><label for='p'>Password</label><input id='p' name='p' length=64 type='password' placeholder='password'><input type='checkbox' onclick='f()'> Show Password<br/>
|
||||
<form method='get' action='wifisave'><label for='s'>SSID</label><br/><input id='s' name='s' length=32 placeholder='SSID'><br/><label for='p'>Password</label><input id='p' name='p' length=64 type='password' placeholder='password'><input type='checkbox' id='show-password' onclick='f()'> <label for='show-password'>Show Password</label><br/>
|
||||
<!-- /HTTP_FORM_START -->
|
||||
<!-- SAMPLE -->
|
||||
<h3>custom parameter</h3><hr>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "WiFiManager",
|
||||
"version": "2.0.15-rc.1",
|
||||
"version": "2.0.17",
|
||||
"keywords": "wifi,wi-fi,esp,esp8266,esp32,espressif8266,espressif32,nodemcu,wemos,arduino",
|
||||
"description": "WiFi Configuration manager with web configuration portal for ESP boards",
|
||||
"authors":
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
name=WiFiManager
|
||||
version=2.0.15-rc.1
|
||||
version=2.0.17
|
||||
author=tzapu
|
||||
maintainer=tablatronix
|
||||
sentence=WiFi Configuration manager with web configuration portal for Espressif ESPx boards, by tzapu
|
||||
|
||||
@@ -17,22 +17,34 @@
|
||||
// -----------------------------------------------------------------------------------------------
|
||||
// TOKENS
|
||||
|
||||
const char WM_VERSION_STR[] PROGMEM = "v2.0.15-rc.1";
|
||||
const char WM_VERSION_STR[] PROGMEM = "v2.0.17";
|
||||
|
||||
const uint8_t _nummenutokens = 11;
|
||||
const char * const _menutokens[_nummenutokens] PROGMEM = {
|
||||
"wifi",
|
||||
"wifinoscan",
|
||||
"info",
|
||||
"param",
|
||||
"close",
|
||||
"restart",
|
||||
"exit",
|
||||
"erase",
|
||||
"update",
|
||||
"sep",
|
||||
"custom"
|
||||
static const char _wifi_token[] PROGMEM = "wifi";
|
||||
static const char _wifinoscan_token[] PROGMEM = "wifinoscan";
|
||||
static const char _info_token[] PROGMEM = "info";
|
||||
static const char _param_token[] PROGMEM = "param";
|
||||
static const char _close_token[] PROGMEM = "close";
|
||||
static const char _restart_token[] PROGMEM = "restart";
|
||||
static const char _exit_token[] PROGMEM = "exit";
|
||||
static const char _erase_token[] PROGMEM = "erase";
|
||||
static const char _update_token[] PROGMEM = "update";
|
||||
static const char _sep_token[] PROGMEM = "sep";
|
||||
static const char _custom_token[] PROGMEM = "custom";
|
||||
static PGM_P _menutokens[] PROGMEM = {
|
||||
_wifi_token,
|
||||
_wifinoscan_token,
|
||||
_info_token,
|
||||
_param_token,
|
||||
_close_token,
|
||||
_restart_token,
|
||||
_exit_token,
|
||||
_erase_token,
|
||||
_update_token,
|
||||
_sep_token,
|
||||
_custom_token
|
||||
};
|
||||
const uint8_t _nummenutokens = (sizeof(_menutokens) / sizeof(PGM_P));
|
||||
|
||||
|
||||
const char R_root[] PROGMEM = "/";
|
||||
const char R_wifi[] PROGMEM = "/wifi";
|
||||
|
||||
@@ -63,7 +63,7 @@ const char HTTP_ITEM[] PROGMEM = "<div><a href='#p' onclick='c(this)
|
||||
// const char HTTP_ITEM[] PROGMEM = "<div><a href='#p' onclick='c(this)'>{v}</a> {R} {r}% {q} {e}</div>"; // test all tokens
|
||||
|
||||
const char HTTP_FORM_START[] PROGMEM = "<form method='POST' action='{v}'>";
|
||||
const char HTTP_FORM_WIFI[] PROGMEM = "<label for='s'>SSID</label><input id='s' name='s' maxlength='32' autocorrect='off' autocapitalize='none' placeholder='{v}'><br/><label for='p'>Password</label><input id='p' name='p' maxlength='64' type='password' placeholder='{p}'><input type='checkbox' onclick='f()'> Show Password";
|
||||
const char HTTP_FORM_WIFI[] PROGMEM = "<label for='s'>SSID</label><input id='s' name='s' maxlength='32' autocorrect='off' autocapitalize='none' placeholder='{v}'><br/><label for='p'>Password</label><input id='p' name='p' maxlength='64' type='password' placeholder='{p}'><input type='checkbox' id='showpass' onclick='f()'> <label for='showpass'>Show Password</label><br/>";
|
||||
const char HTTP_FORM_WIFI_END[] PROGMEM = "";
|
||||
const char HTTP_FORM_STATIC_HEAD[] PROGMEM = "<hr><br/>";
|
||||
const char HTTP_FORM_END[] PROGMEM = "<br/><br/><button type='submit'>Save</button></form>";
|
||||
|
||||
282
lib/WiFiManager/wm_strings_es.h
Normal file
282
lib/WiFiManager/wm_strings_es.h
Normal file
@@ -0,0 +1,282 @@
|
||||
/**
|
||||
* SAMPLE SAMPLE SAMPLE
|
||||
*
|
||||
* wm_strings_es.h
|
||||
* spanish strings for
|
||||
* WiFiManager, a library for the ESPX/Arduino platform
|
||||
* for configuration of WiFi credentials using a Captive Portal
|
||||
*
|
||||
* @author Creator tzapu
|
||||
* @author tablatronix
|
||||
* @version 0.0.0
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
#ifndef _WM_STRINGS_EN_H_
|
||||
#define _WM_STRINGS_EN_H_
|
||||
|
||||
|
||||
/**
|
||||
* ADD TO BUILD FLAGS
|
||||
* -DWM_STRINGS_FILE="\"wm_strings_es.h\""
|
||||
*/
|
||||
|
||||
#ifndef WIFI_MANAGER_OVERRIDE_STRINGS
|
||||
// !!! ABOVE WILL NOT WORK if you define in your sketch, must be build flag, if anyone one knows how to order includes to be able to do this it would be neat.. I have seen it done..
|
||||
|
||||
// strings files must include a consts file!
|
||||
// Copy and change to custom locale tokens if necessary, but strings should be good enough
|
||||
#include "wm_consts_en.h" // include constants, tokens, routes
|
||||
|
||||
const char WM_LANGUAGE[] PROGMEM = "es-ES"; // i18n lang code
|
||||
|
||||
const char HTTP_HEAD_START[] PROGMEM = "<!DOCTYPE html>"
|
||||
"<html lang='en'><head>"
|
||||
"<meta name='format-detection' content='telephone=no'>"
|
||||
"<meta charset='UTF-8'>"
|
||||
"<meta name='viewport' content='width=device-width,initial-scale=1,user-scalable=no'/>"
|
||||
"<title>{v}</title>";
|
||||
|
||||
const char HTTP_SCRIPT[] PROGMEM = "<script>function c(l){"
|
||||
"document.getElementById('s').value=l.getAttribute('data-ssid')||l.innerText||l.textContent;"
|
||||
"p = l.nextElementSibling.classList.contains('l');"
|
||||
"document.getElementById('p').disabled = !p;"
|
||||
"if(p)document.getElementById('p').focus();};"
|
||||
"function f() {var x = document.getElementById('p');x.type==='password'?x.type='text':x.type='password';}"
|
||||
"</script>"; // @todo add button states, disable on click , show ack , spinner etc
|
||||
|
||||
const char HTTP_HEAD_END[] PROGMEM = "</head><body class='{c}'><div class='wrap'>"; // {c} = _bodyclass
|
||||
// example of embedded logo, base64 encoded inline, No styling here
|
||||
// const char HTTP_ROOT_MAIN[] PROGMEM = "<img title=' alt=' src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAADQElEQVRoQ+2YjW0VQQyE7Q6gAkgFkAogFUAqgFQAVACpAKiAUAFQAaECQgWECggVGH1PPrRvn3dv9/YkFOksoUhhfzwz9ngvKrc89JbnLxuA/63gpsCmwCADWwkNEji8fVNgotDM7osI/x777x5l9F6JyB8R4eeVql4P0y8yNsjM7KGIPBORp558T04A+CwiH1UVUItiUQmZ2XMReSEiAFgjAPBeVS96D+sCYGaUx4cFbLfmhSpnqnrZuqEJgJnd8cQplVLciAgX//Cf0ToIeOB9wpmloLQAwpnVmAXgdf6pwjpJIz+XNoeZQQZlODV9vhc1Tuf6owrAk/8qIhFbJH7eI3eEzsvydQEICqBEkZwiALfF70HyHPpqScPV5HFjeFu476SkRA0AzOfy4hYwstj2ZkDgaphE7m6XqnoS7Q0BOPs/sw0kDROzjdXcCMFCNwzIy0EcRcOvBACfh4k0wgOmBX4xjfmk4DKTS31hgNWIKBCI8gdzogTgjYjQWFMw+o9LzJoZ63GUmjWm2wGDc7EvDDOj/1IVMIyD9SUAL0WEhpriRlXv5je5S+U1i2N88zdPuoVkeB+ls4SyxCoP3kVm9jsjpEsBLoOBNC5U9SwpGdakFkviuFP1keblATkTENTYcxkzgxTKOI3jyDxqLkQT87pMA++H3XvJBYtsNbBN6vuXq5S737WqHkW1VgMQNXJ0RshMqbbT33sJ5kpHWymzcJjNTeJIymJZtSQd9NHQHS1vodoFoTMkfbJzpRnLzB2vi6BZAJxWaCr+62BC+jzAxVJb3dmmiLzLwZhZNPE5e880Suo2AZgB8e8idxherqUPnT3brBDTlPxO3Z66rVwIwySXugdNd+5ejhqp/+NmgIwGX3Py3QBmlEi54KlwmjkOytQ+iJrLJj23S4GkOeecg8G091no737qvRRdzE+HLALQoMTBbJgBsCj5RSWUlUVJiZ4SOljb05eLFWgoJ5oY6yTyJp62D39jDANoKKcSocPJD5dQYzlFAFZJflUArgTPZKZwLXAnHmerfJquUkKZEgyzqOb5TuDt1P3nwxobqwPocZA11m4A1mBx5IxNgRH21ti7KbAGiyNn3HoF/gJ0w05A8xclpwAAAABJRU5ErkJggg==' /><h1>{v}</h1><h3>WiFiManager</h3>";
|
||||
const char HTTP_ROOT_MAIN[] PROGMEM = "<h1>{t}</h1><h3>{v}</h3>";
|
||||
|
||||
const char * const HTTP_PORTAL_MENU[] PROGMEM = {
|
||||
"<form action='/wifi' method='get'><button>Configurar WiFi</button></form><br/>\n", // MENU_WIFI
|
||||
"<form action='/0wifi' method='get'><button>Configurar WiFi (sin escanear)</button></form><br/>\n", // MENU_WIFINOSCAN
|
||||
"<form action='/info' method='get'><button>Información</button></form><br/>\n", // MENU_INFO
|
||||
"<form action='/param' method='get'><button>Configuración</button></form><br/>\n",//MENU_PARAM
|
||||
"<form action='/close' method='get'><button>Cerca</button></form><br/>\n", // MENU_CLOSE
|
||||
"<form action='/restart' method='get'><button>Reanudar</button></form><br/>\n",// MENU_RESTART
|
||||
"<form action='/exit' method='get'><button>Salida</button></form><br/>\n", // MENU_EXIT
|
||||
"<form action='/erase' method='get'><button class='D'>Borrar</button></form><br/>\n", // MENU_ERASE
|
||||
"<form action='/update' method='get'><button>Actualizer</button></form><br/>\n",// MENU_UPDATE
|
||||
"<hr><br/>" // MENU_SEP
|
||||
};
|
||||
|
||||
// const char HTTP_PORTAL_OPTIONS[] PROGMEM = strcat(HTTP_PORTAL_MENU[0] , HTTP_PORTAL_MENU[3] , HTTP_PORTAL_MENU[7]);
|
||||
const char HTTP_PORTAL_OPTIONS[] PROGMEM = "";
|
||||
const char HTTP_ITEM_QI[] PROGMEM = "<div role='img' aria-label='{r}%' title='{r}%' class='q q-{q} {i} {h}'></div>"; // rssi icons
|
||||
const char HTTP_ITEM_QP[] PROGMEM = "<div class='q {h}'>{r}%</div>"; // rssi percentage {h} = hidden showperc pref
|
||||
const char HTTP_ITEM[] PROGMEM = "<div><a href='#p' onclick='c(this)' data-ssid='{V}'>{v}</a>{qi}{qp}</div>"; // {q} = HTTP_ITEM_QI, {r} = HTTP_ITEM_QP
|
||||
// const char HTTP_ITEM[] PROGMEM = "<div><a href='#p' onclick='c(this)'>{v}</a> {R} {r}% {q} {e}</div>"; // test all tokens
|
||||
|
||||
const char HTTP_FORM_START[] PROGMEM = "<form method='POST' action='{v}'>";
|
||||
const char HTTP_FORM_WIFI[] PROGMEM = "<label for='s'>SSID</label><input id='s' name='s' maxlength='32' autocorrect='off' autocapitalize='none' placeholder='{v}'><br/><label for='p'>Contraseña</label><input id='p' name='p' maxlength='64' type='password' placeholder='{p}'><input type='checkbox' onclick='f()'> Mostrar contraseña";
|
||||
const char HTTP_FORM_WIFI_END[] PROGMEM = "";
|
||||
const char HTTP_FORM_STATIC_HEAD[] PROGMEM = "<hr><br/>";
|
||||
const char HTTP_FORM_END[] PROGMEM = "<br/><br/><button type='submit'>Save</button></form>";
|
||||
const char HTTP_FORM_LABEL[] PROGMEM = "<label for='{i}'>{t}</label>";
|
||||
const char HTTP_FORM_PARAM_HEAD[] PROGMEM = "<hr><br/>";
|
||||
const char HTTP_FORM_PARAM[] PROGMEM = "<br/><input id='{i}' name='{n}' maxlength='{l}' value='{v}' {c}>\n"; // do not remove newline!
|
||||
|
||||
const char HTTP_SCAN_LINK[] PROGMEM = "<br/><form action='/wifi?refresh=1' method='POST'><button name='refresh' value='1'>Refresh</button></form>";
|
||||
const char HTTP_SAVED[] PROGMEM = "<div class='msg'>Saving Credentials<br/>Trying to connect ESP to network.<br />If it fails reconnect to AP to try again</div>";
|
||||
const char HTTP_PARAMSAVED[] PROGMEM = "<div class='msg S'>Saved<br/></div>";
|
||||
const char HTTP_END[] PROGMEM = "</div></body></html>";
|
||||
const char HTTP_ERASEBTN[] PROGMEM = "<br/><form action='/erase' method='get'><button class='D'>Erase WiFi Config</button></form>";
|
||||
const char HTTP_UPDATEBTN[] PROGMEM = "<br/><form action='/update' method='get'><button>Actualizer</button></form>";
|
||||
const char HTTP_BACKBTN[] PROGMEM = "<hr><br/><form action='/' method='get'><button>Atrás</button></form>";
|
||||
|
||||
const char HTTP_STATUS_ON[] PROGMEM = "<div class='msg S'><strong>Conectado</strong> a {v}<br/><em><small>con IP {i}</small></em></div>";
|
||||
const char HTTP_STATUS_OFF[] PROGMEM = "<div class='msg {c}'><strong>No conectado</strong> a {v}{r}</div>"; // {c=class} {v=ssid} {r=status_off}
|
||||
const char HTTP_STATUS_OFFPW[] PROGMEM = "<br/>Authentication Failure"; // STATION_WRONG_PASSWORD, no eps32
|
||||
const char HTTP_STATUS_OFFNOAP[] PROGMEM = "<br/>No Encontrado"; // WL_NO_SSID_AVAIL
|
||||
const char HTTP_STATUS_OFFFAIL[] PROGMEM = "<br/>No se pudo conectar"; // WL_CONNECT_FAILED
|
||||
const char HTTP_STATUS_NONE[] PROGMEM = "<div class='msg'>Sin AP establecido</div>";
|
||||
const char HTTP_BR[] PROGMEM = "<br/>";
|
||||
|
||||
const char HTTP_STYLE[] PROGMEM = "<style>"
|
||||
".c,body{text-align:center;font-family:verdana}div,input,select{padding:5px;font-size:1em;margin:5px 0;box-sizing:border-box}"
|
||||
"input,button,select,.msg{border-radius:.3rem;width: 100%}input[type=radio],input[type=checkbox]{width:auto}"
|
||||
"button,input[type='button'],input[type='submit']{cursor:pointer;border:0;background-color:#1fa3ec;color:#fff;line-height:2.4rem;font-size:1.2rem;width:100%}"
|
||||
"input[type='file']{border:1px solid #1fa3ec}"
|
||||
".wrap {text-align:left;display:inline-block;min-width:260px;max-width:500px}"
|
||||
// links
|
||||
"a{color:#000;font-weight:700;text-decoration:none}a:hover{color:#1fa3ec;text-decoration:underline}"
|
||||
// quality icons
|
||||
".q{height:16px;margin:0;padding:0 5px;text-align:right;min-width:38px;float:right}.q.q-0:after{background-position-x:0}.q.q-1:after{background-position-x:-16px}.q.q-2:after{background-position-x:-32px}.q.q-3:after{background-position-x:-48px}.q.q-4:after{background-position-x:-64px}.q.l:before{background-position-x:-80px;padding-right:5px}.ql .q{float:left}.q:after,.q:before{content:'';width:16px;height:16px;display:inline-block;background-repeat:no-repeat;background-position: 16px 0;"
|
||||
"background-image:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAAAQCAMAAADeZIrLAAAAJFBMVEX///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADHJj5lAAAAC3RSTlMAIjN3iJmqu8zd7vF8pzcAAABsSURBVHja7Y1BCsAwCASNSVo3/v+/BUEiXnIoXkoX5jAQMxTHzK9cVSnvDxwD8bFx8PhZ9q8FmghXBhqA1faxk92PsxvRc2CCCFdhQCbRkLoAQ3q/wWUBqG35ZxtVzW4Ed6LngPyBU2CobdIDQ5oPWI5nCUwAAAAASUVORK5CYII=');}"
|
||||
// icons @2x media query (32px rescaled)
|
||||
"@media (-webkit-min-device-pixel-ratio: 2),(min-resolution: 192dpi){.q:before,.q:after {"
|
||||
"background-image:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALwAAAAgCAMAAACfM+KhAAAALVBMVEX///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAOrOgAAAADnRSTlMAESIzRGZ3iJmqu8zd7gKjCLQAAACmSURBVHgB7dDBCoMwEEXRmKlVY3L//3NLhyzqIqSUggy8uxnhCR5Mo8xLt+14aZ7wwgsvvPA/ofv9+44334UXXngvb6XsFhO/VoC2RsSv9J7x8BnYLW+AjT56ud/uePMdb7IP8Bsc/e7h8Cfk912ghsNXWPpDC4hvN+D1560A1QPORyh84VKLjjdvfPFm++i9EWq0348XXnjhhT+4dIbCW+WjZim9AKk4UZMnnCEuAAAAAElFTkSuQmCC');"
|
||||
"background-size: 95px 16px;}}"
|
||||
// msg callouts
|
||||
".msg{padding:20px;margin:20px 0;border:1px solid #eee;border-left-width:5px;border-left-color:#777}.msg h4{margin-top:0;margin-bottom:5px}.msg.P{border-left-color:#1fa3ec}.msg.P h4{color:#1fa3ec}.msg.D{border-left-color:#dc3630}.msg.D h4{color:#dc3630}.msg.S{border-left-color: #5cb85c}.msg.S h4{color: #5cb85c}"
|
||||
// lists
|
||||
"dt{font-weight:bold}dd{margin:0;padding:0 0 0.5em 0;min-height:12px}"
|
||||
"td{vertical-align: top;}"
|
||||
".h{display:none}"
|
||||
"button{transition: 0s opacity;transition-delay: 3s;transition-duration: 0s;cursor: pointer}"
|
||||
"button.D{background-color:#dc3630}"
|
||||
"button:active{opacity:50% !important;cursor:wait;transition-delay: 0s}"
|
||||
// invert
|
||||
"body.invert,body.invert a,body.invert h1 {background-color:#060606;color:#fff;}"
|
||||
"body.invert .msg{color:#fff;background-color:#282828;border-top:1px solid #555;border-right:1px solid #555;border-bottom:1px solid #555;}"
|
||||
"body.invert .q[role=img]{-webkit-filter:invert(1);filter:invert(1);}"
|
||||
":disabled {opacity: 0.5;}"
|
||||
"</style>";
|
||||
|
||||
#ifndef WM_NOHELP
|
||||
const char HTTP_HELP[] PROGMEM =
|
||||
"<br/><h3>Available Pages</h3><hr>"
|
||||
"<table class='table'>"
|
||||
"<thead><tr><th>Page</th><th>Function</th></tr></thead><tbody>"
|
||||
"<tr><td><a href='/'>/</a></td>"
|
||||
"<td>Menu page.</td></tr>"
|
||||
"<tr><td><a href='/wifi'>/wifi</a></td>"
|
||||
"<td>Show WiFi scan results and enter WiFi configuration.(/0wifi noscan)</td></tr>"
|
||||
"<tr><td><a href='/wifisave'>/wifisave</a></td>"
|
||||
"<td>Save WiFi configuration information and configure device. Needs variables supplied.</td></tr>"
|
||||
"<tr><td><a href='/param'>/param</a></td>"
|
||||
"<td>Parameter page</td></tr>"
|
||||
"<tr><td><a href='/info'>/info</a></td>"
|
||||
"<td>Information page</td></tr>"
|
||||
"<tr><td><a href='/u'>/u</a></td>"
|
||||
"<td>OTA Update</td></tr>"
|
||||
"<tr><td><a href='/close'>/close</a></td>"
|
||||
"<td>Close the captiveportal popup,configportal will remain active</td></tr>"
|
||||
"<tr><td>/exit</td>"
|
||||
"<td>Exit Config Portal, configportal will close</td></tr>"
|
||||
"<tr><td>/restart</td>"
|
||||
"<td>Reboot the device</td></tr>"
|
||||
"<tr><td>/erase</td>"
|
||||
"<td>Erase WiFi configuration and reboot Device. Device will not reconnect to a network until new WiFi configuration data is entered.</td></tr>"
|
||||
"</table>"
|
||||
"<p/>Github <a href='https://github.com/tzapu/WiFiManager'>https://github.com/tzapu/WiFiManager</a>.";
|
||||
#else
|
||||
const char HTTP_HELP[] PROGMEM = "";
|
||||
#endif
|
||||
|
||||
const char HTTP_UPDATE[] PROGMEM = "Upload New Firmware<br/><form method='POST' action='u' enctype='multipart/form-data' onchange=\"(function(el){document.getElementById('uploadbin').style.display = el.value=='' ? 'none' : 'initial';})(this)\"><input type='file' name='update' accept='.bin,application/octet-stream'><button id='uploadbin' type='submit' class='h D'>Update</button></form><small><a href='http://192.168.4.1/update' target='_blank'>* May not function inside captive portal, Open in browser http://192.168.4.1</a><small>";
|
||||
const char HTTP_UPDATE_FAIL[] PROGMEM = "<div class='msg D'><strong>Update Failed!</strong><Br/>Reboot device and try again</div>";
|
||||
const char HTTP_UPDATE_SUCCESS[] PROGMEM = "<div class='msg S'><strong>Update Successful. </strong> <br/> Device Rebooting now...</div>";
|
||||
|
||||
#ifdef WM_JSTEST
|
||||
const char HTTP_JS[] PROGMEM =
|
||||
"<script>function postAjax(url, data, success) {"
|
||||
" var params = typeof data == 'string' ? data : Object.keys(data).map("
|
||||
" function(k){ return encodeURIComponent(k) + '=' + encodeURIComponent(data[k]) }"
|
||||
" ).join('&');"
|
||||
" var xhr = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject(\"Microsoft.XMLHTTP\");"
|
||||
" xhr.open('POST', url);"
|
||||
" xhr.onreadystatechange = function() {"
|
||||
" if (xhr.readyState>3 && xhr.status==200) { success(xhr.responseText); }"
|
||||
" };"
|
||||
" xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');"
|
||||
" xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');"
|
||||
" xhr.send(params);"
|
||||
" return xhr;}"
|
||||
"postAjax('/status', 'p1=1&p2=Hello+World', function(data){ console.log(data); });"
|
||||
"postAjax('/status', { p1: 1, p2: 'Hello World' }, function(data){ console.log(data); });"
|
||||
"</script>";
|
||||
#endif
|
||||
|
||||
// Info html
|
||||
// @todo remove html elements from progmem, repetetive strings
|
||||
#ifdef ESP32
|
||||
const char HTTP_INFO_esphead[] PROGMEM = "<h3>esp32</h3><hr><dl>";
|
||||
const char HTTP_INFO_chiprev[] PROGMEM = "<dt>Chip Rev</dt><dd>{1}</dd>";
|
||||
const char HTTP_INFO_lastreset[] PROGMEM = "<dt>Last reset reason</dt><dd>CPU0: {1}<br/>CPU1: {2}</dd>";
|
||||
const char HTTP_INFO_aphost[] PROGMEM = "<dt>Access Point Hostname</dt><dd>{1}</dd>";
|
||||
const char HTTP_INFO_psrsize[] PROGMEM = "<dt>PSRAM Size</dt><dd>{1} bytes</dd>";
|
||||
const char HTTP_INFO_temp[] PROGMEM = "<dt>Temperature</dt><dd>{1} C° / {2} F°</dd><dt>Hall</dt><dd>{3}</dd>";
|
||||
#else
|
||||
const char HTTP_INFO_esphead[] PROGMEM = "<h3>esp8266</h3><hr><dl>";
|
||||
const char HTTP_INFO_fchipid[] PROGMEM = "<dt>Flash Chip ID</dt><dd>{1}</dd>";
|
||||
const char HTTP_INFO_corever[] PROGMEM = "<dt>Core Version</dt><dd>{1}</dd>";
|
||||
const char HTTP_INFO_bootver[] PROGMEM = "<dt>Boot Version</dt><dd>{1}</dd>";
|
||||
const char HTTP_INFO_lastreset[] PROGMEM = "<dt>Last reset reason</dt><dd>{1}</dd>";
|
||||
const char HTTP_INFO_flashsize[] PROGMEM = "<dt>Real Flash Size</dt><dd>{1} bytes</dd>";
|
||||
#endif
|
||||
|
||||
const char HTTP_INFO_memsmeter[] PROGMEM = "<br/><progress value='{1}' max='{2}'></progress></dd>";
|
||||
const char HTTP_INFO_memsketch[] PROGMEM = "<dt>Memory - Sketch Size</dt><dd>Used / Total bytes<br/>{1} / {2}";
|
||||
const char HTTP_INFO_freeheap[] PROGMEM = "<dt>Memory - Free Heap</dt><dd>{1} bytes available</dd>";
|
||||
const char HTTP_INFO_wifihead[] PROGMEM = "<br/><h3>WiFi</h3><hr>";
|
||||
const char HTTP_INFO_uptime[] PROGMEM = "<dt>Uptime</dt><dd>{1} Mins {2} Secs</dd>";
|
||||
const char HTTP_INFO_chipid[] PROGMEM = "<dt>Chip ID</dt><dd>{1}</dd>";
|
||||
const char HTTP_INFO_idesize[] PROGMEM = "<dt>Flash Size</dt><dd>{1} bytes</dd>";
|
||||
const char HTTP_INFO_sdkver[] PROGMEM = "<dt>SDK Version</dt><dd>{1}</dd>";
|
||||
const char HTTP_INFO_cpufreq[] PROGMEM = "<dt>CPU Frequency</dt><dd>{1}MHz</dd>";
|
||||
const char HTTP_INFO_apip[] PROGMEM = "<dt>Access Point IP</dt><dd>{1}</dd>";
|
||||
const char HTTP_INFO_apmac[] PROGMEM = "<dt>Access Point MAC</dt><dd>{1}</dd>";
|
||||
const char HTTP_INFO_apssid[] PROGMEM = "<dt>Access Point SSID</dt><dd>{1}</dd>";
|
||||
const char HTTP_INFO_apbssid[] PROGMEM = "<dt>BSSID</dt><dd>{1}</dd>";
|
||||
const char HTTP_INFO_stassid[] PROGMEM = "<dt>Station SSID</dt><dd>{1}</dd>";
|
||||
const char HTTP_INFO_staip[] PROGMEM = "<dt>Station IP</dt><dd>{1}</dd>";
|
||||
const char HTTP_INFO_stagw[] PROGMEM = "<dt>Station Gateway</dt><dd>{1}</dd>";
|
||||
const char HTTP_INFO_stasub[] PROGMEM = "<dt>Station Subnet</dt><dd>{1}</dd>";
|
||||
const char HTTP_INFO_dnss[] PROGMEM = "<dt>DNS Server</dt><dd>{1}</dd>";
|
||||
const char HTTP_INFO_host[] PROGMEM = "<dt>Hostname</dt><dd>{1}</dd>";
|
||||
const char HTTP_INFO_stamac[] PROGMEM = "<dt>Station MAC</dt><dd>{1}</dd>";
|
||||
const char HTTP_INFO_conx[] PROGMEM = "<dt>Connected</dt><dd>{1}</dd>";
|
||||
const char HTTP_INFO_autoconx[] PROGMEM = "<dt>Autoconnect</dt><dd>{1}</dd>";
|
||||
|
||||
const char HTTP_INFO_aboutver[] PROGMEM = "<dt>WiFiManager</dt><dd>{1}</dd>";
|
||||
const char HTTP_INFO_aboutarduino[] PROGMEM = "<dt>Arduino</dt><dd>{1}</dd>";
|
||||
const char HTTP_INFO_aboutsdk[] PROGMEM = "<dt>ESP-SDK/IDF</dt><dd>{1}</dd>";
|
||||
const char HTTP_INFO_aboutdate[] PROGMEM = "<dt>Build Date</dt><dd>{1}</dd>";
|
||||
|
||||
const char S_brand[] PROGMEM = "WiFiManager";
|
||||
const char S_debugPrefix[] PROGMEM = "*wm:";
|
||||
const char S_y[] PROGMEM = "Yes";
|
||||
const char S_n[] PROGMEM = "No";
|
||||
const char S_enable[] PROGMEM = "Enabled";
|
||||
const char S_disable[] PROGMEM = "Disabled";
|
||||
const char S_GET[] PROGMEM = "GET";
|
||||
const char S_POST[] PROGMEM = "POST";
|
||||
const char S_NA[] PROGMEM = "Unknown";
|
||||
const char S_passph[] PROGMEM = "********";
|
||||
const char S_titlewifisaved[] PROGMEM = "Credentials Saved";
|
||||
const char S_titlewifisettings[] PROGMEM = "Settings Saved";
|
||||
const char S_titlewifi[] PROGMEM = "Config ESP";
|
||||
const char S_titleinfo[] PROGMEM = "Info";
|
||||
const char S_titleparam[] PROGMEM = "Setup";
|
||||
const char S_titleparamsaved[] PROGMEM = "Setup Saved";
|
||||
const char S_titleexit[] PROGMEM = "Exit";
|
||||
const char S_titlereset[] PROGMEM = "Reset";
|
||||
const char S_titleerase[] PROGMEM = "Erase";
|
||||
const char S_titleclose[] PROGMEM = "Close";
|
||||
const char S_options[] PROGMEM = "options";
|
||||
const char S_nonetworks[] PROGMEM = "No networks found. Refresh to scan again.";
|
||||
const char S_staticip[] PROGMEM = "Static IP";
|
||||
const char S_staticgw[] PROGMEM = "Static Gateway";
|
||||
const char S_staticdns[] PROGMEM = "Static DNS";
|
||||
const char S_subnet[] PROGMEM = "Subnet";
|
||||
const char S_exiting[] PROGMEM = "Exiting";
|
||||
const char S_resetting[] PROGMEM = "Module will reset in a few seconds.";
|
||||
const char S_closing[] PROGMEM = "You can close the page, portal will continue to run";
|
||||
const char S_error[] PROGMEM = "An Error Occured";
|
||||
const char S_notfound[] PROGMEM = "File Not Found\n\n";
|
||||
const char S_uri[] PROGMEM = "URI: ";
|
||||
const char S_method[] PROGMEM = "\nMethod: ";
|
||||
const char S_args[] PROGMEM = "\nArguments: ";
|
||||
const char S_parampre[] PROGMEM = "param_";
|
||||
|
||||
// debug strings
|
||||
const char D_HR[] PROGMEM = "--------------------";
|
||||
|
||||
|
||||
// softap ssid default prefix
|
||||
#ifdef ESP8266
|
||||
const char S_ssidpre[] PROGMEM = "ESP";
|
||||
#elif defined(ESP32)
|
||||
const char S_ssidpre[] PROGMEM = "ESP32";
|
||||
#else
|
||||
const char S_ssidpre[] PROGMEM = "WM";
|
||||
#endif
|
||||
|
||||
// END WIFI_MANAGER_OVERRIDE_STRINGS
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "sdkconfig.h"
|
||||
|
||||
#define NUKI_HUB_VERSION "8.34"
|
||||
#define NUKI_HUB_BUILD "unknownbuildnr"
|
||||
|
||||
#define GITHUB_LATEST_RELEASE_URL "https://github.com/technyon/nuki_hub/releases/latest"
|
||||
#define GITHUB_LATEST_RELEASE_API_URL "https://api.github.com/repos/technyon/nuki_hub/releases/latest"
|
||||
|
||||
@@ -66,6 +66,7 @@
|
||||
#define mqtt_topic_info_hardware_version "/info/hardwareVersion"
|
||||
#define mqtt_topic_info_firmware_version "/info/firmwareVersion"
|
||||
#define mqtt_topic_info_nuki_hub_version "/info/nukiHubVersion"
|
||||
#define mqtt_topic_info_nuki_hub_build "/info/nukiHubBuild"
|
||||
#define mqtt_topic_info_nuki_hub_latest "/info/nukiHubLatest"
|
||||
#define mqtt_topic_info_nuki_hub_ip "/info/nukiHubIp"
|
||||
|
||||
|
||||
@@ -359,6 +359,7 @@ bool Network::update()
|
||||
}
|
||||
if (!_versionPublished) {
|
||||
publishString(_maintenancePathPrefix, mqtt_topic_info_nuki_hub_version, NUKI_HUB_VERSION);
|
||||
publishString(_maintenancePathPrefix, mqtt_topic_info_nuki_hub_build, NUKI_HUB_BUILD);
|
||||
_versionPublished = true;
|
||||
}
|
||||
_lastMaintenanceTs = ts;
|
||||
@@ -598,7 +599,8 @@ void Network::registerMqttReceiver(MqttReceiver* receiver)
|
||||
|
||||
void Network::onMqttDataReceivedCallback(const espMqttClientTypes::MessageProperties& properties, const char* topic, const uint8_t* payload, size_t len, size_t index, size_t total)
|
||||
{
|
||||
uint8_t value[360] = {0};
|
||||
uint8_t value[800] = {0};
|
||||
|
||||
size_t l = min(len, sizeof(value)-1);
|
||||
|
||||
for(int i=0; i<l; i++)
|
||||
@@ -692,6 +694,11 @@ const String Network::networkDeviceName() const
|
||||
return _device->deviceName();
|
||||
}
|
||||
|
||||
const String Network::networkBSSID() const
|
||||
{
|
||||
return _device->BSSIDstr();
|
||||
}
|
||||
|
||||
void Network::publishFloat(const char* prefix, const char* topic, const float value, const uint8_t precision)
|
||||
{
|
||||
char str[30];
|
||||
@@ -928,6 +935,23 @@ void Network::publishHASSConfig(char* deviceType, const char* baseTopic, char* n
|
||||
"",
|
||||
{ { (char*)"en", (char*)"true" },
|
||||
{(char*)"ic", (char*)"mdi:counter"}});
|
||||
|
||||
// Nuki Hub build
|
||||
publishHassTopic("sensor",
|
||||
"nuki_hub_build",
|
||||
uidString,
|
||||
"_nuki_hub_build",
|
||||
"Nuki Hub build",
|
||||
name,
|
||||
baseTopic,
|
||||
_lockPath + mqtt_topic_info_nuki_hub_build,
|
||||
deviceType,
|
||||
"",
|
||||
"",
|
||||
"diagnostic",
|
||||
"",
|
||||
{ { (char*)"en", (char*)"true" },
|
||||
{(char*)"ic", (char*)"mdi:counter"}});
|
||||
|
||||
if(_preferences->getBool(preference_check_updates))
|
||||
{
|
||||
@@ -3141,6 +3165,7 @@ void Network::removeHASSConfig(char* uidString)
|
||||
removeHassTopic((char*)"sensor", (char*)"firmware_version", uidString);
|
||||
removeHassTopic((char*)"sensor", (char*)"hardware_version", uidString);
|
||||
removeHassTopic((char*)"sensor", (char*)"nuki_hub_version", uidString);
|
||||
removeHassTopic((char*)"sensor", (char*)"nuki_hub_build", uidString);
|
||||
removeHassTopic((char*)"sensor", (char*)"nuki_hub_latest", uidString);
|
||||
removeHassTopic((char*)"update", (char*)"nuki_hub_update", uidString);
|
||||
removeHassTopic((char*)"sensor", (char*)"nuki_hub_ip", uidString);
|
||||
|
||||
@@ -66,6 +66,7 @@ public:
|
||||
int mqttConnectionState(); // 0 = not connected; 1 = connected; 2 = connected and mqtt processed
|
||||
bool encryptionSupported();
|
||||
const String networkDeviceName() const;
|
||||
const String networkBSSID() const;
|
||||
|
||||
const NetworkDeviceType networkDeviceType();
|
||||
|
||||
|
||||
@@ -46,7 +46,6 @@ void NetworkLock::initialize()
|
||||
|
||||
_network->initTopic(_mqttPath, mqtt_topic_lock_action, "--");
|
||||
_network->subscribe(_mqttPath, mqtt_topic_lock_action);
|
||||
|
||||
_network->initTopic(_mqttPath, mqtt_topic_config_action, "--");
|
||||
_network->subscribe(_mqttPath, mqtt_topic_config_action);
|
||||
|
||||
@@ -588,7 +587,6 @@ void NetworkLock::publishConfig(const NukiLock::Config &config)
|
||||
|
||||
serializeJson(json, _buffer, _bufferSize);
|
||||
publishString(mqtt_topic_config_basic_json, _buffer);
|
||||
|
||||
publishBool(mqtt_topic_config_button_enabled, config.buttonEnabled == 1);
|
||||
publishBool(mqtt_topic_config_led_enabled, config.ledEnabled == 1);
|
||||
publishInt(mqtt_topic_config_led_brightness, config.ledBrightness);
|
||||
@@ -639,7 +637,6 @@ void NetworkLock::publishAdvancedConfig(const NukiLock::AdvancedConfig &config)
|
||||
|
||||
serializeJson(json, _buffer, _bufferSize);
|
||||
publishString(mqtt_topic_config_advanced_json, _buffer);
|
||||
|
||||
publishBool(mqtt_topic_config_auto_unlock, config.autoUnLockDisabled == 0);
|
||||
publishBool(mqtt_topic_config_auto_lock, config.autoLockEnabled == 1);
|
||||
}
|
||||
@@ -922,6 +919,7 @@ void NetworkLock::publishHASSConfig(char *deviceType, const char *baseTopic, cha
|
||||
{
|
||||
_network->publishHASSConfig(deviceType, baseTopic, name, uidString, "~/maintenance/mqttConnectionState", hasKeypad, lockAction, unlockAction, openAction);
|
||||
_network->publishHASSConfigAdditionalLockEntities(deviceType, baseTopic, name, uidString);
|
||||
|
||||
if(hasDoorSensor)
|
||||
{
|
||||
_network->publishHASSConfigDoorSensor(deviceType, baseTopic, name, uidString);
|
||||
|
||||
@@ -39,7 +39,6 @@ void NetworkOpener::initialize()
|
||||
|
||||
_network->initTopic(_mqttPath, mqtt_topic_lock_action, "--");
|
||||
_network->subscribe(_mqttPath, mqtt_topic_lock_action);
|
||||
|
||||
_network->initTopic(_mqttPath, mqtt_topic_config_action, "--");
|
||||
_network->subscribe(_mqttPath, mqtt_topic_config_action);
|
||||
|
||||
@@ -578,7 +577,6 @@ void NetworkOpener::publishConfig(const NukiOpener::Config &config)
|
||||
|
||||
serializeJson(json, _buffer, _bufferSize);
|
||||
publishString(mqtt_topic_config_basic_json, _buffer);
|
||||
|
||||
publishBool(mqtt_topic_config_button_enabled, config.buttonEnabled == 1);
|
||||
publishBool(mqtt_topic_config_led_enabled, config.ledFlashEnabled == 1);
|
||||
publishString(mqtt_topic_info_firmware_version, std::to_string(config.firmwareVersion[0]) + "." + std::to_string(config.firmwareVersion[1]) + "." + std::to_string(config.firmwareVersion[2]));
|
||||
@@ -630,7 +628,6 @@ void NetworkOpener::publishAdvancedConfig(const NukiOpener::AdvancedConfig &conf
|
||||
|
||||
serializeJson(json, _buffer, _bufferSize);
|
||||
publishString(mqtt_topic_config_advanced_json, _buffer);
|
||||
|
||||
publishUInt(mqtt_topic_config_sound_level, config.soundLevel);
|
||||
}
|
||||
|
||||
@@ -675,7 +672,7 @@ void NetworkOpener::publishKeypad(const std::list<NukiLock::KeypadEntry>& entrie
|
||||
basePath.concat("/code_");
|
||||
basePath.concat(std::to_string(index).c_str());
|
||||
publishKeypadEntry(basePath, entry);
|
||||
|
||||
|
||||
auto jsonEntry = json.add<JsonVariant>();
|
||||
|
||||
jsonEntry["codeId"] = entry.codeId;
|
||||
|
||||
@@ -71,7 +71,7 @@ private:
|
||||
void doorbellSuppressionToString(const int dbsupr, char* str);
|
||||
void soundToString(const int sound, char* str);
|
||||
void capabilitiesToString(const int capabilities, char* str);
|
||||
|
||||
|
||||
String concat(String a, String b);
|
||||
|
||||
Preferences* _preferences;
|
||||
@@ -80,7 +80,6 @@ private:
|
||||
|
||||
char _mqttPath[181] = {0};
|
||||
bool _isConnected = false;
|
||||
|
||||
bool _firstTunerStatePublish = true;
|
||||
bool _haEnabled= false;
|
||||
bool _reconnected = false;
|
||||
|
||||
@@ -228,6 +228,7 @@ void NukiOpenerWrapper::update()
|
||||
_retryCount = 0;
|
||||
_nextLockAction = (NukiOpener::LockAction) 0xff;
|
||||
_network->publishRetry("--");
|
||||
|
||||
if(_intervalLockstate > 10)
|
||||
{
|
||||
_nextLockStateUpdateTs = ts + 10 * 1000;
|
||||
@@ -1483,6 +1484,7 @@ void NukiOpenerWrapper::onKeypadJsonCommandReceived(const char *value)
|
||||
_network->publishKeypadJsonCommandResult("keypadNotAvailable");
|
||||
return;
|
||||
}
|
||||
|
||||
_network->publishKeypadJsonCommandResult("configNotReady");
|
||||
return;
|
||||
}
|
||||
@@ -1732,7 +1734,7 @@ void NukiOpenerWrapper::onKeypadJsonCommandReceived(const char *value)
|
||||
_network->publishKeypadJsonCommandResult("noExistingCodeIdSet");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
NukiOpener::UpdatedKeypadEntry entry;
|
||||
memset(&entry, 0, sizeof(entry));
|
||||
entry.codeId = codeId;
|
||||
@@ -2078,6 +2080,7 @@ void NukiOpenerWrapper::disableHASS()
|
||||
Nuki::CmdResult result = _nukiOpener.requestConfig(&_nukiConfig);
|
||||
_nukiConfigValid = result == Nuki::CmdResult::Success;
|
||||
}
|
||||
|
||||
if(_nukiConfigValid)
|
||||
{
|
||||
char uidString[20];
|
||||
|
||||
@@ -53,6 +53,7 @@ private:
|
||||
static void onKeypadJsonCommandReceivedCallback(const char* value);
|
||||
static void onTimeControlCommandReceivedCallback(const char* value);
|
||||
static void gpioActionCallback(const GpioAction& action, const int& pin);
|
||||
|
||||
void onKeypadCommandReceived(const char* command, const uint& id, const String& name, const String& code, const int& enabled);
|
||||
void onConfigUpdateReceived(const char* value);
|
||||
void onKeypadJsonCommandReceived(const char* value);
|
||||
|
||||
@@ -247,6 +247,7 @@ void NukiWrapper::update()
|
||||
_retryCount = 0;
|
||||
_nextLockAction = (NukiLock::LockAction) 0xff;
|
||||
_network->publishRetry("--");
|
||||
|
||||
if(_intervalLockstate > 10)
|
||||
{
|
||||
_nextLockStateUpdateTs = ts + 10 * 1000;
|
||||
@@ -1477,6 +1478,7 @@ void NukiWrapper::onKeypadJsonCommandReceived(const char *value)
|
||||
_network->publishKeypadJsonCommandResult("keypadNotAvailable");
|
||||
return;
|
||||
}
|
||||
|
||||
_network->publishKeypadJsonCommandResult("configNotReady");
|
||||
return;
|
||||
}
|
||||
@@ -1843,7 +1845,7 @@ void NukiWrapper::onTimeControlCommandReceived(const char *value)
|
||||
const char *time = json["time"].as<const char*>();
|
||||
const char *lockAct = json["lockAction"].as<const char*>();
|
||||
NukiLock::LockAction timeControlLockAction;
|
||||
|
||||
|
||||
if(lockAct)
|
||||
{
|
||||
timeControlLockAction = nukiInst->lockActionToEnum(lockAct);
|
||||
@@ -2059,6 +2061,7 @@ void NukiWrapper::disableHASS()
|
||||
Nuki::CmdResult result = _nukiLock.requestConfig(&_nukiConfig);
|
||||
_nukiConfigValid = result == Nuki::CmdResult::Success;
|
||||
}
|
||||
|
||||
if(_nukiConfigValid)
|
||||
{
|
||||
char uidString[20];
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#define preference_network_hardware (char*)"nwhw"
|
||||
#define preference_network_hardware_gpio (char*)"nwhwdt" // obsolete
|
||||
#define preference_network_wifi_fallback_disabled (char*)"nwwififb"
|
||||
#define preference_find_best_rssi (char*)"nwbestrssi"
|
||||
#define preference_rssi_publish_interval (char*)"rssipb"
|
||||
#define preference_hostname (char*)"hostname"
|
||||
#define preference_network_timeout (char*)"nettmout"
|
||||
@@ -92,7 +93,7 @@ private:
|
||||
preference_opener_continuous_mode, preference_mqtt_opener_path, preference_lock_max_keypad_code_count, preference_opener_max_keypad_code_count,
|
||||
preference_enable_bootloop_reset, preference_mqtt_ca, preference_mqtt_crt, preference_mqtt_key, preference_mqtt_hass_discovery, preference_mqtt_hass_cu_url,
|
||||
preference_buffer_size, preference_ip_dhcp_enabled, preference_ip_address, preference_ip_subnet, preference_ip_gateway, preference_ip_dns_server,
|
||||
preference_network_hardware, preference_network_wifi_fallback_disabled, preference_rssi_publish_interval, preference_hostname,
|
||||
preference_network_hardware, preference_network_wifi_fallback_disabled, preference_rssi_publish_interval, preference_hostname, preference_find_best_rssi,
|
||||
preference_network_timeout, preference_restart_on_disconnect, preference_restart_ble_beacon_lost, preference_query_interval_lockstate,
|
||||
preference_query_interval_configuration, preference_query_interval_battery, preference_query_interval_keypad, preference_keypad_control_enabled,
|
||||
preference_keypad_info_enabled, preference_acl, preference_timecontrol_control_enabled, preference_timecontrol_info_enabled,
|
||||
@@ -112,8 +113,8 @@ private:
|
||||
std::vector<char*> _boolPrefs =
|
||||
{
|
||||
preference_started_before, preference_mqtt_log_enabled, preference_check_updates, preference_lock_enabled, preference_opener_enabled, preference_opener_continuous_mode,
|
||||
preference_enable_bootloop_reset, preference_webserver_enabled, preference_restart_on_disconnect, preference_keypad_control_enabled, preference_keypad_info_enabled,
|
||||
preference_timecontrol_control_enabled, preference_timecontrol_info_enabled, preference_register_as_app, preference_ip_dhcp_enabled,
|
||||
preference_enable_bootloop_reset, preference_webserver_enabled, preference_find_best_rssi, preference_restart_on_disconnect, preference_keypad_control_enabled,
|
||||
preference_keypad_info_enabled, preference_timecontrol_control_enabled, preference_timecontrol_info_enabled, preference_register_as_app, preference_ip_dhcp_enabled,
|
||||
preference_publish_authdata, preference_has_mac_saved, preference_publish_debug_info, preference_network_wifi_fallback_disabled
|
||||
};
|
||||
|
||||
|
||||
@@ -383,6 +383,11 @@ bool WebCfgServer::processArgs(String& message)
|
||||
_preferences->putString(preference_mqtt_hass_cu_url, value);
|
||||
configChanged = true;
|
||||
}
|
||||
else if(key == "BESTRSSI")
|
||||
{
|
||||
_preferences->putBool(preference_find_best_rssi, (value == "1"));
|
||||
configChanged = true;
|
||||
}
|
||||
else if(key == "HOSTNAME")
|
||||
{
|
||||
_preferences->putString(preference_hostname, value);
|
||||
@@ -1067,9 +1072,6 @@ void WebCfgServer::buildHtml(String& response)
|
||||
buildHtmlHeader(response);
|
||||
|
||||
response.concat("<br><h3>Info</h3>\n");
|
||||
|
||||
String version = NUKI_HUB_VERSION;
|
||||
|
||||
response.concat("<table>");
|
||||
|
||||
printParameter(response, "Hostname", _hostname.c_str());
|
||||
@@ -1135,7 +1137,7 @@ void WebCfgServer::buildHtml(String& response)
|
||||
}
|
||||
}
|
||||
|
||||
printParameter(response, "Firmware", version.c_str(), "/info");
|
||||
printParameter(response, "Firmware", NUKI_HUB_VERSION, "/info");
|
||||
|
||||
if(_preferences->getBool(preference_check_updates)) printParameter(response, "Latest Firmware", _preferences->getString(preference_latest_version).c_str(), "/ota");
|
||||
|
||||
@@ -1311,6 +1313,7 @@ void WebCfgServer::buildMqttConfigHtml(String &response)
|
||||
printTextarea(response, "MQTTKEY", "MQTT SSL Client Key (*, optional)", _preferences->getString(preference_mqtt_key).c_str(), TLS_KEY_MAX_SIZE, _network->encryptionSupported(), true);
|
||||
printDropDown(response, "NWHW", "Network hardware", String(_preferences->getInt(preference_network_hardware)), getNetworkDetectionOptions());
|
||||
printCheckBox(response, "NWHWWIFIFB", "Disable fallback to Wi-Fi / Wi-Fi config portal", _preferences->getBool(preference_network_wifi_fallback_disabled), "");
|
||||
printCheckBox(response, "BESTRSSI", "Connect to AP with the best signal in an environment with multiple APs with the same SSID", _preferences->getBool(preference_find_best_rssi), "");
|
||||
printInputField(response, "RSSI", "RSSI Publish interval (seconds; -1 to disable)", _preferences->getInt(preference_rssi_publish_interval), 6);
|
||||
printInputField(response, "NETTIMEOUT", "Network Timeout until restart (seconds; -1 to disable)", _preferences->getInt(preference_network_timeout), 5);
|
||||
printCheckBox(response, "RSTDISC", "Restart on disconnect", _preferences->getBool(preference_restart_on_disconnect), "");
|
||||
@@ -1368,6 +1371,7 @@ void WebCfgServer::buildAccLvlHtml(String &response)
|
||||
response.concat("<input type=\"hidden\" name=\"ACLLVLCHANGED\" value=\"1\">");
|
||||
response.concat("<h3>Nuki General Access Control</h3>");
|
||||
response.concat("<table><tr><th>Setting</th><th>Enabled</th></tr>");
|
||||
|
||||
if((_nuki != nullptr && _nuki->hasKeypad()) || (_nukiOpener != nullptr && _nukiOpener->hasKeypad()))
|
||||
{
|
||||
printCheckBox(response, "KPPUB", "Publish keypad codes information", _preferences->getBool(preference_keypad_info_enabled), "");
|
||||
@@ -1531,11 +1535,14 @@ void WebCfgServer::buildNukiConfigHtml(String &response)
|
||||
response.concat("<h3>Basic Nuki Configuration</h3>");
|
||||
response.concat("<table>");
|
||||
printCheckBox(response, "LOCKENA", "Nuki Smartlock enabled", _preferences->getBool(preference_lock_enabled), "");
|
||||
|
||||
if(_preferences->getBool(preference_lock_enabled))
|
||||
{
|
||||
printInputField(response, "MQTTPATH", "MQTT Nuki Smartlock Path", _preferences->getString(preference_mqtt_lock_path).c_str(), 180);
|
||||
}
|
||||
|
||||
printCheckBox(response, "OPENA", "Nuki Opener enabled", _preferences->getBool(preference_opener_enabled), "");
|
||||
|
||||
if(_preferences->getBool(preference_opener_enabled))
|
||||
{
|
||||
printInputField(response, "MQTTOPPATH", "MQTT Nuki Opener Path", _preferences->getString(preference_mqtt_opener_path).c_str(), 180);
|
||||
@@ -1624,6 +1631,9 @@ void WebCfgServer::buildInfoHtml(String &response)
|
||||
response.concat("Nuki Hub version: ");
|
||||
response.concat(NUKI_HUB_VERSION);
|
||||
response.concat("\n");
|
||||
response.concat("Nuki Hub build: ");
|
||||
response.concat(NUKI_HUB_BUILD);
|
||||
response.concat("\n");
|
||||
|
||||
response.concat(debugPreferences.preferencesToString(_preferences));
|
||||
|
||||
@@ -1754,7 +1764,6 @@ void WebCfgServer::buildInfoHtml(String &response)
|
||||
_preferences->getBytes(preference_conf_opener_basic_acl, &basicOpenerConfigAclPrefs, sizeof(basicOpenerConfigAclPrefs));
|
||||
uint32_t advancedOpenerConfigAclPrefs[22];
|
||||
_preferences->getBytes(preference_conf_opener_advanced_acl, &advancedOpenerConfigAclPrefs, sizeof(advancedOpenerConfigAclPrefs));
|
||||
|
||||
response.concat("Opener firmware version: ");
|
||||
response.concat(_nukiOpener->firmwareVersion().c_str());
|
||||
response.concat("\nOpener hardware version: ");
|
||||
@@ -1853,6 +1862,13 @@ void WebCfgServer::buildInfoHtml(String &response)
|
||||
response.concat("Network device: ");
|
||||
response.concat(_network->networkDeviceName());
|
||||
response.concat("\n");
|
||||
|
||||
if(_network->networkDeviceName() == "Built-in Wi-Fi")
|
||||
{
|
||||
response.concat("BSSID of AP: ");
|
||||
response.concat(_network->networkBSSID());
|
||||
response.concat("\n");
|
||||
}
|
||||
|
||||
response.concat("Uptime: ");
|
||||
response.concat(millis() / 1000 / 60);
|
||||
@@ -1997,8 +2013,10 @@ void WebCfgServer::printCheckBox(String &response, const char *token, const char
|
||||
|
||||
response.concat("<input type=checkbox name=\"");
|
||||
response.concat(token);
|
||||
|
||||
response.concat("\" class=\"");
|
||||
response.concat(htmlClass);
|
||||
|
||||
response.concat("\" value=\"1\"");
|
||||
response.concat(value ? " checked=\"checked\"" : "");
|
||||
response.concat("/></td></tr>");
|
||||
|
||||
@@ -260,6 +260,8 @@ void setup()
|
||||
Log = &Serial;
|
||||
|
||||
Log->print(F("Nuki Hub version ")); Log->println(NUKI_HUB_VERSION);
|
||||
|
||||
Log->print(F("Nuki Hub build ")); Log->println(NUKI_HUB_BUILD);
|
||||
|
||||
bool firstStart = initPreferences();
|
||||
|
||||
|
||||
@@ -143,3 +143,8 @@ String EthLan8720Device::localIP()
|
||||
{
|
||||
return ETH.localIP().toString();
|
||||
}
|
||||
|
||||
String EthLan8720Device::BSSIDstr()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
@@ -35,6 +35,7 @@ public:
|
||||
int8_t signalStrength() override;
|
||||
|
||||
String localIP() override;
|
||||
String BSSIDstr() override;
|
||||
|
||||
private:
|
||||
void onDisconnected();
|
||||
|
||||
@@ -33,6 +33,7 @@ public:
|
||||
virtual int8_t signalStrength() = 0;
|
||||
|
||||
virtual String localIP() = 0;
|
||||
virtual String BSSIDstr() = 0;
|
||||
|
||||
virtual void mqttSetClientId(const char* clientId);
|
||||
virtual void mqttSetCleanSession(bool cleanSession);
|
||||
|
||||
@@ -230,3 +230,8 @@ String W5500Device::localIP()
|
||||
{
|
||||
return Ethernet.localIP().toString();
|
||||
}
|
||||
|
||||
String W5500Device::BSSIDstr()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
@@ -33,6 +33,7 @@ public:
|
||||
int8_t signalStrength() override;
|
||||
|
||||
String localIP() override;
|
||||
String BSSIDstr() override;
|
||||
|
||||
private:
|
||||
void resetDevice();
|
||||
|
||||
@@ -66,7 +66,8 @@ void WifiDevice::initialize()
|
||||
wm_menu.push_back("wifi");
|
||||
wm_menu.push_back("exit");
|
||||
_wm.setEnableConfigPortal(_startAp || !_preferences->getBool(preference_network_wifi_fallback_disabled));
|
||||
// reduced tieout if ESP is set to restart on disconnect
|
||||
// reduced timeout if ESP is set to restart on disconnect
|
||||
_wm.setFindBestRSSI(_preferences->getBool(preference_find_best_rssi));
|
||||
_wm.setConfigPortalTimeout(_restartOnDisconnect ? 60 * 3 : 60 * 30);
|
||||
_wm.setShowInfoUpdate(false);
|
||||
_wm.setMenu(wm_menu);
|
||||
@@ -159,6 +160,11 @@ String WifiDevice::localIP()
|
||||
return WiFi.localIP().toString();
|
||||
}
|
||||
|
||||
String WifiDevice::BSSIDstr()
|
||||
{
|
||||
return WiFi.BSSIDstr();
|
||||
}
|
||||
|
||||
void WifiDevice::clearRtcInitVar(WiFiManager *)
|
||||
{
|
||||
memset(WiFiDevice_reconfdetect, 0, sizeof WiFiDevice_reconfdetect);
|
||||
|
||||
@@ -25,6 +25,7 @@ public:
|
||||
int8_t signalStrength() override;
|
||||
|
||||
String localIP() override;
|
||||
String BSSIDstr() override;
|
||||
|
||||
private:
|
||||
static void clearRtcInitVar(WiFiManager*);
|
||||
|
||||
Reference in New Issue
Block a user