Adafruit_IO_Arduino icon indicating copy to clipboard operation
Adafruit_IO_Arduino copied to clipboard

Update Library to work with WifiManager

Open jkuhlm opened this issue 7 years ago • 9 comments

With the current library the WiFi SSID and password need to defined. It would be nice if Adafruit IO would work with WifiManager to fix this issue. Thanks

jkuhlm avatar Aug 06 '18 22:08 jkuhlm

This issue is being actively developed in feature branch: https://github.com/adafruit/Adafruit_IO_Arduino/tree/dev-wifi-ap

brentru avatar Aug 17 '18 15:08 brentru

Good news, thanks.

jkuhlm avatar Aug 21 '18 22:08 jkuhlm

This issue is getting old, but I managed to use the two libraries at the same time by passing nullptr to both the ssid and pass arguments of AdafruitIO_WiFi / AdafruitIO_ESP8266.

malinges avatar Sep 28 '19 01:09 malinges

Hi, any opportunity to change SSID and Password on the fly instead of using constants?

jaime-mantilla avatar Jan 28 '20 02:01 jaime-mantilla

Hi, any opportunity to change SSID and Password on the fly instead of using constants?

Maybe not ideal, but I think there’s a version of WiFimanager where you can put it in AP mode by pushing a button , then you could enter your new credentials . For Adafruit_WiFi io(IO_USERNAME, IO_KEY, WIFI_SSID, WIFI_PASS) , change WIFI_SSID and WIFI_PASS to nullptr

wekiva avatar Jan 28 '20 11:01 wekiva

Did anyone get this to work? When I set WIFI_SSID AND WIFI_PASS to nullptr my esp32 reboots and sets WifiManager back into AP mode.

00:30:22.959 -> Connecting to Adafruit IOGuru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.
00:30:22.959 -> Core 1 register dump:
00:30:22.959 -> PC      : 0x400e1d12  PS      : 0x00060a30  A0      : 0x800e17d9  A1      : 0x3ffb1d20  
00:30:22.959 -> A2      : 0x3ffc1930  A3      : 0x3f40016f  A4      : 0xfffffc7f  A5      : 0x00002100  
00:30:22.959 -> A6      : 0x00002000  A7      : 0x3ffc1e60  A8      : 0x00000000  A9      : 0x3ffb1d00  
00:30:23.006 -> A10     : 0x00000019  A11     : 0x3f40016f  A12     : 0x00000019  A13     : 0x0000ff00  
00:30:23.006 -> A14     : 0x00ff0000  A15     : 0xff000000  SAR     : 0x0000001c  EXCCAUSE: 0x0000001c  
00:30:23.006 -> EXCVADDR: 0x00000000  LBEG    : 0x400014fd  LEND    : 0x4000150d  LCOUNT  : 0xfffffff9  
00:30:23.006 -> 
00:30:23.006 -> ELF file SHA256: 0000000000000000
00:30:23.006 -> 
00:30:23.006 -> Backtrace: 0x400e1d12:0x3ffb1d20 0x400e17d6:0x3ffb1d40 0x400d14ed:0x3ffb1d60 0x400e53c6:0x3ffb1fb0 0x40089e26:0x3ffb1fd0
00:30:23.006 -> 
00:30:23.006 -> Rebooting...

TomWaterz avatar Nov 30 '21 08:11 TomWaterz

This really needs to be fixed in the official library. Hard coding the SSID and KEY are fine for simple example and demo projects but not something you might want to share with others. I hacked around this as follows...

To allow wifimanager to handle the network connection and prevent Adafruit IO from conflicting the following lines were removed from the AdafruitIO_Wifi.cpp file...

also the class defintion was changed to remove the SSID and KEY and only use the IO_USERNAME and IO_KEY in the .h and .cpp files for wifi/AdafruitIO_ESP8266....

public: AdafruitIO_ESP8266(const char *user, const char *key); ~AdafruitIO_ESP8266();

Serial.println("here in Adafruit IO Code\n"); /* delay(100); commenting this out since we are already connected via wifimanager WiFi.begin(_ssid, _pass); delay(100); _status = AIO_NET_DISCONNECTED; */

bradrblack avatar Feb 26 '22 22:02 bradrblack

I found a better way to fix this. The hack I mention above removes the existing functionality which is not good. So instead, I overloaded the AdafruitIO_WiFi function so that it supports usage with SSSD+password and without. For example in AdafruitIO_ESP8266.h the prototypes look like this...

public: AdafruitIO_ESP8266(const char *user, const char *key, const char *ssid, const char *pass); AdafruitIO_ESP8266(const char *user, const char *key);

In the implementation for the 2nd version, I set _ssid and _pass to NULL so that those can be checked to exclude the "connect" code.

@brentru - what are your suggestions on how we can get this concept included so that we can create projects without hard-coded wifi details?

Thanks!

bradrblack avatar Aug 15 '22 22:08 bradrblack

@bradrblack If you want to checkout a PR with your changes to the existing, I'll gladly look it over.

brentru avatar Aug 16 '22 15:08 brentru

@bradrblack If you want to checkout a PR with your changes to the existing, I'll gladly look it over.

PR #160 submitted.

bradrblack avatar Aug 18 '22 00:08 bradrblack

Closing via https://github.com/adafruit/Adafruit_IO_Arduino/pull/161

brentru avatar Aug 30 '22 20:08 brentru