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

    How to extract Device Address from Payload ?

    Scheduled Pinned Locked Moved LoPy
    lopy4lorawanlopylopy nanogatewalorawan otaa
    6 Posts 2 Posters 771 Views 2 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.
    • H Offline
      Harish kumar
      last edited by

      Hi everyone !
      I need to know how to extract the device address from the payload ?
      data = s.recv(64)
      I use this one to receive data. Once the data is received, I have to extract the packet. Once extracting, I have to check with my list.
      Sorry for posting this again, I am just confused with this.
      Thank you in Advance.

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

        @harish-kumar As far as I understand the LoRa Spec, the Dev address is contained in the first four bytes of the payload. You may extract it from there and use it for comparison. Depending on how your reference list is formatted, you may have to convert it, eg. with ubinascii.bin2hex().

        H 1 Reply Last reply Reply Quote 0
        • H Offline
          Harish kumar @robert-hh
          last edited by

          @robert-hh you mean like once I get the data, I have to convert it and I have to compare ?
          Is ubinascii.bin2hex() for extracting from payload ?If not, what is the command for extracting ?

          robert-hhR 2 Replies Last reply Reply Quote 0
          • robert-hhR Offline
            robert-hh @Harish kumar
            last edited by

            @harish-kumar it should be hexlify(). I just try to verify my post.

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

              @harish-kumar Actually it is the second to fifth byte in big endian format. So if you receive data from the socket, e.g.:

              rx_data = lora_sock.recv(256)
              dev_addr = rx_data[1:5]
              print("Dev-Addr: ",  ubinascii.hexlify(dev_addr))
              
              H 1 Reply Last reply Reply Quote 1
              • H Offline
                Harish kumar @robert-hh
                last edited by Harish kumar

                @robert-hh Thank you so much ! I got the output.

                1 Reply Last reply Reply Quote 1

                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