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.ssid()

    Scheduled Pinned Locked Moved LoPy
    8 Posts 4 Posters 2.3k Views 4 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.
    • B Offline
      Blutkoete
      last edited by

      Hello,

      I'm not sure whether this is a bug or if I'm doing or interpreting something wrong (or if there is no way to implement this differently due to hardware/firmware limitations).

      The following code was part of my boot.py:

      import network
      wlan = network.WLAN()
      if not (wlan.ssid() == 'mywlanname' and wlan.isconnected()):
          ...
      

      I programmed it this way because machine.reset_cause() wasn't available right from the start, but it always disconnected my telnet session after a soft reset. I didn't give this much thought because I was waiting for the new firmware anyway as I was hit by the write-protection bug, but after modifiying my code to branch based on machine.reset_cause() I noticed that after a soft reset ssid() is reset to the default name starting with lopy-..., but the device is still connected to my WLAN and I can connect to it.

      This means that I have no possibility to identify the WLAN that I'm connected to after a soft reset as ssid() returns the default name even if my LoPys are connected to a different network.

      Is this a bug, working as intended or a limitation we have to accept?

      P.S.: The reason why I'm interested in getting the correct ssid() even after a soft reset is that I'd like to switch WLANs while the LoPy is running but reconnect to the maintenance WLAN after a soft reset, but only if not already connected to the maintenance WLAN to avoid cutting an active telnet connection. If that is not possible it is only a mild annoyance :).

      1 Reply Last reply Reply Quote 0
      • B Offline
        betabrain
        last edited by betabrain

        It seems as if wlan.ssid() returns the default lopy-wlan-xxxx not just after a reset. I am using version 0.9.4.b1.

        from network import WLAN
        
        w = WLAN()
        w.ssid() # lopy-wlan-xxxx
        w.connect('homewifi', auth=(3, 'secretsecret'), timeout=5000)
        w.ssid() # lopy-wlan-xxxx
        w = WLAN()
        w.ssid() # lopy-wlan-xxxx
        w.connect('homewifi', auth=(3, 'secretsecret'), timeout=5000)
        w.ssid() # lopy-wlan-xxxx
        w = WLAN()
        w.ssid() # lopy-wlan-xxxx
        

        Edit: LoPy does connect to homewifi, reliably, but ssid() fails to report that.

        1 Reply Last reply Reply Quote 0
        • D Offline
          daniel
          last edited by

          @betabrain thanks for the bug report. Could you open an issue here: https://github.com/pycom/pycom-micropython ?

          Cheers,
          Daniel

          1 Reply Last reply Reply Quote 0
          • B Offline
            betabrain
            last edited by

            @daniel Here you are: https://github.com/pycom/pycom-micropython/issues/12

            1 Reply Last reply Reply Quote 0
            • D Offline
              daniel
              last edited by

              Thanks @betabrain. The problem is fixed, and the solution is already on github.

              L B 2 Replies Last reply Reply Quote 1
              • L Offline
                littlebat @daniel
                last edited by

                @daniel how is it going to work for AP+STA?

                1 Reply Last reply Reply Quote 0
                • D Offline
                  daniel
                  last edited by

                  The API will change a bit when we enable AP+STA mode so that you can select the correct interface (the AP or the STA).

                  1 Reply Last reply Reply Quote 0
                  • B Offline
                    betabrain @daniel
                    last edited by

                    @daniel Great! You might have to revisit this issue though, see Github. It might have been fixed in the same commit. You know that better than I do.

                    I also opened a another issue: I would like access to the current BSSID: https://github.com/pycom/pycom-micropython/issues/13

                    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