As the title says... Chat on...

User avatar
By xtal
#35385 I found this and several deviations of this,, Its not very reliable on sdk 1.4.0 ...
My main/strongest Ap is not always detected, maybe 50% of tries.......
Code: Select allwifi.sta.getap(function(T) for k,v in pairs(T) do print(k..":"..v) end end)


Anybody have a better solution?
User avatar
By xtal
#35684 after much trying I've decided that sdk 1.4.0 / Nodemcu is quite unreliable when it comes to displaying access points...its quite hit and miss...

My primary AP 100% signal will only show up about 1 out of 15-20 tries...
User avatar
By JeremiahLandi
#36857 Just to follow up on the code:

Code: Select all-- print ap list
function listap(t)
      for k,v in pairs(t) do
        print(k.." : "..v)
      end
end
wifi.sta.getap(listap)


and this code:

Code: Select all-- print ap list
function listap(t)
      for ssid,v in pairs(t) do
        authmode, rssi, bssid, channel =
          string.match(v, "(%d),(-?%d+),(%x%x:%x%x:%x%x:%x%x:%x%x:%x%x),(%d+)")
        print(ssid,authmode,rssi,bssid,channel)
      end
end
     
wifi.sta.getap(listap)


I found both on Ada Fruit (https://learn.adafruit.com/adafruit-huzzah-esp8266-breakout/using-nodemcu-lua).

I'll have to dig around since I am working on this now. I know I have seen more than a couple threads that bring up what you are talking about around the community. I'll post back what I find.