Post
by blavery » Thu Oct 12, 2017 1:45 pm
Agree. Something is missing. The only STA config parameter retrievable seems to be
print(sta.config('mac'))
(And incidentally, is the AP mac really the same as STA mac???)
There really needs to be in STA mode a 'ssid' read also, otherwise when the 8266 auto-reconnects using flash-stored wifi credentials, how do we determine just what router it managed to connect to. My house has 3 wifi points!
As a truly awful way of rescuing such data, how about reading the top flash sectors like this:
[code]
import esp
from flashbdev import bdev
sector_size = bdev.SEC_SIZE
flash_size = esp.flash_size()
sector = int(flash_size / sector_size-2 )
data = bytearray(esp.flash_read((sector * sector_size)+16, 20))
for j in range(0,20):
if data[j]==0:
break
print(chr(data[j]),end="")
print("")
[/code]
##### AWW, [ code ] SEEMS TO BE OFF: SUPPLY YOUR OWN INDENTING. SORRY.
I'm not sure that is the right flash address, but it is currently giving me my ssid. (Is it what I am currently logged to, even by auto-reconnect? Or is it merely a stored credential, possibly one of several?)
But this is the wrong solution, isn't it. If nodemcu-lua can easily tell me what AP I'm connected to, then surely micropython ought be able also?