-->
Page 1 of 2

Wifi connection and Wifi AP at same time

PostPosted: Tue May 02, 2017 2:46 pm
by faramon
Hi all,

I have prgram for control of relay within Mqtt and it works. At the start of the program I set local wifi SSID and Pass and this whole thing works. This evening I try to go one step furter doing wifi AP and this works if just set AP and disable code for connecting to local wifi. If I put AP at begining and then connect to local wifi then wifi is ok but AP disconnects. My idea is to have AP with login to SSID and PASS that I can go visit my friends house and connect to wifi. This login to SSID and PASS will be whole time active (HTML FORM). And with this connection to store SSID and PASS to lua file that is used for seting local wifi connection SSID and PASS.
Is this possible to have wifi AP active and connected to local wifi active same time?

Thanx,
Faramon

Re: Wifi connection and Wifi AP at same time

PostPosted: Tue May 02, 2017 2:53 pm
by marcelstoer
I believe you're looking for `wifi.STATIONAP` mode as per https://nodemcu.readthedocs.io/en/lates ... ifisetmode

Re: Wifi connection and Wifi AP at same time

PostPosted: Tue May 02, 2017 2:59 pm
by faramon
Jap, I think it is...

I use wifi.setmode(wifi.SOFTAP)...

Re: Wifi connection and Wifi AP at same time

PostPosted: Tue May 02, 2017 3:05 pm
by rudy
If I put AP at begining and then connect to local wifi then wifi is ok but AP disconnects.


The channel number that is used is set by the local wifi connection. The ESP8266 as a client determines the channel. If the AP was started on a different channel it will get disconnected because the channel changed for the ESP as client to connect to the local network. Start the AP after the connection to the network.