Wifi captive-portal-wifi-stack not reconnecting

#1
  1. My goal is: wifi management using - origin: https://github.com/tripflex/captive-portal-wifi-stack
  2. My actions are:
$ mos get conf9.json
{
  "device": {
    "id": "esp8266_57AABF"
  },
  "wifi": {
    "ap": {
      "enable": false
    },
    "sta": {
      "enable": true,
      "ssid": "OnePlus6",
      "pass": "11111111"
    }
  },
  "cportal": {
    "enable": false
  }
}Command completed.

MOS FILE

arch: esp8266
version: 1.0
manifest_version: 2017-05-18
libs_version: ${mos.version}
modules_version: ${mos.version}
mongoose_os_version: ${mos.version}

config_schema:
  - ["debug.level", 3]
  - ["wifi.ap.enable", true]
  - ["cportal.enable", true ]
  - ["cportal.any", false]
  - ["wifi.ap.ssid", "s", "CPortal_??????", {title: "SSID"}]
  - ["wifi.ap.pass", "s", "captiveportal", {title: "Password", type: "password"}]
    # We include these with dummy values and set to false to prevent AP disconnect when scan due to device
  # only being in AP mode, to switch to AP+STA mode.  With some config set, it starts in AP+STA mode
  - ["wifi.sta.enable", false ]
  - ["wifi.sta.ssid", "Dummy_SSID" ]
  - ["wifi.sta.pass", "Dummy_PASS" ]
tags:
  - js

filesystem:
  - fs

build_vars:
  # Required to start device in AP+STA mode (to prevent disconnect on scan call)
  MGOS_WIFI_ENABLE_AP_STA: 1

libs:
  - origin: https://github.com/mongoose-os-libs/boards
  - origin: https://github.com/mongoose-os-libs/ca-bundle
  # These are required for things like mos config-set config-get, put, rm, etc
  - origin: https://github.com/mongoose-os-libs/rpc-uart
  - origin: https://github.com/mongoose-os-libs/rpc-common
  - origin: https://github.com/mongoose-os-libs/rpc-service-fs
  - origin: https://github.com/mongoose-os-libs/rpc-service-config
  - origin: https://github.com/mongoose-os-libs/rpc-loopback
  - origin: https://github.com/tripflex/captive-portal-wifi-stack
  1. The result I see is:
    Ports available:
    /dev/cu.usbserial-1410
    /dev/cu.wchusbserial1410
