Skip to content

Commit

Permalink
Add 4 Decentlab devices (#683)
Browse files Browse the repository at this point in the history
* Fix links of decentlab devices and facebook

* Add decentlab dl-cws

* Add decentlab dl-blg

* Add decentlab dl-tp

* Add decentlab dl-isf
  • Loading branch information
decentlab authored Oct 18, 2023
1 parent 1bb625d commit 341ea4c
Show file tree
Hide file tree
Showing 21 changed files with 1,311 additions and 3 deletions.
1 change: 1 addition & 0 deletions schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -972,6 +972,7 @@
"radar",
"rainfall",
"rssi",
"sap flow",
"smart valve",
"snr",
"so2",
Expand Down
76 changes: 76 additions & 0 deletions vendor/decentlab/dl-blg-codec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
uplinkDecoder:
fileName: dl-blg.js
examples:
- description: Example 1
input:
fPort: 1
bytes: [0x02, 0x30, 0xc5, 0x00, 0x03, 0xa4, 0x0c, 0x00, 0x81, 0x0c, 0x60]
output:
data:
battery_voltage:
displayName: Battery voltage
unit: V
value: 3.168
device_id: 12485
protocol_version: 2
temperature:
displayName: Temperature
unit: "\xB0C"
value: 22.028848392450755
thermistor_resistance:
displayName: Thermistor resistance
unit: "\u03A9"
value: 115020.68221552655
voltage_ratio:
displayName: Voltage ratio
value: 0.006409406661987305
- description: Example 2
input:
fPort: 1
bytes: [0x02, 0x30, 0xc5, 0x00, 0x02, 0x0c, 0x60]
output:
data:
battery_voltage:
displayName: Battery voltage
unit: V
value: 3.168
device_id: 12485
protocol_version: 2

downlinkEncoder:
fileName: dl-downlink-codec.js
examples:
- description: Set period 3600 seconds and save
input:
data:
command: set period + save
parameter: 3600
output:
bytes: [0, 2, 14, 16, 72, 164]
fPort: 1
- description: Set ADR off
input:
data:
command: set adr off
output:
bytes: [0, 7, 0, 0, 229, 177]
fPort: 1

downlinkDecoder:
fileName: dl-downlink-codec.js
examples:
- description: Set period 600 seconds
input:
fPort: 1
bytes: [0x00, 0x01, 0x02, 0x58, 0x7E, 0x51]
output:
data:
command: set period
parameter: 600
- description: Reset
input:
fPort: 1
bytes: [0xFE, 0xFE, 0x00, 0x00, 0x3C, 0x50]
output:
data:
command: reset
84 changes: 84 additions & 0 deletions vendor/decentlab/dl-blg.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
var decentlab_decoder = {
PROTOCOL_VERSION: 2,
SENSORS: [
{length: 2,
values: [{name: 'voltage_ratio',
displayName: 'Voltage ratio',
convert: function (x) { return ((x[0] + x[1]*65536) / 8388608 - 1) / 2; }},
{name: 'thermistor_resistance',
displayName: 'Thermistor resistance',
convert: function (x) { return 1000 / (((x[0] + x[1]*65536) / 8388608 - 1) / 2) - 41000; },
unit: 'Ω'},
{name: 'temperature',
displayName: 'Temperature',
convert: function (x) { return (1 / (0.0008271111 + 0.000208802 * Math.log(1000 / (((x[0] + x[1]*65536) / 8388608 - 1) / 2) - 41000) + 0.000000080592 * Math.pow(Math.log(1000 / (((x[0] + x[1]*65536) / 8388608 - 1) / 2) - 41000), 3) )) - 273.15; },
unit: '°C'}]},
{length: 1,
values: [{name: 'battery_voltage',
displayName: 'Battery voltage',
convert: function (x) { return x[0] / 1000; },
unit: 'V'}]}
],

read_int: function (bytes, pos) {
return (bytes[pos] << 8) + bytes[pos + 1];
},

decode: function (msg) {
var bytes = msg;
var i, j;
if (typeof msg === 'string') {
bytes = [];
for (i = 0; i < msg.length; i += 2) {
bytes.push(parseInt(msg.substring(i, i + 2), 16));
}
}

var version = bytes[0];
if (version != this.PROTOCOL_VERSION) {
return {error: "protocol version " + version + " doesn't match v2"};
}

var deviceId = this.read_int(bytes, 1);
var flags = this.read_int(bytes, 3);
var result = {'protocol_version': version, 'device_id': deviceId};
// decode payload
var pos = 5;
for (i = 0; i < this.SENSORS.length; i++, flags >>= 1) {
if ((flags & 1) !== 1)
continue;

var sensor = this.SENSORS[i];
var x = [];
// convert data to 16-bit integer array
for (j = 0; j < sensor.length; j++) {
x.push(this.read_int(bytes, pos));
pos += 2;
}

// decode sensor values
for (j = 0; j < sensor.values.length; j++) {
var value = sensor.values[j];
if ('convert' in value) {
result[value.name] = {displayName: value.displayName,
value: value.convert.bind(this)(x)};
if ('unit' in value)
result[value.name]['unit'] = value.unit;
}
}
}
return result;
}
};

function decodeUplink(input) {
var res = decentlab_decoder.decode(input.bytes);
if (res.error) {
return {
errors: [res.error],
};
}
return {
data: res,
};
}
Binary file added vendor/decentlab/dl-blg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
89 changes: 89 additions & 0 deletions vendor/decentlab/dl-blg.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: DL-BLG
description: The Decentlab DL-BLG is equipped with a black globe temperature sensor. It is suitable for use in workplace safety, heat stress measurement, WBGT calculation for heat stress and meteorology.

hardwareVersions:
- version: '1'
numeric: 1

firmwareVersions:
- version: 1.5.7
numeric: 157
hardwareVersions:
- '1'
profiles:
EU863-870:
id: profile-eu868
lorawanCertified: true
codec: dl-blg-codec
AS923:
id: profile-as923
lorawanCertified: false
codec: dl-blg-codec
US902-928:
id: profile-us915
lorawanCertified: true
codec: dl-blg-codec
AU915-928:
id: profile-au915
lorawanCertified: false
codec: dl-blg-codec

sensors:
- temperature
- battery

dimensions:
length: 135
width: 81
height: 70

weight: 720

battery:
replaceable: true
type: 2 C alkaline

operatingConditions:
temperature:
min: -20
max: 50
relativeHumidity:
min: 0
max: 1.0

ipCode: IP67

keyProvisioning:
- custom
keySecurity: none

productURL: https://www.decentlab.com/black-globe-temperature-sensor-for-lorawan
dataSheetURL: https://cdn.decentlab.com/download/datasheets/Decentlab-DL-BLG-datasheet.pdf
photos:
main: dl-blg.png

compliances:
safety:
- body: IEC
norm: EN
standard: 62368-1
radioEquipment:
- body: ETSI
norm: EN
standard: 301 489-1
version: 2.2.0
- body: ETSI
norm: EN
standard: 301 489-3
version: 2.1.1
- body: ETSI
norm: EN
standard: 300 220-1
version: 3.1.1
- body: ETSI
norm: EN
standard: 300 220-2
version: 3.1.1
- body: IEC
norm: EN
standard: 62479:2010
89 changes: 89 additions & 0 deletions vendor/decentlab/dl-cws-codec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
uplinkDecoder:
fileName: dl-cws.js
examples:
- description: Example 1
input:
fPort: 1
bytes: [0x02, 0x46, 0x39, 0x00, 0x03, 0x8a, 0x77, 0x8a, 0x95, 0x97, 0x7a, 0x87, 0x4c, 0x80, 0x47, 0x8a, 0x5e, 0x0b, 0x74]
output:
data:
air_humidity:
displayName: Air humidity
unit: '%'
value: 60.1
air_temperature:
displayName: Air temperature
unit: "\xB0C"
value: 27.09
angle:
displayName: Angle
unit: "\xB0"
value: 71
battery_voltage:
displayName: Battery voltage
unit: V
value: 2.932
device_id: 17977
dew_point:
displayName: Dew point
unit: "\xB0C"
value: 18.68
protocol_version: 2
sensor_temperature:
displayName: Sensor temperature
unit: "\xB0C"
value: 26.54
surface_temperature:
displayName: Surface temperature
unit: "\xB0C"
value: 26.79
- description: Example 2
input:
fPort: 1
bytes: [0x02, 0x46, 0x39, 0x00, 0x02, 0x0b, 0x74]
output:
data:
battery_voltage:
displayName: Battery voltage
unit: V
value: 2.932
device_id: 17977
protocol_version: 2

downlinkEncoder:
fileName: dl-downlink-codec.js
examples:
- description: Set period 3600 seconds and save
input:
data:
command: set period + save
parameter: 3600
output:
bytes: [0, 2, 14, 16, 72, 164]
fPort: 1
- description: Set ADR off
input:
data:
command: set adr off
output:
bytes: [0, 7, 0, 0, 229, 177]
fPort: 1

downlinkDecoder:
fileName: dl-downlink-codec.js
examples:
- description: Set period 600 seconds
input:
fPort: 1
bytes: [0x00, 0x01, 0x02, 0x58, 0x7E, 0x51]
output:
data:
command: set period
parameter: 600
- description: Reset
input:
fPort: 1
bytes: [0xFE, 0xFE, 0x00, 0x00, 0x3C, 0x50]
output:
data:
command: reset
Loading

0 comments on commit 341ea4c

Please sign in to comment.