wlan.Smartconfig()
-
Is https://docs.pycom.io/firmwareapi/pycom/network/wlan/ still current? After I run wlan.Smartconfig() with esp touch should the gpy automatically connect to the router? If not what format should the wlan.connect() command take (given that esp touch has already provided the user name & password)?
-
@kjm Still trying to figure out if wlan.smartConfig works &, if not, why not. My first effort is printing that smartConfig is both done & timed out which is hard to believe, so I must have the callback wrong somehow? Can someone point me in the right direction please?
from network import WLAN def conf(msg): print('smart config', msg) wlan = WLAN(mode=WLAN.STA, antenna=WLAN.INT_ANT) if wlan.isconnected(): print('connected') wlan.callback(trigger=WLAN.SMART_CONF_DONE, handler=conf('done')) wlan.callback(trigger=WLAN.SMART_CONF_TIMEOUT, handler=conf('timed out')) print('try smartConfig'); wlan.smartConfig() -
Hi,
Ill check this for you tomorrow if that is okay with you! Im not too sure what SmartConfig is supposed to do myself yet, but we'll get there
Best,
Gijs -
@Gijs OK. Not wishing to muddy the waters, but before I started mucking around with smartConfig my gpy used to b'cast an ad hoc wifi network on power up. That no longer happens, even though I've run import pycom; pycom.wifi_on_boot(1) to restore it. I think the loss of the adhoc network might have something to do with my smartConfig issues? Pycom modules can be opaque when it comes to working out what mode they are in.
-
@kjm You'll get ad-hoc WiFi back if you disable pybytes on boot. Call pycom.pybytes_on_boot(False)
-
@robert-hh This damn ESPTouch app actually worked a couple of times but I can't repeat the success! Is there a way I can see a list of acceptable pycom dot methods? I'm not having much luck with pycom.smartConfig_on_boot() or pycom.smart_config_on_boot()
-
-
@robert-hh Tnx Rob, I haven't got the callbacks correct but smartConfig works (the ad hoc wifi has to be off). I assumed the ESPtouch app on the phone sends to the gpy but it actually sends to the router & the gpy eavesdrops.
-
@kjm that would be surprising... How could it eavesdrop on a network it isn’t connected to and doesn’t have the keys for?
I would think it uses BLE rather than WiFi for that initial exchange (though I haven’t looked at the details at all so I may be entirely wrong). Not sure if WiFi Direct could be an option, I‘m not sure about support on both platforms?
But it may indeed need to have unconfigured WiFi to work.
-
@jcaron Exactly. I was thinking wifi direct till I read https://electronics.stackexchange.com/questions/61704/how-does-ti-cc3000-wifi-smart-config-work , most bizarre thing I've seen in a long time!
-
@kjm The timeout handler fires when the smartConfig timesout but the done handler doesn't fire when smartConfig works. I can't see what I'm doing wrong?
from network import WLAN def timeout(con): print(con, 'timed out') def done(con): print('done', end=' ') if con.isconnected(): print(con.ifconfig()) wlan = WLAN(mode=WLAN.STA, antenna=WLAN.INT_ANT) wlan.callback(trigger=WLAN.SMART_CONF_DONE, handler=done) wlan.callback(trigger=WLAN.SMART_CONF_TIMEOUT, handler=timeout) print('try smartConfig'); wlan.smartConfig()
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login