# Device Integrations

# DigitalMatter

To use the DigitalMatter devices you can use the special compatible API endpoints for these devices. This special endpoint converts the DigitalMatter data to Blackpoint compatible data.

# The Things Network

The following DigitalMatter devices can be connected with the HTTP integration on The Things Network with a POST method. Toghether with the authorisation header where you put your HTTP enabled secret API key that you generated on the Blackpoint portal you can push data from the The Things Network to the Blackpoint platform API.

# Guppy

https://api.blackpoint.io/api/v1.1/digitalmatter/prod/json/ttn/guppy
1

# Yabby

https://api.blackpoint.io/api/v1.1/digitalmatter/prod/json/ttn/yabby
1

# Oyster

https://api.blackpoint.io/api/v1.1/digitalmatter/prod/json/ttn/oyster
1

# Data decoder

On the Payload Format tab you have to add the script below to let TTN decode the messages before posting it to the Blackpoint API:

 
function Decoder(bytes, port)
{
var decoded = {}; if (port === 1) {
decoded.type = "status";
decoded.inTrip = ((bytes[0] & 0x1) !== 0) ? true : false; decoded.batV = 2.0 + 0.014 * (bytes[0] >> 1); decoded.temp = -40.0 + 0.5 * bytes[1];
if (bytes.length >= 4)
{
decoded.manDown = ((bytes[2] & 0x1) !== 0) ? true : false; decoded.inclinationDeg = (bytes[2] >> 1) * 1.5; decoded.azimuthDeg = bytes[3] * 1.5;
      // Extra derived angles
      decoded.xyz = {};
{
// The direction of 'down' in rectangular coordinates, // unit vector.
d = decoded.xyz.downUnit =
[
Math.sin(decoded.inclinationDeg * Math.PI / 180) *
 
Math.sin(decoded.azimuthDeg * Math.PI / 180), Math.cos(decoded.inclinationDeg * Math.PI / 180), Math.sin(decoded.inclinationDeg * Math.PI / 180) *
Math.cos(decoded.azimuthDeg * Math.PI / 180), ];
// The azimuthal angles about each axis, right-handed, in degrees.
// You can set up triggers on these angles. These trigger angles
// are not well defined if the inclination is within 7 degrees of
// vertical, and will not trigger within that range.
hypX = Math.sqrt(d[1]*d[1] + d[2]*d[2]); hypY = Math.sqrt(d[2]*d[2] + d[0]*d[0]); hypZ = Math.sqrt(d[0]*d[0] + d[1]*d[1]); decoded.xyz.azimuthDeg =
[
(hypX < 0.125) ? null : (Math.atan2(d[2], d[1]) * 180 / Math.PI), (hypY < 0.125) ? null : decoded.azimuthDeg,
(hypZ < 0.125) ? null : (Math.atan2(d[1], d[0]) * 180 / Math.PI),
];
if (decoded.xyz.azimuthDeg[0] < 0)
decoded.xyz.azimuthDeg[0] += 360; if (decoded.xyz.azimuthDeg[2] < 0)
decoded.xyz.azimuthDeg[2] += 360;
// The angle between each axis and 'down', in degrees.
// You can set up triggers on these angles. // They are always well defined.
iX = 1 - ((d[0]-1)*(d[0]-1) + d[1]*d[1] + d[2]*d[2]) / 2; iZ = 1 - (d[0]*d[0] + d[1]*d[1] + (d[2]-1)*(d[2]-1)) / 2; iX = Math.max(iX, -1);
iX = Math.min(iX, +1);
iZ = Math.max(iZ, -1);
iZ = Math.min(iZ, +1);
decoded.xyz.inclinationDeg =
[
  Math.acos(iX) * 180 / Math.PI,
      decoded.inclinationDeg,
      Math.acos(iZ) * 180 / Math.PI,
    ];
} }
else
{
  decoded.manDown = null;
  decoded.inclinationDeg = null;
  decoded.azimuthDeg = null;
  decoded.xyz = null;
}
}
else if (port === 2) {
decoded.type = "downlink ack";
decoded.sequence = (bytes[0] & 0x7F);
decoded.accepted = ((bytes[0] & 0x80) !== 0) ? true : false; decoded.fwMaj = bytes[1];
decoded.fwMin = bytes[2];
}
else if (port === 3) {
decoded.type = "stats";
decoded.initialBatV = 2.0 + 0.014 * (bytes[0] & 0x7F); decoded.uptimeWeeks = (bytes[0] >> 7) + bytes[1] * 2; decoded.txCount = 32 * (bytes[2] + bytes[3] * 256); decoded.tripCount = 32 * (bytes[4] + bytes[5] * 256); decoded.wakeupsPerTrip = bytes[6];
}
else if (port === 4) {
decoded.type = "rtc request";
decoded.wasSet = ((bytes[0] & 0x01) !== 0) ? true : false; decoded.cookie = (bytes[0] + bytes[1] * 256 + bytes[2] * 65536 +
                      bytes[3] * 16777216) >>> 1;
    // seconds since 2013-01-01
decoded.timestamp = bytes[4] + bytes[5] * 256 + bytes[6] * 65536 + bytes[7] * 16777216;
// Date() takes milliseconds since 1970-01-01
decoded.time = (new Date((decoded.timestamp + 1356998400) * 1000)) .toUTCString();
}
return decoded; }

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73

# Sigfox Network

The following DigitalMatter devices can be connected with the HTTP callback integration on the Sigfox backend with a POST method. Toghether with the authorisation header where you put your HTTP enabled secret API key that you generated on the Blackpoint portal you can push data from the Sigfox backend to the Blackpoint platform API. Make sure the content-type = application/x-www-form-urlencoded on this API call.

# Oyster

https://api.blackpoint.io/api/v1.1/digitalmatter/prod/json/sigfox/oyster?device={device}&time={time}&snr={snr}&duplicate={duplicate}&station={station}&data={data}&avgSnr={avgSnr}&lat={lat}&lng={lng}&rssi={rssi}&seqNumber={seqNumber}
1