Problem with Sigfox Payload
-
Hi All,
Using Pytrack with SiPy for sending GPS coordinates to Sigfox backend.
For example a payload sended by SiPy: b'\xd5\x17M\x00r\xb5\x08\x00' appear in the Sigfox backend as "d5174d0072b50800" !
When I try to decode this payload by "int1::4 int2::4" in the payload display, I never obtain the Latitude and Longitude expectedIs someone has the solution ? Thanks for help.
Jiemde -
-
Hi Alex,
Here is the code:def sendtosigfox():
datatosend = struct.pack('ii', int(coords[0]*100000), int(coords[1]*100000)) print('sigfox send: {}\n'.format(datatosend)) 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(datatosend) s.setblocking(False) s.close()Thanks
Jiemde -
@Jiemde
First question is - do you have good coordinates retrived by pytrack without sending it to sigfox?
I ask because if you used official library then current library do not calculate CRC and do not check for fix in messages.
And it use onlyGNGLLglonass message ignoring all other messages also GPS messages. -
-
@livius
Yes the coordinates are right !
When you take the 4 first bytes of the payload seeing in Sigfox for example " d5174d00" and you enter this part of payload in an "Lat=struct.unpack('i', b'\0xd5\0x17\0x4d\0x00') you will retreive the good Latitude.
I think that teh code is sending the good coordinates, but I don't find how to configure the payload display in "device type" in the Sigfox backend !Regards
jiemde -
@Jiemde
now it is much cliear where you have the problemi do not know sigfox much but this format is valid?
int1::4 int2::4i suppose you need
int1:uint::4 int2:uint::4 -
@bucknall
The Sigfox backend display "d5174d0072b50800"
The decoding payload "int1::4 int2::4", display 2 integer but not the good one!
image url) -
@Jiemde
sorry mistake
int1:uint::32 int2:uint::32 -
@livius
Yes of course! :)) -
@livius
Had already tested this but not the good result.jiemde
-
@Jiemde
what are results - maybe this hint something -
@livius
Here is the printscreen

-
sadly i do not have sipy to test self but
looking at your values i see that you have variation on most significant bits
try then this:
int1:uint::32:little-endian int2:uint::32:little-endianif this does not help then post output from corrds recived by pytrack + output packed
and what you got for this frames on sigfox -
@livius
No change in the displaying data.
As I don't have my SiPy/Pytrack with me at my office, I will reply this evening to your other question.best regards
jiemde -
@livius
You will find the output you ask:def sendtosigfox():
datatosend = struct.pack('ii', int(coords[0]*100000), int(coords[1]*100000)) print('sigfox send: {}\n'.format(datatosend)) size1=struct.calcsize('i') size2=struct.calcsize('ii') print('calcsize: ', size1, size2) 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(datatosend) s.setblocking(False) s.close()while True:
acc = LIS2HH12(py)
roll = acc.roll()
print('X= ', roll)
pitch = acc.pitch()
print('Y= ', pitch)
yaw = acc.yaw()
print('Z= ', yaw)
time.sleep(1)
gps = L76GNSS(py)
coords = gps.coordinates()
print(coords)
sendtosigfox()
time.sleep(600)The output in Atom/Pymakr:

The output in Sigfox backend

Regards
Jiemde -
@Jiemde
can you add before struct.packprint(coords) or print(str(coords)) #if above not work cast first to string -
is this really your position?
b'\xc8\x17M\x00k\xb5\x08\x00' (5052360, 570731)will be really helpfull to see
print(coords)as mentioned below
-
@livius
Yes it 's my position !
The coords are displayed just before the "sigfox send: " on the output in Atom/pymakr picture.(50.5236, 5.707314)
Jiemde
-
@Jiemde
Ahh i see :) I have missed it.and i see problem (previously i have thinked in opposite direction)
try do this (one of this should do the trick)
datatosend = struct.pack('>II', int(coords[0]*100000), int(coords[1]*100000))or not and on sigfox backend (i do not know why little not do the job and suppose that only above line will work for you)
int1:uint::32:big-endian int2:uint::32:big-endian
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