Skip to content
Mikuláš Sychra edited this page Apr 25, 2018 · 15 revisions

# THiNX SigFox Integration

Shared Callback Setting

For both downlink and uplink callbacks, there's shared part of configuration:

  1. On the https://backend.sigfox.com open Device Type, select your device name and then Callbacks in right column.

  2. Create new callback (the button is hidden in top right corner) with following options:

  • Type: DATA and UPLINK for basic Registration, BIDIR for Downlink request
  • Channel: URL
  • Url pattern: https://thinx.cloud:7443/device/register
  • HTTP Method: POST

Headers:

  • Authentication: <enter API Key generated in thinx.cloud settings>

Content-type:

  • application/json

Set this callback on developer.sigfox.com.

Uplink

  • Change owner to your Owner ID, you'll find this in User Profile page.
{
	"registration": {
		"mac": "SIGFOX{device}",
		"status": "{data}",
		"firmware": "Sigfox",
		"version": "1.0.0",
		"alias": "{device}",
		"owner": "<enter-your-owner-id>",
		"platform": "sigfox",
		"snr": "{snr}",
		"rssi": "{rssi}",
		"station": "{station}",
		"lat": "{lat}",
		"lon": "{lng}"
	}
}

Now, it's right time to send an uplink request from your SigFox device by sending some data, e.g. AT$SF=cafebabecafebabe. As soon as the request completes, your device will appear on THiNX Dashboard.

Downlink

To configure a downlink, select a SigFox device on your Dashboard and Edit it (pencil icon).

  • Change owner to your Owner ID, you'll find this in User Profile page.

  • Go to backend.sigfox.com and create a new BIDIR callback (use shared configuration from above). Additionally, give SigFox directions on how to unwrap the payload. If unsure, enter just str::char:7 into the Custom payload config field to handle payload as 8-byte string of characters. Otherwise you'll end up with INVALID_PAYLOAD response from SigFox even though the outgoing THiNX response would be valid.

Downlink callback is identified by the ack: true key. Responses are currently based on the status variable, because it can be easily set and edited using Status Transformer. In case you have better idea like holding separate binary status or downlink specific variable, please file a ticket.

Point the downlink HTTP POST callback from backend.sigox.com with following payload:

{
  "registration": {
    "mac": "SIGFOX{device}",
    "firmware": "Sigfox",
    "version": "1.0.0",
    "alias": "{device}",
    "owner": "<enter-your-owner-id>",
    "platform": "sigfox",
    "snr": "{snr}",
    "rssi": "{rssi}",
    "station": "{station}",
    "lat": "{lat}",
    "lon": "{lng}",
    "ack": "{ack}"
  }
}

To send some data to your SigFox when requested, store it in your device.status variable by adding Status Transformer in the SigFox Device Detail on THiNX Dashboard, e.g.

//
// Sample SigFox Downlink Transformer
//

var transformer = function(status, device) {
    // incoming status is ignored here for sake of simplicity
    return "AABBCCDDEEFF0011";
};

You may send the dowlink request from your SigFox device now, e.g. AT$SF=cafebabecafebabe,1. As soon as the request completes, your SigFox device should receive RX=AA BB CC DD EE FF 00 11

Clone this wiki locally