Last active
November 16, 2019 23:33
-
-
Save nicolsc/07dd353e986fefb65a3687533cedd143 to your computer and use it in GitHub Desktop.
Pycom+Sigfox test : send two values together
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from network import Sigfox | |
import socket | |
import struct | |
import binascii | |
#Sigfox config | |
sigfox = Sigfox(mode=Sigfox.SIGFOX, rcz=Sigfox.RCZ1) | |
s = socket.socket(socket.AF_SIGFOX, socket.SOCK_RAW) | |
print('I am device ', binascii.hexlify(sigfox.id()) ) | |
# make the socket blocking | |
s.setblocking(True) | |
# configure it as uplink only | |
s.setsockopt(socket.SOL_SIGFOX, socket.SO_RX, False) | |
##My data | |
temperature = 34.25 | |
humidity = 67 | |
output = bytearray(5) | |
struct.pack_into("<f",output,0,temperature) | |
struct.pack_into("<B",output,4,humidity) | |
print("output=",output) | |
print('Sending data to SigFox Cloud Service...') | |
s.send(output) |
What’s the raw payload as displayed on the Sigfox backend ?
On your device > messages menu you ll see incoming messages : time of
reception + payload + signal quality
Le ven. 15 nov. 2019 à 23:32, Joao Machete <[email protected]> a
écrit :
… How I can grab the Raw Payload on Sigfox?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<https://gist.github.com/07dd353e986fefb65a3687533cedd143?email_source=notifications&email_token=AAEAUU56SMYIAW6UKESSWVTQT4POVA5CNFSM4JNRMJ62YY3PNVWWK3TUL52HS4DFVNDWS43UINXW23LFNZ2KUY3PNVWWK3TUL5UWJTQAF4IQC#gistcomment-3084545>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAEAUU55PYI5YLH52ZJE66DQT4POVANCNFSM4JNRMJ6Q>
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Custom grammar used :
temperature::float:32:little-endian humidity::uint:8