• 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 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()

  • @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 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.

  • @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

    Is there a way I can see a list of acceptable pycom dot methods?

    import pycom

  • @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()

  • @kjm You'll get ad-hoc WiFi back if you disable pybytes on boot. Call pycom.pybytes_on_boot(False)

  • @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.

  • 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

  • @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()

Log in to reply

Pycom on Twitter