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

    PyBytes API Documentation

    Scheduled Pinned Locked Moved Pybytes IoT platform
    10 Posts 4 Posters 185 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.
    • V Offline
      VST Admin
      last edited by

      Is it just me or is the documentation for the PyBytes API HORRIBLY inadequate? We are trying to build a commercial product with GPy and I am almost regretting my decision.

      Sometimes in your program, when the Pybytes connection is disconnected and you apply a pyBytes method to attempt to reconnect, you get NameErrror: name 'pybytes' isn't defined. WTF does this even mean? Pybytes was there just a second ago!

      this method is pulled DIRECTLY from the documentation:

      pybytes.connect_LTE(reconnect=True, check_interval=0.5)

      When run it gives us : "TypeError: unexppected keyword argument 'reconnect'

      REALLY?

      That leads me to the documentation of course....

      Send information message
      
      Send information message.
      Method
      
      pybytes.send_info_message()
      Example
      
      pybytes.send_info_message()
      
      Send ping message
      
      Send ping message.
      Method
      
      pybytes.send_ping_message()
      Example
      
      pybytes.send_ping_message()
      

      again, REALLY? Would it hurt you to tell us how to program the function and supply an example or two? I had FAR BETTER documentation with my TRS-80 Model 1 computer in 1977!

      I am trying to count on this device for a commercial project that could easily be 1,000 units, but its getting harder to justify every day.

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

        Hi,

        Im sorry you feel this way.
        Is there any way I can reproduce the issue you are describing? Perhaps can you give me an (actual) example I can try?
        The Pybytes library is positioned in the frozen-code section and is loaded at boot. The only reason I can think of, is that it would disappear is if the boot process was interrupted, or if all loaded items are cleared.

        As for the mistake in the documentation, it seems someone copied the connect_wifi(...) over to lte, without changing the parameters. I have the correct one for you here:

        connect_lte(activation_info=False, start_mqtt=True)
        

        Please let me know of other mistakes in the documentation so I can fix them!

        About the examples, thanks for the feedback. I thought we had some examples out there, but apparently we have none. I'll work on that!
        Best,
        Gijs

        V 1 Reply Last reply Reply Quote 1
        • V Offline
          VST Admin @Gijs
          last edited by

          @Gijs It sounds like you should do an audit of all your documentation. This stuff is hard enough even in the best of circumstances but when bad documentation leads you in to blind alleys for hours, it is mind-numbingly frustrating.

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

            Ive been working on that for the past ~2 months next to all other support, and haven't even gotten to the Pybytes section yet.. I know there are things missing and out of date and I understand your frustration.

            Now if you could let me know how to reproduce the issue of the pybytes library disappearing, I'm very much interested in solving that issue for you

            V D 2 Replies Last reply Reply Quote 0
            • V Offline
              VST Admin @Gijs
              last edited by

              @Gijs
              We really haven't figured out how or why yet. Its seems that if the initial connection fails from the pybytes_config.json file then any subsequent pybytes methonds in the program or after you break and try commands from the REPL results in the above "NameErrror: name 'pybytes' isn't defined" message.

              Generally, if you reboot and are lucky to get a connection then the pybytes methods work as expected.

              Fortunately, since publishing this, we have stumbled into a pybytes_config.json file that does seem to connect up within 16 seconds every time, so its not a critical issue for us, but for a week or so it was quite frustrating.

              Thanks,

              Todd

              1 Reply Last reply Reply Quote 1
              • N Offline
                nestorld
                last edited by

                I would like to add a constructive criticism. I really like the Pycom's products, but several times I have also felt like something is missing in the documentation. Sometimes it is the way it's organized, not so easy to browse it, other times some details are missing to quickly understand how things are working/designed or how should be configured, and sometimes it's not updated. In some way, I agree with this comment: "It sounds like you should do an audit of all your documentation". I know that I'm not the only one, I have read other people saying this kind of things.
                Pycom products are great, but you have to make your documentation easier to read, add all necessary details, do not assume that your users know all the internal details that you know. You have to create documentation as great as your products.

                Néstor López

                1 Reply Last reply Reply Quote 1
                • D Offline
                  dnear1 @Gijs
                  last edited by

                  @Gijs I've been having this same issue for a long time.

                  For me, the issue is fairly easily reproducible. Initialize the device in one location that has WIFI and let it get online. Load some code to it. Turn off the WIFI device itself (Or move somewhere outside of the range of it), and using REPL, send Ctrl-C to break out of the running code and try to connect to some other WIFI using commands so you can get it back online.

                  from network import WLAN
                  import machine
                  wlan = WLAN(mode=WLAN.STA)
                  wlan.connect(ssid='newWIFI', auth=(WLAN.WPA2, 'newwpapassword'))
                  print( wlan.isconnected())
                  pybytes.reconnect()
                  

                  It usually fails on the last line, pybytes.reconnect() despite all the rest succeeding.
                  Sometimes I have to reboot and try again a dozen times before it fails in the right way to fix it.

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

                    Could you elaborate on what 'fails' means exactly?
                    All the pybytes.reconnect() does, is issue a disconnect() command, followed by a connect() command

                    From the source:

                    def reconnect(self):
                            self.__check_init()
                            try:
                                self.disconnect()
                                time.sleep(1)
                                self.connect()
                            except Exception as ex:
                                print('Error trying to reconnect... {}'.format(ex))
                    

                    Gijs

                    D 1 Reply Last reply Reply Quote 0
                    • D Offline
                      dnear1 @Gijs
                      last edited by

                      @Gijs Fails means the pybytes.reconnect() returns this error NameErrror: name 'pybytes' isn't defined.

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

                        Right, that means the pybytes library is not loaded on boot (do you perhaps have pycom.pybytes_on_boot() set to False? )

                        You can load the Pybytes library yourself by using:

                        from _pybytes import Pybytes
                        from _pybytes_config import PybytesConfig
                        conf = PybytesConfig().read_config()
                        pybytes = Pybytes(conf)
                        pybytes.start()
                        

                        Gijs

                        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