Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    wlan.Smartconfig()

    Scheduled Pinned Locked Moved GPy
    11 Posts 4 Posters 111 Views 5 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K Offline
      kjm
      last edited by kjm

      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)?

      K 1 Reply Last reply Reply Quote 0
      • K Offline
        kjm @kjm
        last edited by

        @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()
        
        K 1 Reply Last reply Reply Quote 0
        • G Offline
          Gijs
          last edited by

          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

          K 1 Reply Last reply Reply Quote 0
          • K Offline
            kjm @Gijs
            last edited by

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

            robert-hhR 1 Reply Last reply Reply Quote 0
            • robert-hhR Offline
              robert-hh @kjm
              last edited by

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

              K 2 Replies Last reply Reply Quote 0
              • K Offline
                kjm @robert-hh
                last edited by

                @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-hhR 1 Reply Last reply Reply Quote 0
                • robert-hhR Offline
                  robert-hh @kjm
                  last edited by robert-hh

                  @kjm

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

                  import pycom
                  dir(pycom)

                  1 Reply Last reply Reply Quote 0
                  • K Offline
                    kjm @robert-hh
                    last edited by

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

                    J 1 Reply Last reply Reply Quote 0
                    • J Offline
                      jcaron @kjm
                      last edited by

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

                      K 1 Reply Last reply Reply Quote 0
                      • K Offline
                        kjm @jcaron
                        last edited by

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

                        1 Reply Last reply Reply Quote 1
                        • K Offline
                          kjm @kjm
                          last edited by

                          @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()
                          
                          1 Reply Last reply Reply Quote 0

                          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
                          • 1 / 1
                          • First post
                            Last post

                          Pycom on Twitter

                          Pycom