Sigfox RC4 Freezing after 1 msg
-
Hi Forum !
I encounter a problem when I try to send multiple Sigfox messages from my FiPy card on Sigfox network. After the first msg sent (and received) I must disconnect the kit to get it working again.
The code is :
from network import Sigfox import socket import binascii # init Sigfox for RCZ4 sigfox = Sigfox(mode=Sigfox.SIGFOX, rcz=Sigfox.RCZ4) # create a Sigfox socket s = socket.socket(socket.AF_SIGFOX, socket.SOCK_RAW) # make the socket blocking s.setblocking(True) s.settimeout(5.0) # configure it as uplink only s.setsockopt(socket.SOL_SIGFOX, socket.SO_RX, False) #Print sigfox ID print(binascii.hexlify(sigfox.id())) for i in range(1,20): # send some bytes s.send(bytes([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])) print("Message {} sent".format(i))When I change Sigfox.RCZ4 to Sigfox.RCZ1 it works perfectly...
-
Thanks for reporting this @gsimenel, I'll look into it today.
-
@jmarcelino Thanks a lot. Let me know if I can do anything to assist.
-
Hi @gsimenel
I found the problem in our code, it's related to how the socket layer reacts to the enforced wait time for Sigfox resets (necessary for RCZ2 and RCZ4).
As the docs page explains for compliance reasons we must wait 20 seconds between consecutive sends. This wait should be handled automatically but that is causing some problems.
For now the easiest solution is to add more time between your sends in your code - at least 20 seconds - for example simply adding a time.sleep(20) like this:
from network import Sigfox import socket import binascii import time # init Sigfox for RCZ4 sigfox = Sigfox(mode=Sigfox.SIGFOX, rcz=Sigfox.RCZ4) # create a Sigfox socket s = socket.socket(socket.AF_SIGFOX, socket.SOCK_RAW) # make the socket blocking s.setblocking(True) s.settimeout(30) # configure it as uplink only s.setsockopt(socket.SOL_SIGFOX, socket.SO_RX, False) #Print sigfox ID print(binascii.hexlify(sigfox.id())) for i in range(1,20): # send some bytes s.send(bytes([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])) print("Message {} sent".format(i)) time.sleep(20)Please remember that Sigfox has a 140 message/day limit so spacing out your sends is always a good policy.
-
@jmarcelino said in Sigfox RC4 Freezing after 1 msg:
time.sleep(20)
Works like a charm. Thanks a lot.
The documentation is a bit misguiding here, it says :
"there must a minimum of a 20s delay after resetting to the default macro-channel. Our API takes care of this
for i in range(1, 100): # send something s.send('Hello ' + str(i))There will be a 20 second delay after every 2 packets"
In fact, there should be a delay added between 2 packets. Maybe a suggestion for modification of the doc.
Anyway, thanks a lot for correcting me !
All the best.
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