Black Lives Matter - Action and Equality. ... Adafruit is open and shipping.
0

Connecting to aio without using password and ssid
Moderators: adafruit_support_bill, adafruit

Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.
Please be positive and constructive with your questions and comments.

Connecting to aio without using password and ssid

by loucrem on Thu Jul 25, 2019 3:37 pm

Hello,
I'm trying to write code so i don't have to hard code credentials in every time I move to a different network. I'm using a Feather HUZZAH with ESP8266 WiFi. I have had success using WiFiManager (https://github.com/tzapu/WiFiManager) to connect to my network. Is there a way to connect to aio if I'm already connected to a network?

In the example codes, the line AdafruitIO_WiFi io(IO_USERNAME, IO_KEY, WIFI_SSID, WIFI_PASS) under config.h is whats used to create a client ( I think thats correct), but is there a way to connect without including WIFI_SSID and WIFI_PASS as im already connected to my network? Ive tried searching through the library but cannot find anything that does this.

any help would be appreciated
thank you

loucrem
 
Posts: 7
Joined: Wed Jan 09, 2013 9:32 am

Re: Connecting to aio without using password and ssid

by brubell on Thu Jul 25, 2019 4:12 pm

This functionality doesn't exist (and isn't tested) within the Adafruit IO Arduino library. However, if you are able to switch this project over to a CircuitPython board - the Adafruit IO CircuitPython library (https://github.com/adafruit/Adafruit_Ci ... dafruitIO/) allows you to edit a secrets.py file on the device containing network credentials.

brubell
 
Posts: 993
Joined: Fri Jul 17, 2015 10:33 pm

Re: Connecting to aio without using password and ssid

by 1CM69 on Fri Aug 09, 2019 2:29 pm

loucrem wrote:Hello,
I'm trying to write code so i don't have to hard code credentials in every time I move to a different network. I'm using a Feather HUZZAH with ESP8266 WiFi. I have had success using WiFiManager (https://github.com/tzapu/WiFiManager) to connect to my network. Is there a way to connect to aio if I'm already connected to a network?

In the example codes, the line AdafruitIO_WiFi io(IO_USERNAME, IO_KEY, WIFI_SSID, WIFI_PASS) under config.h is whats used to create a client ( I think thats correct), but is there a way to connect without including WIFI_SSID and WIFI_PASS as im already connected to my network? Ive tried searching through the library but cannot find anything that does this.

any help would be appreciated
thank you


Hi,
I have just worked through this same issue (well not really an issue) myself.

My sketch is already connected to my WiFi network because it is also sending data to ThingSpeak.

I noticed that the function call
Code: Select all | TOGGLE FULL SIZE
io.connect();
became irrelevant and could be commented out.

Now I tidied the code a little more like this

Code: Select all | TOGGLE FULL SIZE
#define AIO_USERNAME    "******" // Enter you AIO Username
#define AIO_KEY         "******" // Enter your AIO Key
const char* xssid = ""; // Leave empty
const char* xpassword = ""; // Leave empty

AdafruitIO_WiFi io(AIO_USERNAME, AIO_KEY, xssid, xpassword); // This now connect to AIO without using your WiFi credentials as long as your are connected to your network first.


More of a dirty fix, try it at your own risk.

Kirk

1CM69
 
Posts: 4
Joined: Mon Jul 22, 2019 9:10 am

Please be positive and constructive with your questions and comments.