diff --git a/OpenMQTTGateway.ino b/OpenMQTTGateway.ino index 2883026..aa12659 100644 --- a/OpenMQTTGateway.ino +++ b/OpenMQTTGateway.ino @@ -489,7 +489,7 @@ void setup_wifimanager(){ //fetches ssid and pass and tries to connect //if it does not connect it starts an access point with the specified name //and goes into a blocking loop awaiting configuration - if (!wifiManager.autoConnect(Gateway_Name, WifiManager_password)) { + if (!wifiManager.autoConnect(WifiManager_ssid, WifiManager_password)) { trc("failed to connect and hit timeout"); delay(3000); //reset and try again, or maybe put it to deep sleep diff --git a/User_config.h b/User_config.h index 8bca695..4fb8d40 100644 --- a/User_config.h +++ b/User_config.h @@ -31,6 +31,27 @@ /*-------------------VERSION----------------------*/ #define OMG_VERSION "0.8" +/*-------------CONFIGURE WIFIMANAGER-------------*/ +/* + * The following parameters are set during the WifiManager setup process: + * - wifi_ssid + * - wifi_password + * - mqtt_user + * - mqtt_pass + * - mqtt_server + * - mqtt_port + * + * To completely disable WifiManager, define ESPWifiManualSetup. + * If you do so, please don't forget to set these variables before compiling + * + * Otherwise you can provide these credentials on the web interface after connecting + * to the access point with your password (SSID: WifiManager_ssid, password: WifiManager_password) + */ + +//#define ESPWifiManualSetup true //uncomment to disable WifiManager +#define WifiManager_password "your_password" //this is going to be the WPA2-PSK password for the initial setup access point +#define WifiManager_ssid "OpenMQTTGateway" //this is the network name of the initial setup access point + /*-------------DEFINE YOUR MQTT PARAMETERS BELOW----------------*/ //MQTT Parameters definition //#define mqtt_server_name "www.mqtt_broker.com" // instead of defining the server by its IP you can define it by its name, uncomment this line and set the correct MQTT server host name @@ -49,9 +70,6 @@ char mqtt_port[6] = "1883"; #define Gateway_AnnouncementMsg "Online" /*-------------DEFINE YOUR NETWORK PARAMETERS BELOW----------------*/ - -//#define ESPWifiManualSetup true //uncomment you don't want to use wifimanager for your credential settings on ESP -#define WifiManager_password "your_password" //#define MDNS_SD //uncomment if you want to use mdns for discovering automatically your ip server, please note that MDNS with ESP32 can cause the BLE to not work //#define cleanFS true //uncomment if you want to clean the ESP memory and reenter your credentials #define maxMQTTretry 4 //maximum MQTT connection attempts before going to wifi setup @@ -67,10 +85,11 @@ char mqtt_port[6] = "1883"; const byte mac[] = { 0xDE, 0xED, 0xBA, 0xFE, 0x54, 0x95 }; //W5100 ethernet shield mac adress #endif -const byte ip[] = { 192, 168, 1, 99 }; //ip adress -const byte gateway[] = { 0, 0, 0, 0 }; //ip adress, if first value is different from 0 advanced config network will be used and you should fill gateway & dns -const byte Dns[] = { 0, 0, 0, 0 }; //ip adress, if first value is different from 0 advanced config network will be used and you should fill gateway & dns -const byte subnet[] = { 255, 255, 255, 0 }; //ip adress +// these values are only used if no dhcp configuration is available +const byte ip[] = { 192, 168, 1, 99 }; //ip address +const byte gateway[] = { 0, 0, 0, 0 }; //ip address, if first value is different from 0 advanced config network will be used and you should fill gateway & dns +const byte Dns[] = { 0, 0, 0, 0 }; //ip address, if first value is different from 0 advanced config network will be used and you should fill gateway & dns +const byte subnet[] = { 255, 255, 255, 0 }; //ip address /*-------------DEFINE YOUR OTA PARAMETERS BELOW----------------*/ #define ota_hostname Gateway_Name diff --git a/tests/Test_config.h b/tests/Test_config.h index 872af81..7cd54c7 100644 --- a/tests/Test_config.h +++ b/tests/Test_config.h @@ -29,7 +29,29 @@ along with this program. If not, see . */ /*-------------------VERSION----------------------*/ -#define OMG_VERSION "0.7" +#define OMG_VERSION "0.8" + +/*-------------CONFIGURE WIFIMANAGER-------------*/ +/* + * The following parameters are set during the WifiManager setup process: + * - wifi_ssid + * - wifi_password + * - mqtt_user + * - mqtt_pass + * - mqtt_server + * - mqtt_port + * + * To completely disable WifiManager, define ESPWifiManualSetup. + * If you do so, please don't forget to set these variables before compiling + * + * Otherwise you can provide these credentials on the web interface after connecting + * to the access point with your password (SSID: WifiManager_ssid, password: WifiManager_password) + */ + +//#define ESPWifiManualSetup true //uncomment to disable WifiManager +#define WifiManager_password "your_password" //this is going to be the WPA2-PSK password for the initial setup access point +#define WifiManager_ssid "OpenMQTTGateway" //this is the network name of the initial setup access point + /*-------------DEFINE YOUR MQTT PARAMETERS BELOW----------------*/ //MQTT Parameters definition //#define mqtt_server_name "www.mqtt_broker.com" // instead of defining the server by its IP you can define it by its name, uncomment this line and set the correct MQTT server host name @@ -48,9 +70,6 @@ char mqtt_port[6] = "1883"; #define Gateway_AnnouncementMsg "Online" /*-------------DEFINE YOUR NETWORK PARAMETERS BELOW----------------*/ - -//#define ESPWifiManualSetup true //uncomment you don't want to use wifimanager for your credential settings on ESP -#define WifiManager_password "your_password" //#define MDNS_SD //uncomment if you want to use mdns for discovering automatically your ip server, please note that MDNS with ESP32 can cause the BLE to not work //#define cleanFS true //uncomment if you want to clean the ESP memory and reenter your credentials #define maxMQTTretry 4 //maximum MQTT connection attempts before going to wifi setup @@ -66,6 +85,7 @@ char mqtt_port[6] = "1883"; const byte mac[] = { 0xDE, 0xED, 0xBA, 0xFE, 0x54, 0x95 }; //W5100 ethernet shield mac adress #endif +// these values are only used if no dhcp configuration is available const byte ip[] = { 192, 168, 1, 99 }; //ip adress // Advanced network config (optional) if you want to use these parameters uncomment line 158, 172 and comment line 171 of OpenMQTTGateway.ino const byte gateway[] = { 192, 168, 1, 1 }; //ip adress