How to get acknowledgement when sending message?
I have registered my SiPy in backedn.sigfox.com and tried to send some messages using REPL and this code:
from network import Sigfox
sigfox = Sigfox(mode=Sigfox.SIGFOX, rcz=Sigfox.RCZ1)
s = socket.socket(socket.AF_SIGFOX, socket.SOCK_RAW)
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.
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()), 3, 4, 5, 6, 7, 8, 9, 10, 0xAA, 0xFF])) retval = s.recv(32) print ("received " + retval)
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.
Used HW: FiPy on '1.17.5.b6'
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! :)
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!
@josua Ok! Quick question, I know it sounds a little bit silly but which connector do you have the antenna plugged into?
@josua Hmm ok possibly not what I thought! Do you know that you definitely have Sigfox Coverage where you are located?
@bucknall I am in Czech Republic and the model is Sipy 1.0 (14) which I think is 14dBm.
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?
@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!
@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.
@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!
@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.
@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.
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...
thank you for your response.
I tried to execute your snippet but the error occurs:
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? :)
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)