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

    Error while connecting pybytes with LTE

    Scheduled Pinned Locked Moved Pybytes IoT platform
    14 Posts 3 Posters 363 Views 3 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.
    • G Offline
      Gijs
      last edited by

      The EAI_FAIL error is caused by the DNS not resolving (Error Address Info).. Maybe we had a second of downtime on the Pybytes servers.. Are you able to try it again?

      1 Reply Last reply Reply Quote 0
      • O Offline
        Osquillar
        last edited by

        Hi,
        In pybytes_config.json file, with "network_preferences": ["lte","wifi"] and "lte": {"apn": "pycom.io", "cid": 1, "reset": false, "carrier": "standard", "band": 20, "type": "IP"}
        I have the following message at any time I try.

        LTE is_connected()
        LTE connection established
        connect_lte with start_mqtt is now removed please call communication_protocol or start_mqtt directly
        MQTT Protocol
        Socket create error: [Errno 202] EAI_FAIL
        This is PybytesProtocol.start_MQTT
        Socket send error [Errno 128] ENOTCONN
        Socket create error: [Errno 202] EAI_FAIL

        If I swap the network preferences order to "wifi","lte", I'm able to send the signal to pytbytes without any problem.

        1 Reply Last reply Reply Quote 0
        • G Offline
          Gijs
          last edited by

          Are you able to make a manual connection by using:

          from network import LTE
          lte = LTE()
          lte.attach(band=20, apn="pycom.io")
          ...
          

          And then create a socket connection to mqtt.pybytes.pycom.io
          Let me know!
          Gijs

          O 2 Replies Last reply Reply Quote 0
          • O Offline
            Osquillar @Gijs
            last edited by

            @Gijs said in Error while connecting pybytes with LTE:

            mqtt.pybytes.pycom.io

            Hello Gijs,
            I've tried to connect with mqtt.pybytes.pycom.io in port 1883 and there is no problem if I use a wifi connection but I obtain the same OSError: [Errno 202] EAI_FAIL when I execute the same code with the LTE attached.
            It seems as if the NB-IOT network is not allowing to connect to the internet.
            Any other idea?.

            O 1 Reply Last reply Reply Quote 0
            • O Offline
              Osquillar @Osquillar
              last edited by

              @Osquillar
              Below the modem answer to AT+CGCONTRDP:
              +CGCONTRDP: 1,5,"pycom.io.MNC028.MCC901.GPRS","10.200.1.108.255.255.255.255","","","","",""

              1 Reply Last reply Reply Quote 0
              • O Offline
                Osquillar @Gijs
                last edited by

                @Gijs Hello, the problem I've found is related to DNS, do you know how to handle it?.
                If I use socket.getaddrinfo("google.com", 80)[0][-1]), I obtain the same OSError: [Errno 202] EAI_FAIL

                The same sofware tested with the wifi connection is working fine, so the problem is in the modem side and in the DNS.
                Any idea?

                1 Reply Last reply Reply Quote 0
                • G Offline
                  Gijs
                  last edited by

                  Hi,
                  Sorry for the slow reply. I have never actually used a Pycom simcard myself, so details might vary.

                  The Pycom simcards are purposed to only connect using pycom services (pybytes mqtt), so the DNS request with google could indeed show as an EAI_FAIL error.

                  I checked last week with our services and the DNS to pybytes should work as expected. Next to that we have not received any other complaintes on this part. I still believe it is weird the Pybytes mqtt connection is not resolving correctly. Maybe @Xykon can help us out here?

                  Gijs

                  1 Reply Last reply Reply Quote 0
                  • G Offline
                    Gijs
                    last edited by

                    Hi,
                    Can you check for me the modem firmware using the following:

                    import sqnsupgrade; sqnsupgrade.info()
                    

                    The modem firmware should start with LR6.xx for NB-IoT

                    Gijs

                    O 1 Reply Last reply Reply Quote 0
                    • O Offline
                      Osquillar @Gijs
                      last edited by

                      @Gijs Hi, the modem firmware is LR6.0.0.0-41019 so I think it is correct.
                      I still belive the problem is within vodafone side because the AT command to CGCONTRDP is not returning any DNS address. What do you think?

                      +CGCONTRDP: 1,5,"pycom.io.MNC028.MCC901.GPRS","10.200.1.108.255.255.255.255","","","","",""

                      1 Reply Last reply Reply Quote 0
                      • G Offline
                        Gijs
                        last edited by

                        It indeed seems to be related to the DNS server not being set correctly by the Vodafone service. You can manually set the DNS server by using:

                        import socket;
                        socket.dnsserver() #this should return empty
                        socket.dnsserver('primary','secondary')
                        

                        My colleague @Xykon can tell you more about the DNS server IP address. It has to be specific to the pycom servers (so setting 8.8.8.8 as the dns server should not work)

                        Best,
                        Gijs

                        1 Reply Last reply Reply Quote 0
                        • F Offline
                          Flavio Frattini
                          last edited by

                          Hi, I'm facing the same issue as @Osquillar. I use NB-IoT on my Fipy. The device sends messages correctly when I power it on, then all of a sudden it starts to have these problems: 202 eai_fail and 128 enotconn. After the first time it encounters this problem, it never recovers. This problem is triggered when calling the function pybytes.start or pybytes.connect.
                          So the problem is on the DNS server? Can we use 8.8.8.8 or do we need to use another one?
                          Thank you @Gijs for your constant help.

                          1 Reply Last reply Reply Quote 0
                          • G Offline
                            Gijs
                            last edited by Gijs

                            I think your issue is different.
                            If you're able to send signals to pybytes a first, but get an eai_fail error later, it might be related to your network connection. It should not reset the DNS servers, as is the issue above (the LTE network does not provide a DNS server from the start there). Just to be sure, could you let me know what socket.dnsserver() gives you (before it fails and after it fails), and what lte.send_at_cmd('AT+CGCONTRDP?') returns ?

                            F 1 Reply Last reply Reply Quote 0
                            • F Offline
                              Flavio Frattini @Gijs
                              last edited by

                              @Gijs Hi. The output of dnsserver after pybytes.start is ('172.31.16.100', '172.31.32.100'), while the output of AT+CGCONTRDP? is always ERROR. I tried to move the AT command in different parts of the code but the result was always ERROR. When the device fails I cannot retrieve any information, so I don't know what the dnsserver output is. I'm using your Vodafone SIM in Italy. Thank you

                              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