[Nov  7 20:50:09.055]   a Q  1 I gc  Ea  U aRb! a    U {l l  |  d |      d  b|      s #  c  gn lng    # x  l{ls$p '       l      b ' | dl   #  no  $  l`    og   $  '{   o    l  p n     s         c o |     #  og    $`   egn d`   or   '   l  d {  o   l  
[Nov  7 20:50:09.097] rBoot v1.2.1-cesanta1 - richardaburton@gmail.com
[Nov  7 20:50:09.100] Flash Size:   32 Mbit
[Nov  7 20:50:09.103] Flash Mode:   DIO
[Nov  7 20:50:09.105] Flash Speed:  80 MHz
[Nov  7 20:50:09.105] rBoot Option: Big flash
[Nov  7 20:50:09.129] 
[Nov  7 20:50:09.165] Booting rom 0 (0x100000).
[Nov  7 20:50:09.206]     e '  s  '|  d ld$`  c     | s  l o   o   l`   s l d  [   : s
[Nov  7 20:50:09.213] esp_main.c:172          app6 1.0 (20191107-151552)
[Nov  7 20:50:09.216] esp_main.c:174          Mongoose OS 2.16.0 (20191107-151552/2.16.0-g9b779cd-master)
[Nov  7 20:50:09.225] esp_main.c:178          CPU: ESP8266EX, 160 MHz, RAM: 52080 total, 49884 free
[Nov  7 20:50:09.230] esp_main.c:180          SDK 2.2.1(1247cc5); flash: 4M
[Nov  7 20:50:09.236] esp_exc.c:211           Reset cause: 6 (sys reset)
[Nov  7 20:50:09.239] mg_lwip_ev_mgr.c:93     Mongoose 6.15, LwIP 1.4.1
[Nov  7 20:50:09.244] mg_ssl_if_mbedtls.c:57  mbed TLS 2.16.3-cesanta2
[Nov  7 20:50:09.250] mgos_vfs_dev.c:73       sfl0: sysflash (), size 4194304
[Nov  7 20:50:09.254] mgos_vfs_dev.c:73       root: part ({"dev": "sfl0", "offset": 32768, "size": 262144}), size 262144
[Nov  7 20:50:09.263] mgos_vfs.c:147          /: SPIFFS @ root, opts 
[Nov  7 20:50:09.315] mgos_vfs.c:320          /: size 233681, used: 44678, free: 189003
[Nov  7 20:50:09.419] mgos_sys_config.c:232   Loading conf9.json
[Nov  7 20:50:09.427] mgos_sys_config.c:368   MAC: 2e:f4:32:57:aa:bf
[Nov  7 20:50:09.431] mgos_sys_config.c:376   WDT: 30 seconds
[Nov  7 20:50:09.437] mgos_deps_init.c:94     init i2c...
[Nov  7 20:50:09.440] mgos_deps_init.c:94     init atca...
[Nov  7 20:50:09.442] mgos_deps_init.c:94     init wifi...
[Nov  7 20:50:09.446] del if0
[Nov  7 20:50:09.446] usl
[Nov  7 20:50:09.446] mode : null
[Nov  7 20:50:09.450] mgos_wifi.c:88          WiFi STA: Using config 0 (OnePlus6)
[Nov  7 20:50:09.454] mgos_wifi.c:468         WiFi mode: STA
[Nov  7 20:50:09.457] esp_wifi.c:106          WiFi mode: STA
[Nov  7 20:50:09.460] mode : sta(2c:f4:32:57:aa:bf)
[Nov  7 20:50:09.462] add if0
[Nov  7 20:50:09.462] sleep disable
[Nov  7 20:50:09.465] WPA2 ENTERPRISE VERSION: [v2.0] disable
[Nov  7 20:50:09.468] mgos_wifi.c:270         WiFi STA: Connecting to OnePlus6
[Nov  7 20:50:09.474] mgos_deps_init.c:94     init http-server...
[Nov  7 20:50:09.478] mgos_http_server.c:282  HTTP server started on [80]
[Nov  7 20:50:09.484] mgos_deps_init.c:94     init captive-portal...
[Nov  7 20:50:09.487] mgos_deps_init.c:94     init captive-portal-wifi-setup...
[Nov  7 20:50:09.492] mgos_deps_init.c:94     init rpc-common...
[Nov  7 20:50:09.496] mgos_deps_init.c:94     init captive-portal-wifi-rpc...
[Nov  7 20:50:09.501] mgos_deps_init.c:94     init mbedtls...
[Nov  7 20:50:09.505] mgos_deps_init.c:94     init rpc-loopback...
[Nov  7 20:50:09.510] mg_rpc.c:539            0x3fff0b1c 'RPC.LOCAL' loopback
[Nov  7 20:50:09.515] mgos_deps_init.c:94     init rpc-service-config...
[Nov  7 20:50:09.518] mgos_deps_init.c:94     init rpc-service-fs...
[Nov  7 20:50:09.524] mgos_deps_init.c:94     init rpc-uart...
[Nov  7 20:50:09.527] mgos_rpc_channel_ua:313 0x3fff0da4 UART0
[Nov  7 20:50:09.530] mg_rpc.c:539            0x3fff0da4 '' UART
[Nov  7 20:50:09.533] mg_rpc.c:470            0x3fff0da4 CHAN OPEN (UART UART0)
[Nov  7 20:50:09.539] mgos_init.c:36          Init done, RAM: 52080 total, 45524 free, 45512 min free
[Nov  7 20:50:09.547] mgos_event.c:135        ev MOS0 triggered 0 handlers
[Nov  7 20:50:09.552] mgos_event.c:135        ev WFI1 triggered 0 handlers
[Nov  7 20:50:09.558] mg_rpc.c:470            0x3fff0b1c CHAN OPEN (loopback)
[Nov  7 20:50:09.563] mgos_event.c:135        ev RPC0 triggered 0 handlers
[Nov  7 20:50:09.569] mgos_net.c:86           WiFi STA: connecting
[Nov  7 20:50:09.572] mgos_event.c:135        ev NET1 triggered 1 handlers
[Nov  7 20:50:12.335] scandone
[Nov  7 20:50:13.218] state: 0 -> 2 (b0)
[Nov  7 20:50:14.198] state: 2 -> 0 (2)
[Nov  7 20:50:14.198] mgos_wifi.c:119         WiFi STA: Disconnected, reason: 2
[Nov  7 20:50:14.203] mgos_event.c:135        ev WFI0 triggered 0 handlers
[Nov  7 20:50:14.209] mgos_net.c:82           WiFi STA: disconnected
[Nov  7 20:50:14.212] mgos_event.c:135        ev NET0 triggered 1 handlers
[Nov  7 20:50:39.474] mgos_wifi.c:345         WiFi STA: Connect timeout
[Nov  7 20:50:39.477] mgos_wifi.c:88          WiFi STA: Using config 0 (OnePlus6)
[Nov  7 20:50:39.483] WPA2 ENTERPRISE VERSION: [v2.0] disable
[Nov  7 20:50:39.486] mgos_wifi.c:270         WiFi STA: Connecting to OnePlus6
[Nov  7 20:50:39.493] mgos_mongoose.c:66      New heap free LWM: 44672
[Nov  7 20:50:39.499] mgos_event.c:135        ev WFI1 triggered 0 handlers
[Nov  7 20:50:39.503] mgos_net.c:86           WiFi STA: connecting
[Nov  7 20:50:39.508] mgos_event.c:135        ev NET1 triggered 1 handlers
[Nov  7 20:50:42.334] scandone
[Nov  7 20:50:42.334] mgos_wifi.c:119         WiFi STA: Disconnected, reason: 201
[Nov  7 20:50:42.340] mgos_event.c:135        ev WFI0 triggered 0 handlers
[Nov  7 20:50:42.343] mgos_net.c:82           WiFi STA: disconnected
[Nov  7 20:50:42.349] mgos_event.c:135        ev NET0 triggered 1 handlers
[Nov  7 20:50:59.372] RAME SENT (1)
[Nov  7 20:50:59.390] sd $  |  l <      l  #|      s b  #  no $gn    c p  d{$sdp g       l      c o | ll   c  g'  l  d`  e og   l  n{   g    l` x o     ;         b ' |     c  'o    d`   eo' l`   or   '   l  d {  o   d  
[Nov  7 20:50:59.415] rBoot v1.2.1-cesanta1 - richardaburton@gmail.com
[Nov  7 20:50:59.420] Flash Size:   32 Mbit
[Nov  7 20:50:59.421] Flash Mode:   DIO
[Nov  7 20:50:59.423] Flash Speed:  80 MHz
[Nov  7 20:50:59.423] rBoot Option: Big flash
[Nov  7 20:50:59.447] 
[Nov  7 20:50:59.483] Booting rom 0 (0x100000).
[Nov  7 20:50:59.525]       o  ;  o|  l dll`  c e   | {  $ '   '   d`   { d le [   : s
[Nov  7 20:50:59.532] esp_main.c:172          app6 1.0 (20191107-151552)
[Nov  7 20:50:59.535] esp_main.c:174          Mongoose OS 2.16.0 (20191107-151552/2.16.0-g9b779cd-master)
[Nov  7 20:50:59.543] esp_main.c:178          CPU: ESP8266EX, 160 MHz, RAM: 52080 total, 49884 free
[Nov  7 20:50:59.549] esp_main.c:180          SDK 2.2.1(1247cc5); flash: 4M
[Nov  7 20:50:59.554] esp_exc.c:211           Reset cause: 6 (sys reset)
[Nov  7 20:50:59.557] mg_lwip_ev_mgr.c:93     Mongoose 6.15, LwIP 1.4.1
[Nov  7 20:50:59.563] mg_ssl_if_mbedtls.c:57  mbed TLS 2.16.3-cesanta2
[Nov  7 20:50:59.569] mgos_vfs_dev.c:73       sfl0: sysflash (), size 4194304
[Nov  7 20:50:59.573] mgos_vfs_dev.c:73       root: part ({"dev": "sfl0", "offset": 32768, "size": 262144}), size 262144
[Nov  7 20:50:59.581] mgos_vfs.c:147          /: SPIFFS @ root, opts 
[Nov  7 20:50:59.633] mgos_vfs.c:320          /: size 233681, used: 44678, free: 189003
[Nov  7 20:50:59.738] mgos_sys_config.c:232   Loading conf9.json
[Nov  7 20:50:59.746] mgos_sys_config.c:368   MAC: 2e:f4:32:57:aa:bf
[Nov  7 20:50:59.750] mgos_sys_config.c:376   WDT: 30 seconds
[Nov  7 20:50:59.755] mgos_deps_init.c:94     init i2c...
[Nov  7 20:50:59.758] mgos_deps_init.c:94     init atca...
[Nov  7 20:50:59.761] mgos_deps_init.c:94     init wifi...
[Nov  7 20:50:59.764] del if0
[Nov  7 20:50:59.764] usl
[Nov  7 20:50:59.764] mode : null
[Nov  7 20:50:59.767] mgos_wifi.c:88          WiFi STA: Using config 0 (OnePlus6)
[Nov  7 20:50:59.772] mgos_wifi.c:468         WiFi mode: STA
[Nov  7 20:50:59.775] esp_wifi.c:106          WiFi mode: STA
[Nov  7 20:50:59.778] mode : sta(2c:f4:32:57:aa:bf)
[Nov  7 20:50:59.781] add if0
[Nov  7 20:50:59.781] sleep disable
[Nov  7 20:50:59.784] WPA2 ENTERPRISE VERSION: [v2.0] disable
[Nov  7 20:50:59.786] mgos_wifi.c:270         WiFi STA: Connecting to OnePlus6
[Nov  7 20:50:59.793] mgos_deps_init.c:94     init http-server...
[Nov  7 20:50:59.796] mgos_http_server.c:282  HTTP server started on [80]
[Nov  7 20:50:59.802] mgos_deps_init.c:94     init captive-portal...
[Nov  7 20:50:59.805] mgos_deps_init.c:94     init captive-portal-wifi-setup...
[Nov  7 20:50:59.810] mgos_deps_init.c:94     init rpc-common...
[Nov  7 20:50:59.814] mgos_deps_init.c:94     init captive-portal-wifi-rpc...
[Nov  7 20:50:59.820] mgos_deps_init.c:94     init mbedtls...
[Nov  7 20:50:59.823] mgos_deps_init.c:94     init rpc-loopback...
[Nov  7 20:50:59.828] mg_rpc.c:539            0x3fff0b1c 'RPC.LOCAL' loopback
[Nov  7 20:50:59.834] mgos_deps_init.c:94     init rpc-service-config...
[Nov  7 20:50:59.837] mgos_deps_init.c:94     init rpc-service-fs...
[Nov  7 20:50:59.843] mgos_deps_init.c:94     init rpc-uart...
[Nov  7 20:50:59.846] mgos_rpc_channel_ua:313 0x3fff0da4 UART0
[Nov  7 20:50:59.849] mg_rpc.c:539            0x3fff0da4 '' UART
[Nov  7 20:50:59.852] mg_rpc.c:470            0x3fff0da4 CHAN OPEN (UART UART0)
[Nov  7 20:50:59.857] mgos_init.c:36          Init done, RAM: 52080 total, 45524 free, 45512 min free
[Nov  7 20:50:59.866] mgos_event.c:135        ev MOS0 triggered 0 handlers
[Nov  7 20:50:59.870] mgos_event.c:135        ev WFI1 triggered 0 handlers
[Nov  7 20:50:59.876] mg_rpc.c:470            0x3fff0b1c CHAN OPEN (loopback)
[Nov  7 20:50:59.882] mgos_event.c:135        ev RPC0 triggered 0 handlers
[Nov  7 20:50:59.888] mgos_net.c:86           WiFi STA: connecting
[Nov  7 20:50:59.890] mgos_event.c:135        ev NET1 triggered 1 handlers
[Nov  7 20:51:02.633] scandone
[Nov  7 20:51:02.633] mgos_wifi.c:119         WiFi STA: Disconnected, reason: 201
[Nov  7 20:51:02.639] mgos_event.c:135        ev WFI0 triggered 0 handlers
[Nov  7 20:51:02.642] mgos_net.c:82           WiFi STA: disconnected
[Nov  7 20:51:02.648] mgos_event.c:135        ev NET0 triggered 1 handlers
[Nov  7 20:51:29.792] mgos_wifi.c:345         WiFi STA: Connect timeout
[Nov  7 20:51:29.795] mgos_wifi.c:88          WiFi STA: Using config 0 (OnePlus6)
[Nov  7 20:51:29.801] WPA2 ENTERPRISE VERSION: [v2.0] disable
[Nov  7 20:51:29.804] mgos_wifi.c:270         WiFi STA: Connecting to OnePlus6
[Nov  7 20:51:29.810] mgos_mongoose.c:66      New heap free LWM: 44672
[Nov  7 20:51:29.817] mgos_event.c:135        ev WFI1 triggered 0 handlers
[Nov  7 20:51:29.820] mgos_net.c:86           WiFi STA: connecting
[Nov  7 20:51:29.826] mgos_event.c:135        ev NET1 triggered 1 handlers
[Nov  7 20:51:32.659] scandone
[Nov  7 20:51:32.659] state: 0 -> 2 (b0)
[Nov  7 20:51:32.659] state: 2 -> 3 (0)
[Nov  7 20:51:32.672] state: 3 -> 5 (10)
[Nov  7 20:51:32.700] add 0
[Nov  7 20:51:32.700] aid 1
[Nov  7 20:51:32.700] cnt 
[Nov  7 20:51:36.695] state: 5 -> 2 (2a0)
[Nov  7 20:51:36.695] rm 0
[Nov  7 20:51:36.695] mgos_wifi.c:119         WiFi STA: Disconnected, reason: 2
[Nov  7 20:51:36.701] mgos_event.c:135        ev WFI0 triggered 0 handlers
[Nov  7 20:51:36.707] mgos_net.c:82           WiFi STA: disconnected
[Nov  7 20:51:36.710] mgos_event.c:135        ev NET0 triggered 1 handlers
[Nov  7 20:51:59.811] mgos_wifi.c:345         WiFi STA: Connect timeout
[Nov  7 20:51:59.814] mgos_wifi.c:88          WiFi STA: Using config 0 (OnePlus6)
[Nov  7 20:51:59.820] state: 2 -> 0 (0)
[Nov  7 20:51:59.822] WPA2 ENTERPRISE VERSION: [v2.0] disable
[Nov  7 20:51:59.825] mgos_wifi.c:270         WiFi STA: Connecting to OnePlus6
[Nov  7 20:51:59.832] mgos_mongoose.c:66      New heap free LWM: 44624
[Nov  7 20:51:59.836] mgos_event.c:135        ev WFI1 triggered 0 handlers
[Nov  7 20:51:59.842] mgos_wifi.c:119         WiFi STA: Disconnected, reason: 202
[Nov  7 20:51:59.847] mgos_event.c:135        ev WFI0 triggered 0 handlers
[Nov  7 20:51:59.851] mgos_net.c:86           WiFi STA: connecting
[Nov  7 20:51:59.857] mgos_event.c:135        ev NET1 triggered 1 handlers
[Nov  7 20:51:59.859] mgos_net.c:82           WiFi STA: disconnected
[Nov  7 20:51:59.865] mgos_event.c:135        ev NET0 triggered 1 handlers
[Nov  7 20:52:02.674] scandone
[Nov  7 20:52:02.674] state: 0 -> 2 (b0)
[Nov  7 20:52:02.674] state: 2 -> 3 (0)
[Nov  7 20:52:02.686] state: 3 -> 5 (10)
[Nov  7 20:52:02.708] add 0
[Nov  7 20:52:02.709] aid 2
[Nov  7 20:52:02.709] cnt 
[Nov  7 20:52:06.700] state: 5 -> 2 (2a0)
[Nov  7 20:52:06.700] rm 0
[Nov  7 20:52:06.700] mgos_wifi.c:119         WiFi STA: Disconnected, reason: 2
[Nov  7 20:52:06.706] mgos_event.c:135        ev WFI0 triggered 0 handlers
[Nov  7 20:52:06.715] mgos_net.c:82           WiFi STA: disconnected
[Nov  7 20:52:06.715] mgos_event.c:135        ev NET0 triggered 1 handlers
[Nov  7 20:52:29.831] mgos_wifi.c:345         WiFi STA: Connect timeout
[Nov  7 20:52:29.834] mgos_wifi.c:88          WiFi STA: Using config 0 (OnePlus6)
[Nov  7 20:52:29.840] state: 2 -> 0 (0)
[Nov  7 20:52:29.843] WPA2 ENTERPRISE VERSION: [v2.0] disable
[Nov  7 20:52:29.845] mgos_wifi.c:270         WiFi STA: Connecting to OnePlus6
[Nov  7 20:52:29.854] mgos_event.c:135        ev WFI1 triggered 0 handlers
[Nov  7 20:52:29.857] mgos_wifi.c:119         WiFi STA: Disconnected, reason: 202
[Nov  7 20:52:29.862] mgos_event.c:135        ev WFI0 triggered 0 handlers
[Nov  7 20:52:29.868] mgos_net.c:86           WiFi STA: connecting
[Nov  7 20:52:29.871] mgos_event.c:135        ev NET1 triggered 1 handlers
[Nov  7 20:52:29.877] mgos_net.c:82           WiFi STA: disconnected
[Nov  7 20:52:29.880] mgos_event.c:135        ev NET0 triggered 1 handlers
[Nov  7 20:52:32.695] scandone
[Nov  7 20:52:32.695] state: 0 -> 2 (b0)
[Nov  7 20:52:32.695] state: 2 -> 3 (0)
[Nov  7 20:52:32.708] state: 3 -> 5 (10)
[Nov  7 20:52:32.732] add 0
[Nov  7 20:52:32.732] aid 3
[Nov  7 20:52:32.732] cnt 
[Nov  7 20:52:36.727] state: 5 -> 2 (2a0)
[Nov  7 20:52:36.727] rm 0
[Nov  7 20:52:36.727] mgos_wifi.c:119         WiFi STA: Disconnected, reason: 2
[Nov  7 20:52:36.733] mgos_event.c:135        ev WFI0 triggered 0 handlers
[Nov  7 20:52:36.738] mgos_net.c:82           WiFi STA: disconnected
[Nov  7 20:52:36.741] mgos_event.c:135        ev NET0 triggered 1 handlers
[Nov  7 20:52:59.852] mgos_wifi.c:345         WiFi STA: Connect timeout
[Nov  7 20:52:59.855] mgos_wifi.c:88          WiFi STA: Using config 0 (OnePlus6)
[Nov  7 20:52:59.860] state: 2 -> 0 (0)
[Nov  7 20:52:59.868] WPA2 ENTERPRISE VERSION: [v2.0] disable
[Nov  7 20:52:59.868] mgos_wifi.c:270         WiFi STA: Connecting to OnePlus6
[Nov  7 20:52:59.874] mgos_event.c:135        ev WFI1 triggered 0 handlers
[Nov  7 20:52:59.878] mgos_wifi.c:119         WiFi STA: Disconnected, reason: 202
[Nov  7 20:52:59.883] mgos_event.c:135        ev WFI0 triggered 0 handlers
[Nov  7 20:52:59.889] mgos_net.c:86           WiFi STA: connecting
[Nov  7 20:52:59.892] mgos_event.c:135        ev NET1 triggered 1 handlers
[Nov  7 20:52:59.898] mgos_net.c:82           WiFi STA: disconnected
[Nov  7 20:52:59.901] mgos_event.c:135        ev NET0 triggered 1 handlers
[Nov  7 20:53:02.714] scandone
[Nov  7 20:53:02.714] state: 0 -> 2 (b0)
[Nov  7 20:53:02.714] state: 2 -> 3 (0)
[Nov  7 20:53:02.725] state: 3 -> 5 (10)
[Nov  7 20:53:02.749] add 0
[Nov  7 20:53:02.749] aid 4
[Nov  7 20:53:02.749] cnt 
[Nov  7 20:53:06.746] state: 5 -> 2 (2a0)
[Nov  7 20:53:06.746] rm 0
[Nov  7 20:53:06.746] mgos_wifi.c:119         WiFi STA: Disconnected, reason: 2
[Nov  7 20:53:06.753] mgos_event.c:135        ev WFI0 triggered 0 handlers
[Nov  7 20:53:06.758] mgos_net.c:82           WiFi STA: disconnected
[Nov  7 20:53:06.763] mgos_event.c:135        ev NET0 triggered 1 handlers
[Nov  7 20:53:29.872] mgos_wifi.c:345         WiFi STA: Connect timeout
[Nov  7 20:53:29.875] mgos_wifi.c:88          WiFi STA: Using config 0 (OnePlus6)
[Nov  7 20:53:29.881] state: 2 -> 0 (0)
[Nov  7 20:53:29.884] WPA2 ENTERPRISE VERSION: [v2.0] disable
[Nov  7 20:53:29.886] mgos_wifi.c:270         WiFi STA: Connecting to OnePlus6
[Nov  7 20:53:29.894] mgos_event.c:135        ev WFI1 triggered 0 handlers
[Nov  7 20:53:29.898] mgos_wifi.c:119         WiFi STA: Disconnected, reason: 202
[Nov  7 20:53:29.903] mgos_event.c:135        ev WFI0 triggered 0 handlers
[Nov  7 20:53:29.909] mgos_net.c:86           WiFi STA: connecting
[Nov  7 20:53:29.912] mgos_event.c:135        ev NET1 triggered 1 handlers
[Nov  7 20:53:29.918] mgos_net.c:82           WiFi STA: disconnected
[Nov  7 20:53:29.921] mgos_event.c:135        ev NET0 triggered 1 handlers
[Nov  7 20:53:32.737] scandone
[Nov  7 20:53:32.737] state: 0 -> 2 (b0)
[Nov  7 20:53:32.737] state: 2 -> 3 (0)
[Nov  7 20:53:32.754] state: 3 -> 5 (10)
[Nov  7 20:53:32.777] add 0
[Nov  7 20:53:32.777] aid 5
[Nov  7 20:53:32.777] cnt 
[Nov  7 20:53:36.774] state: 5 -> 2 (2a0)
[Nov  7 20:53:36.774] rm 0
[Nov  7 20:53:36.774] mgos_wifi.c:119         WiFi STA: Disconnected, reason: 2
[Nov  7 20:53:36.780] mgos_event.c:135        ev WFI0 triggered 0 handlers
[Nov  7 20:53:36.786] mgos_net.c:82           WiFi STA: disconnected
[Nov  7 20:53:36.789] mgos_event.c:135        ev NET0 triggered 1 handlers
[Nov  7 20:53:59.893] mgos_wifi.c:345         WiFi STA: Connect timeout
[Nov  7 20:53:59.896] mgos_wifi.c:88          WiFi STA: Using config 0 (OnePlus6)
[Nov  7 20:53:59.901] state: 2 -> 0 (0)
[Nov  7 20:53:59.904] WPA2 ENTERPRISE VERSION: [v2.0] disable
[Nov  7 20:53:59.907] mgos_wifi.c:270         WiFi STA: Connecting to OnePlus6
[Nov  7 20:53:59.915] mgos_event.c:135        ev WFI1 triggered 0 handlers
[Nov  7 20:53:59.918] mgos_wifi.c:119         WiFi STA: Disconnected, reason: 202
[Nov  7 20:53:59.924] mgos_event.c:135        ev WFI0 triggered 0 handlers
[Nov  7 20:53:59.930] mgos_net.c:86           WiFi STA: connecting
[Nov  7 20:53:59.933] mgos_event.c:135        ev NET1 triggered 1 handlers
[Nov  7 20:53:59.939] mgos_net.c:82           WiFi STA: disconnected
[Nov  7 20:53:59.942] mgos_event.c:135        ev NET0 triggered 1 handlers
[Nov  7 20:54:02.759] scandone
[Nov  7 20:54:02.759] state: 0 -> 2 (b0)
[Nov  7 20:54:02.759] state: 2 -> 3 (0)
[Nov  7 20:54:02.769] state: 3 -> 5 (10)
[Nov  7 20:54:02.793] add 0
[Nov  7 20:54:02.793] aid 6
[Nov  7 20:54:02.793] cnt 
[Nov  7 20:54:06.803] state: 5 -> 2 (2a0)
[Nov  7 20:54:06.803] rm 0
[Nov  7 20:54:06.803] mgos_wifi.c:119         WiFi STA: Disconnected, reason: 2
[Nov  7 20:54:06.808] mgos_event.c:135        ev WFI0 triggered 0 handlers
[Nov  7 20:54:06.814] mgos_net.c:82           WiFi STA: disconnected
[Nov  7 20:54:06.817] mgos_event.c:135        ev NET0 triggered 1 handlers
[Nov  7 20:54:29.914] mgos_wifi.c:345         WiFi STA: Connect timeout
[Nov  7 20:54:29.917] mgos_wifi.c:88          WiFi STA: Using config 0 (OnePlus6)
[Nov  7 20:54:29.922] state: 2 -> 0 (0)
[Nov  7 20:54:29.925] WPA2 ENTERPRISE VERSION: [v2.0] disable
[Nov  7 20:54:29.928] mgos_wifi.c:270         WiFi STA: Connecting to OnePlus6
[Nov  7 20:54:29.936] mgos_event.c:135        ev WFI1 triggered 0 handlers
[Nov  7 20:54:29.939] mgos_wifi.c:119         WiFi STA: Disconnected, reason: 202
[Nov  7 20:54:29.944] mgos_event.c:135        ev WFI0 triggered 0 handlers
[Nov  7 20:54:29.950] mgos_net.c:86           WiFi STA: connecting
[Nov  7 20:54:29.953] mgos_event.c:135        ev NET1 triggered 1 handlers
[Nov  7 20:54:29.959] mgos_net.c:82           WiFi STA: disconnected
[Nov  7 20:54:29.962] mgos_event.c:135        ev NET0 triggered 1 handlers
[Nov  7 20:54:32.777] scandone
[Nov  7 20:54:32.777] state: 0 -> 2 (b0)
[Nov  7 20:54:32.777] state: 2 -> 3 (0)
[Nov  7 20:54:32.790] state: 3 -> 5 (10)
[Nov  7 20:54:32.813] add 0
[Nov  7 20:54:32.813] aid 7
[Nov  7 20:54:32.813] cnt 
[Nov  7 20:54:36.811] state: 5 -> 2 (2a0)
[Nov  7 20:54:36.811] rm 0
[Nov  7 20:54:36.811] mgos_wifi.c:119         WiFi STA: Disconnected, reason: 2
[Nov  7 20:54:36.816] mgos_event.c:135        ev WFI0 triggered 0 handlers
[Nov  7 20:54:36.824] mgos_net.c:82           WiFi STA: disconnected
[Nov  7 20:54:36.826] mgos_event.c:135        ev NET0 triggered 1 handlers
[Nov  7 20:54:59.934] mgos_wifi.c:345         WiFi STA: Connect timeout
[Nov  7 20:54:59.937] mgos_wifi.c:88          WiFi STA: Using config 0 (OnePlus6)
[Nov  7 20:54:59.943] state: 2 -> 0 (0)
[Nov  7 20:54:59.945] WPA2 ENTERPRISE VERSION: [v2.0] disable
[Nov  7 20:54:59.948] mgos_wifi.c:270         WiFi STA: Connecting to OnePlus6
[Nov  7 20:54:59.956] mgos_event.c:135        ev WFI1 triggered 0 handlers
[Nov  7 20:54:59.960] mgos_wifi.c:119         WiFi STA: Disconnected, reason: 202
[Nov  7 20:54:59.965] mgos_event.c:135        ev WFI0 triggered 0 handlers
[Nov  7 20:54:59.971] mgos_net.c:86           WiFi STA: connecting
[Nov  7 20:54:59.974] mgos_event.c:135        ev NET1 triggered 1 handlers
[Nov  7 20:54:59.980] mgos_net.c:82           WiFi STA: disconnected
[Nov  7 20:54:59.982] mgos_event.c:135        ev NET0 triggered 1 handlers
[Nov  7 20:55:02.804] scandone
[Nov  7 20:55:02.804] state: 0 -> 2 (b0)
[Nov  7 20:55:02.804] state: 2 -> 3 (0)
[Nov  7 20:55:02.818] state: 3 -> 5 (10)
[Nov  7 20:55:02.841] add 0
[Nov  7 20:55:02.841] aid 8
[Nov  7 20:55:02.841] cnt 
[Nov  7 20:55:06.832] state: 5 -> 2 (2a0)
[Nov  7 20:55:06.833] rm 0
[Nov  7 20:55:06.833] mgos_wifi.c:119         WiFi STA: Disconnected, reason: 2
[Nov  7 20:55:06.838] mgos_event.c:135        ev WFI0 triggered 0 handlers
[Nov  7 20:55:06.844] mgos_net.c:82           WiFi STA: disconnected
[Nov  7 20:55:06.848] mgos_event.c:135        ev NET0 triggered 1 handlers
[Nov  7 20:55:29.955] mgos_wifi.c:345         WiFi STA: Connect timeout
[Nov  7 20:55:29.958] mgos_wifi.c:88          WiFi STA: Using config 0 (OnePlus6)
[Nov  7 20:55:29.963] state: 2 -> 0 (0)
[Nov  7 20:55:29.966] WPA2 ENTERPRISE VERSION: [v2.0] disable
[Nov  7 20:55:29.969] mgos_wifi.c:270         WiFi STA: Connecting to OnePlus6
[Nov  7 20:55:29.979] mgos_event.c:135        ev WFI1 triggered 0 handlers
[Nov  7 20:55:29.980] mgos_wifi.c:119         WiFi STA: Disconnected, reason: 202
[Nov  7 20:55:29.985] mgos_event.c:135        ev WFI0 triggered 0 handlers
[Nov  7 20:55:29.992] mgos_net.c:86           WiFi STA: connecting
[Nov  7 20:55:29.995] mgos_event.c:135        ev NET1 triggered 1 handlers
[Nov  7 20:55:30.001] mgos_net.c:82           WiFi STA: disconnected
[Nov  7 20:55:30.004] mgos_event.c:135        ev NET0 triggered 1 handlers
[Nov  7 20:55:32.816] scandone
[Nov  7 20:55:32.816] state: 0 -> 2 (b0)
[Nov  7 20:55:32.816] state: 2 -> 3 (0)
[Nov  7 20:55:32.823] state: 3 -> 5 (10)
[Nov  7 20:55:32.847] add 0
[Nov  7 20:55:32.847] aid 1
[Nov  7 20:55:32.847] cnt 
[Nov  7 20:55:36.841] state: 5 -> 2 (2a0)
[Nov  7 20:55:36.841] rm 0
[Nov  7 20:55:36.841] mgos_wifi.c:119         WiFi STA: Disconnected, reason: 2
[Nov  7 20:55:36.847] mgos_event.c:135        ev WFI0 triggered 0 handlers
[Nov  7 20:55:36.853] mgos_net.c:82           WiFi STA: disconnected
[Nov  7 20:55:36.856] mgos_event.c:135        ev NET0 triggered 1 handlers
[Nov  7 20:55:59.975] mgos_wifi.c:345         WiFi STA: Connect timeout
[Nov  7 20:55:59.978] mgos_wifi.c:88          WiFi STA: Using config 0 (OnePlus6)
[Nov  7 20:55:59.984] state: 2 -> 0 (0)
[Nov  7 20:55:59.986] WPA2 ENTERPRISE VERSION: [v2.0] disable
[Nov  7 20:55:59.990] mgos_wifi.c:270         WiFi STA: Connecting to OnePlus6
[Nov  7 20:55:59.997] mgos_event.c:135        ev WFI1 triggered 0 handlers
[Nov  7 20:56:00.001] mgos_wifi.c:119         WiFi STA: Disconnected, reason: 202
[Nov  7 20:56:00.006] mgos_event.c:135        ev WFI0 triggered 0 handlers
[Nov  7 20:56:00.012] mgos_net.c:86           WiFi STA: connecting
[Nov  7 20:56:00.015] mgos_event.c:135        ev NET1 triggered 1 handlers
[Nov  7 20:56:00.021] mgos_net.c:82           WiFi STA: disconnected
[Nov  7 20:56:00.024] mgos_event.c:135        ev NET0 triggered 1 handlers
[Nov  7 20:56:02.860] scandone
[Nov  7 20:56:02.860] state: 0 -> 2 (b0)
[Nov  7 20:56:02.897] state: 2 -> 3 (0)
[Nov  7 20:56:02.897] state: 3 -> 5 (10)
[Nov  7 20:56:02.921] add 0
[Nov  7 20:56:02.921] aid 2
[Nov  7 20:56:02.921] cnt 
[Nov  7 20:56:12.899] pm open,type:0 0
[Nov  7 20:56:12.899] state: 5 -> 0 (2)
[Nov  7 20:56:12.901] rm 0
[Nov  7 20:56:12.901] pm close 7
[Nov  7 20:56:12.902] mgos_wifi.c:119         WiFi STA: Disconnected, reason: 204
[Nov  7 20:56:12.907] mgos_event.c:135        ev WFI0 triggered 0 handlers
[Nov  7 20:56:12.913] mgos_net.c:82           WiFi STA: disconnected
[Nov  7 20:56:12.916] mgos_event.c:135        ev NET0 triggered 1 handlers
[Nov  7 20:56:29.996] mgos_wifi.c:345         WiFi STA: Connect timeout
[Nov  7 20:56:29.999] mgos_wifi.c:88          WiFi STA: Using config 0 (OnePlus6)
[Nov  7 20:56:30.005] WPA2 ENTERPRISE VERSION: [v2.0] disable
[Nov  7 20:56:30.007] mgos_wifi.c:270         WiFi STA: Connecting to OnePlus6
[Nov  7 20:56:30.016] mgos_event.c:135        ev WFI1 triggered 0 handlers
[Nov  7 20:56:30.021] mgos_net.c:86           WiFi STA: connecting
[Nov  7 20:56:30.024] mgos_event.c:135        ev NET1 triggered 1 handlers
[Nov  7 20:56:32.866] scandone
[Nov  7 20:56:32.866] state: 0 -> 2 (b0)
[Nov  7 20:56:32.866] state: 2 -> 3 (0)
[Nov  7 20:56:32.888] state: 3 -> 5 (10)
[Nov  7 20:56:32.911] add 0
[Nov  7 20:56:32.911] aid 4
[Nov  7 20:56:32.911] cnt 
[Nov  7 20:56:36.915] state: 5 -> 2 (2a0)
[Nov  7 20:56:36.915] rm 0
[Nov  7 20:56:36.915] mgos_wifi.c:119         WiFi STA: Disconnected, reason: 2
[Nov  7 20:56:36.921] mgos_event.c:135        ev WFI0 triggered 0 handlers
[Nov  7 20:56:36.927] mgos_net.c:82           WiFi STA: disconnected
[Nov  7 20:56:36.930] mgos_event.c:135        ev NET0 triggered 1 handlers
  1. My expectation & question is: when esp8266 device got powered before wifi router wifi never gets connected and always show above error .
    after reboot the device it gets connected …