SigFox downlink issue with FiPy



  • I'm writing this code into my FiPy module :

    from network import Sigfox
    import socket
    ā€‹
    # 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 DOWNLINK specified by 'True'
    s.setsockopt(socket.SOL_SIGFOX, socket.SO_RX, True)
    
    # send some bytes and request DOWNLINK
    s.send(bytes([1, 2, 3]))
    
    # await DOWNLINK message
    s.recv(8)
    
    

    https://docs.pycom.io/firmwareapi/pycom/network/sigfox/

    When I run the program,
    I have this error :

    Traceback (most recent call last):
      File "<stdin>", line 18, in <module>
    OSError: [Errno 115] ENETDOWN
    

    I don't understand why my code doesn't work.

    On sigfox backend :
    The downlink status is good :

    Downlink status - Acked
    
        Status : [ACKED]
        Data (Hexa) : deadbeefcafebabe
    
    


  • @Erick-Falcon said in SigFox downlink issue with FiPy:

    there are some things datas that I don't know where I will get like Url pattern and Use HTTP Method, could you help me?

    Well, i am sorry but i dont understood how i can help you ?
    Basically sigfox call back is GET/POST method with generic json pattern

    For me it's a simple json GET defined by

    http://MYSERVERNAME/?device={device}&time={time}&data={data}&ack={ack}&seqNumber={seqNumber}

    And my server is a simple http/python server that listen for field filled by sigfox backend and sent to me.

    If myserver know they are some data to send to the device in answer to get it send a http code 200 with downlink data as explained here
    https://github.com/sigfox/sigfox-downlink

    So, finally your device message is available on sigfox backend ?



  • @Eric73 there are some things datas that I don't know where I will get like Url pattern and Use HTTP Method, could you help me?



  • @Erick-Falcon Have you set a download message payload on your sigfox backend ?

    You have to login on
    Then select "DeviceType" on top menu->Click on your device name in the device list-> on the left menu click on "callbacks", then check if "callbalck" bubble is filled and/or edit your callback to set some data for downlink otherwise no data will be sned to your device and i will get this error message.
    Please take care of your regional specification and to your network contract, in RCZ1 we have only 4 download message available by day so if you request more downlink than your contract provide the message will not be send to your device and you still have this error even if all is correct in your settings. I suppose that RCZ2 have nearly same limits.



  • @c42 @Eric73 hi, I have the same problem,I am using Fipy and Lopy4 with sigfox and i am trying to use the downlink but I get this error

    Traceback (most recent call last):
    File "<stdin>", line 25, in <module>
    OSError: [Errno 115] ENETDOWN
    

    this is my code:

    from network import Sigfox
    import socket
    import time
    #import ubinascii
    
    print('Nuevo mensaje')
    # init Sigfox for RCZ1 (Europe)
    sigfox = Sigfox(mode=Sigfox.SIGFOX, rcz=Sigfox.RCZ2)
    
    # 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)
    # configure it as DOWNLINK specified by 'True'
    s.setsockopt(socket.SOL_SIGFOX, socket.SO_RX, True)
    #send some bytes
    send some bytes    Paquete=[1,2,3,4,5,6,7,8,9,10,11,12]
    print()
    s.send(bytes(Paquete))
    
     print("Paquete enviado: "+ str(Paquete))
    
     print("Signal: "+ str(sigfox.rssi ()))  print("Esperando recibir paquete...")
    # await DOWNLINK message
    PR=s.recv(8)
    
    print("Paquete Recibid0: "+ str(PR))
    time.sleep(1)
    

    Do you know if I have to do something on the event cofiguration on the backend of Sigfox?



  • @Eric73
    Have you check the coverage maps for your workplace ?

    Yes the coverage is pretty good, I'm working near Bordeaux in France.

    I have this antenna :
    https://pycom.io/product/lora-868mhz-915mhz-sigfox-antenna-kit/



  • @c42 Hi, happy for you its work, but perhap you have to change your antenna for a better result inside building. Have you check the coverage maps for your workplace ?
    Yes sigfox device to device is another things, download is (G)FSK 600bits/s as explained in sigfox specification (you must agree terms for read it https://build.sigfox.com/sigfox-device-radio-specifications )



  • @Eric73
    Hi,

    Thanks its works !
    I received my payload deadbeefcafebabe.

    >>> 
    b'\xde\xad\xbe\xef\xca\xfe\xba\xbe'
    

    I have to be outsite of the building.

    When you mentioned "FSK", I was afraid that my module would not be compatible. Because on the docs it says that "Sigfox.FSK mode is not supported on LoPy 4 and FiPy."
    https://docs.pycom.io/firmwareapi/pycom/network/sigfox/

    But I think, Sigfox.FSK mode is just for device to device communication.

    Thanks you for the explanations !



  • This post is deleted!


  • This post is deleted!


  • Hello, all seem correct, you have send byte to sigfox backend, and it send you back the data you have requested. Unfortunatly you haven't received it ( it's the meaning of ENETDOWN error when you use sigfox).

    You can try to check your antenna, check sigfox coverage map, keep in mind that you have only 4 downlink allowed by day (after these limitations sigfox operator do what they wan't, in france base station do 'best effort' algo to send downlink packet), try to be outside of building rather than inside (at least the antenna).

    In RZ1 uplink is done by DBPSK at 100bit/s and have great chance to be received BUT downlink is done at 600bit/s in FSK (in another frequency band where sigfox can use more TX power).
    Due to system assymetry (even if sigfox guy have different speech) i have always feel that if you can be heard by sigfox backend that doesn't mean you can heard what sigfox sended you.
    (I have talked with several sigfox people and it seem they're mantra was, if we RX your device it will recive our TX due to power used in our TX)


Log in to reply
 

Pycom on Twitter