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 get acknowledgement when sending message?

    Scheduled Pinned Locked Moved SiPy
    sipysocketsigfoxnetwork
    17 Posts 3 Posters 5.4k 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.
    • J Offline
      josua
      last edited by

      Hi,

      I have registered my SiPy in backedn.sigfox.com and tried to send some messages using REPL and this code:

      from network import Sigfox
      import socket
      sigfox = Sigfox(mode=Sigfox.SIGFOX, rcz=Sigfox.RCZ1)
      s = socket.socket(socket.AF_SIGFOX, socket.SOCK_RAW)
      s.setblocking(True)
      s.setsockopt(socket.SOL_SIGFOX, socket.SO_RX, False)
      s.send(bytes([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]))

      REPL response was 12 and I see no messages in my backend. So how can I ensure that message is successfully sended? Something like ACK.

      Thanks in advance.

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

        Hi @josua,

        Sigfox does not send an ACK message by default as messages are primarily uplink only.

        You can, however, request a downlink message which can be used as a method to check if your message was received.

        To enable a downlink message to be sent to your device you could use the following snippet of code:

        from network import Sigfox
        import socket
        
        sigfox = Sigfox(mode=Sigfox.SIGFOX, rcz=Sigfox.RCZ1)
        
        s = socket.socket(socket.AF_SIGFOX, socket.SOCK_RAW)
        
        s.setblocking(True)
        
        # the True argument is what sets the SiPy to expect a downlink message
        s.setsockopt(socket.SOL_SIGFOX, socket.SO_RX, True)
        
        s.send("hello")
        
        s.recv(32)
        

        Developer Evangelist - Pycom

        1 Reply Last reply Reply Quote 1
        • J Offline
          josua
          last edited by

          Hi @bucknall,

          thank you for your response.
          I tried to execute your snippet but the error occurs:

          s.send("hello")
          Traceback (most recent call last):
          File "<stdin>", line 1, in <module>
          OSError: [Errno 100] ENETDOWN

          What do You think it could be?
          P.S. I don't see something like "code block button" in the message editor, how you do it? :)

          J B 2 Replies Last reply Reply Quote 0
          • J Offline
            josua @josua
            last edited by

            ok it means: pc/network software – operational errors Network is down.

            but what can be the reason? Bad covering of the sigfox network? Or something else...

            1 Reply Last reply Reply Quote 0
            • B Offline
              bucknall @josua
              last edited by

              @josua No worries! If you press "spacebar" 4 times from the margin, you'll start a code block :)

              Hmm I've just tried it with two of my devices... one of them works, the other is generating the same error that you are seeing.

              I will follow this up and work out the cause.

              Thanks!

              Developer Evangelist - Pycom

              J 1 Reply Last reply Reply Quote 1
              • J Offline
                josua @bucknall
                last edited by josua

                @bucknall Looking forward to your response.
                By the way, where I could find the sources of the API? Tried to find sources for sigfox and socket classes, but unsuccessfuly.

                Thanks!

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

                  @josua What do you mean by sources? This is the link to the Sigfox Class if that helps? https://docs.pycom.io/pycom_esp32/library/network.Sigfox.html?highlight=sigfox

                  Also, I tried it with two of my SiPys... oddly one of them worked and the other failed so I'm trying to pinpoint what is going on!

                  Should have an answer for you this afternoon!

                  Developer Evangelist - Pycom

                  J 1 Reply Last reply Reply Quote 0
                  • J Offline
                    josua @bucknall
                    last edited by

                    @bucknall By sources I mean source code. For example source code of the socket or sigfox classes. Maybe I don't have the clear understanding of how it all works. But I think there are somewhere definition of those classes with their methods? Am I right?

                    Looking forward to hear the results of your investigation.
                    Thank you!

                    B 1 Reply Last reply Reply Quote 0
                    • B Offline
                      bucknall @josua
                      last edited by

                      @josua we're currently working to push all of our source code up to GitHub and this includes the Sigfox classes. This should be coming in the next couple of weeks. Daniel will make an announcement when this takes places!

                      I'm just testing it now!

                      Developer Evangelist - Pycom

                      1 Reply Last reply Reply Quote 1
                      • B Offline
                        bucknall
                        last edited by

                        Hi @josua I think I know what your problem might be! What country are you trying to use your device in and also which version of the SiPy do you have? The 14dBm or the 22dBm?

                        Developer Evangelist - Pycom

                        J 1 Reply Last reply Reply Quote 0
                        • J Offline
                          josua @bucknall
                          last edited by

                          @bucknall I am in Czech Republic and the model is Sipy 1.0 (14) which I think is 14dBm.

                          B 1 Reply Last reply Reply Quote 0
                          • B Offline
                            bucknall @josua
                            last edited by

                            @josua Hmm ok possibly not what I thought! Do you know that you definitely have Sigfox Coverage where you are located?

                            Developer Evangelist - Pycom

                            J 1 Reply Last reply Reply Quote 0
                            • J Offline
                              josua @bucknall
                              last edited by

                              @bucknall According to the sigfox coverage map there are 3 base stations and more.

                              B 1 Reply Last reply Reply Quote 0
                              • B Offline
                                bucknall @josua
                                last edited by

                                @josua Ok! Quick question, I know it sounds a little bit silly but which connector do you have the antenna plugged into?

                                Developer Evangelist - Pycom

                                J 1 Reply Last reply Reply Quote 0
                                • J Offline
                                  josua @bucknall
                                  last edited by

                                  @bucknall
                                  Yes, it works now.
                                  I just tried to use it (to send msg) out of the building and it works.. Fill my self silly as I didn't try to do it earlier..
                                  I really appreciate your help. Your team is great! Thank you!

                                  B 1 Reply Last reply Reply Quote 1
                                  • B Offline
                                    bucknall @josua
                                    last edited by

                                    No problem @josua! I'm glad you got it up and running! :) I had an interesting discovery about using the 22 dBm SiPy in RCZ1 along the way so we all learnt something today!

                                    Best of luck with your project! :)

                                    Developer Evangelist - Pycom

                                    1 Reply Last reply Reply Quote 1
                                    • D Offline
                                      dmnk
                                      last edited by

                                      similar problem.

                                      this:

                                      
                                      sigfox = Sigfox(mode=Sigfox.SIGFOX, rcz=Sigfox.RCZ1)
                                      s = socket.socket(socket.AF_SIGFOX, socket.SOCK_RAW)
                                      s.setblocking(True)
                                      s.setsockopt(socket.SOL_SIGFOX, socket.SO_RX, True)
                                      s.send(bytes([0x00, scale(lux.light()[0]), 3, 4, 5, 6, 7, 8, 9, 10, 0xAA, 0xFF]))
                                      retval = s.recv(32)
                                      print ("received " + retval)
                                      

                                      gives me:

                                      Traceback (most recent call last):
                                        File "<stdin>", line 164, in <module>
                                      OSError: [Errno 100] ENETDOWN
                                      

                                      whilst the backend shows me:

                                          Status : [ACKED]
                                          Data (Hexa) : cafecafecafecafe
                                      

                                      any idea what i'm missing here?
                                      It's definitively not the link - sender and receiver have free LOS.

                                      avgSnr=20.74
                                      rssi=-52.00

                                      Used HW: FiPy on '1.17.5.b6'

                                      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