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

    Struggling with message format for Sigfox transmission

    Scheduled Pinned Locked Moved SiPy
    1 Posts 1 Posters 160 Views 1 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
      jez
      last edited by

      Re: Data format for Sigfox transmission

      So i'm continuing to have issues with what must be a simple task. Below is my code... simply trying to send the variable data1 via Sigfox.

      A message is received but the data is always represented as "21030490058604" from the Sigfox back end which I assume is an error code of some form as its always the same irrelevant of the content of my variable.

      The content is encoded from 2315051001 to b'\xf9\xdf\xfc\x89'. But I'm unclear if this is how the data should be prepared for sigfox? As ever any help appreciated.

      from network import Sigfox
      import socket
      from time import sleep
      import _thread
      import array
      import ustruct
      
      
      # init Sigfox for RCZ1 (Europe)
      sigfox = Sigfox(mode=Sigfox.SIGFOX, rcz=Sigfox.RCZ1)
      
      # create a Sigfox socket
      s = socket.socket(socket.AF_SIGFOX, socket.SOCK_RAW)
      
      # make the socket blocking
      s.setblocking(True)
      
      # configure it as uplink only
      s.setsockopt(socket.SOL_SIGFOX, socket.SO_RX, False)
      
      # send some bytes
      data1 = 2315051001
      print (data1)
      data1 = ustruct.pack('i', data1)
      
      
      while True:
              try:
                      s.send(data1)
                      print (data1)
              except:
                      print ("fail")
                      pass
              sleep(900)```
      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