Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new vendor and new device #702

Closed
4 changes: 4 additions & 0 deletions vendor/index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1987,3 +1987,7 @@ vendors:
website: https://www.senso8.com/
logo: senso8-logo.svg
linkedin: https://www.linkedin.com/company/arwin-technology-limited/

- id: tip
name: TIP Meter
website: https://www.tip-meter.de/
28 changes: 28 additions & 0 deletions vendor/pessl_instruments/imetos_lorain-codec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Uplink decoder decodes binary data uplink into a JSON object (optional)
# For documentation on writing encoders and decoders, see: https://www.thethingsindustries.com/docs/integrations/payload-formatters/javascript/
uplinkDecoder:
fileName: imetos_lorain.js
# Examples (optional)
examples:
- description: 47 bytes
input:
bytes:
[69, EA, 19, 80, 01, 6E, 00, 64, 00, 05, 34, 12, 40, 03, 92, 09, 21, 07, 68, 01, 1A, 06, AA, 05, 42, 06, D3, 02, C6, 02, DB, 02, FF, 00, D4, 00, 21, 01, 3B, 00, 87, FF, 75, 00, 5F, 00, 0F]
output:
data:
avg_temp: 15.62,
battery: 2450,
deltaT_avg: 2.55
deltaT_max: 2.89
deltaT_min: 2.12
dewPoint_avg: 59
dewPoint_min: 117
humidity_avg: 72.3
humidity_max: 73.1
humidity_min: 71
max_temp: 16.02
min_temp: 14.5
precipitation: 360
solar: 1825
vpd_avg: 0.95
vpd_min: 0.15
28 changes: 28 additions & 0 deletions vendor/pessl_instruments/imetos_lorain-profile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Vendor profile ID, can be freely issued by the vendor
# This vendor profile ID is also used on the QR code for LoRaWAN devices, see
# https://lora-alliance.org/sites/default/files/2020-10/LoRa_Alliance_Vendor_ID_for_QR_Code.pdf
vendorProfileID: 1

# LoRaWAN MAC version: 1.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4 or 1.1
macVersion: '1.0.3'
# LoRaWAN Regional Parameters version. Values depend on the LoRaWAN version:
# 1.0: TS001-1.0
# 1.0.1: TS001-1.0.1
# 1.0.2: RP001-1.0.2 or RP001-1.0.2-RevB
# 1.0.3: RP001-1.0.3-RevA
# 1.0.4: RP002-1.0.0 or RP002-1.0.1
# 1.1: RP001-1.1-RevA or RP001-1.1-RevB
regionalParametersVersion: 'RP001-1.0.3-RevA'

# Whether the end device supports join (OTAA) or not (ABP)
supportsJoin: true

# Maximum EIRP
maxEIRP: 16

# Whether the end device supports 32-bit frame counters
supports32bitFCnt: true

# Whether the end device supports class B
supportsClassB: false
supportsClassC: false
21 changes: 21 additions & 0 deletions vendor/pessl_instruments/imetos_lorain.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
function decodeUplink(input) {
return {
data: {
battery: input.bytes[14] + (input.bytes[15] << 8),
solar: input.bytes[16] + (input.bytes[17] << 8),
precipitation: input.bytes[18] + (input.bytes[19] << 8),
avg_temp: (input.bytes[20] + (input.bytes[21] << 8)) / 100,
min_temp: (input.bytes[22] + (input.bytes[23] << 8)) / 100,
max_temp: (input.bytes[24] + (input.bytes[25] << 8)) / 100,
humidity_avg: (input.bytes[26] + (input.bytes[27] << 8)) / 10,
humidity_max: (input.bytes[30] + (input.bytes[31] << 8)) / 10,
humidity_min: (input.bytes[28] + (input.bytes[29] << 8)) / 10,
deltaT_avg: (input.bytes[32] + (input.bytes[33] << 8)) / 100,
dewPoint_avg: input.bytes[38] + (input.bytes[39] << 8),
dewPoint_min: input.bytes[42] + (input.bytes[43] << 8),
deltaT_max: (input.bytes[36] + (input.bytes[37] << 8)) / 100,
vpd_avg: (input.bytes[44] + (input.bytes[45] << 8)) / 100,
vpd_min: (input.bytes[46] + (input.bytes[47] << 8)) / 100,
},
};
}
19 changes: 19 additions & 0 deletions vendor/pessl_instruments/imetos_lorain.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: iMetos LoRAIN
description: LoRAIN is a weather station that operates on the LoRaWAN® network. LoRAIN device measures rainfall, air and soil temperature, relative humidity, leaf wetness, and soil moisture.


# Firmware versions (at least one is mandatory)
firmwareVersions:
- # Firmware version
version: '1.10'
numeric: 1

# LoRaWAN Device Profiles per region
# Supported regions are EU863-870, US902-928, AU915-928, AS923, CN779-787, EU433, CN470-510, KR920-923, IN865-867,
# RU864-870
profiles:
EU863-870:
id: imetos_lorain-profile
lorawanCertified: true
codec: imetos_lorain-codec

5 changes: 5 additions & 0 deletions vendor/pessl_instruments/index.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# This example contains just one end device: windsensor. It is referenced here in the index.

endDevices:
# Unique identifier of the end device (lowercase, alphanumeric with dashes, max 36 characters)
- imetos_lorain # look in windsensor.yaml for the end device definition
5 changes: 5 additions & 0 deletions vendor/tip/index.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# This example contains just one end device: windsensor. It is referenced here in the index.

endDevices:
# Unique identifier of the end device (lowercase, alphanumeric with dashes, max 36 characters)
- sinus85 # look in windsensor.yaml for the end device definition
4 changes: 4 additions & 0 deletions vendor/tip/sinus85-codec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Uplink decoder decodes binary data uplink into a JSON object (optional)
# For documentation on writing encoders and decoders, see: https://www.thethingsindustries.com/docs/integrations/payload-formatters/javascript/
uplinkDecoder:
fileName: sinus85.js
28 changes: 28 additions & 0 deletions vendor/tip/sinus85-profile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Vendor profile ID, can be freely issued by the vendor
# This vendor profile ID is also used on the QR code for LoRaWAN devices, see
# https://lora-alliance.org/sites/default/files/2020-10/LoRa_Alliance_Vendor_ID_for_QR_Code.pdf
vendorProfileID: 1

# LoRaWAN MAC version: 1.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4 or 1.1
macVersion: '1.0.3'
# LoRaWAN Regional Parameters version. Values depend on the LoRaWAN version:
# 1.0: TS001-1.0
# 1.0.1: TS001-1.0.1
# 1.0.2: RP001-1.0.2 or RP001-1.0.2-RevB
# 1.0.3: RP001-1.0.3-RevA
# 1.0.4: RP002-1.0.0 or RP002-1.0.1
# 1.1: RP001-1.1-RevA or RP001-1.1-RevB
regionalParametersVersion: 'RP001-1.0.3-RevA'

# Whether the end device supports join (OTAA) or not (ABP)
supportsJoin: true

# Maximum EIRP
maxEIRP: 16

# Whether the end device supports 32-bit frame counters
supports32bitFCnt: true

# Whether the end device supports class B
supportsClassB: false
supportsClassC: false
126 changes: 126 additions & 0 deletions vendor/tip/sinus85.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
const reg2obisMapping = {
"1": "1.8.1",
"2": "2.8.1",
"3": "3.8.1",
"4": "4.8.1",
"5": "1.8.2",
"6": "2.8.2",
"7": "3.8.2",
"8": "4.8.2",
"9": "1.7.0",
"10": "3.7.0",
"11": "9.7.0",
"12": "14.7.0",
"13": "13.7.0",
"14": "T1 Wirk Energie Zähler Import",
"15": "21.7.0",
"16": "23.7.0",
"17": "29.7.0",
"18": "32.7.0",
"19": "31.7.0",
"20": "33.7.0",
"21": "T1 Wirk Energie Zähler Export",
"22": "T1 Blind Energie Zähler Import",
"23": "41.7.0",
"24": "43.7.0",
"25": "49.7.0",
"26": "52.7.0",
"27": "51.7.0",
"28": "53.7.0",
"29": "T1 Blind Energie Zähler Export",
"30": "T2 Wirk Energie Zähler Import",
"31": "61.7.0",
"32": "63.7.0",
"33": "69.7.0",
"34": "72.7.0",
"35": "71.7.0",
"36": "73.7.0",
"37": "T2 Wirk Energie Zähler Export",
"38": "T2 Blind Energie Zähler Import",
"39": "T2 Blind Energie Zähler Export",
};

const reg2obis = (reg_hex) => reg2obisMapping[reg_hex.toString()] || reg_hex.toString();

function parseHeaders(bytes) {
const result = {};
const hex_string = bytes.map(byte => byte.toString(16).padStart(2, '0')).join('');

// Determine Frame Control
result.Fctrl = hex_string.substring(0, 2);

// Determine Number of Registers
result.Number_Registers = parseInt(hex_string.substring(2, 4), 16) - 2;

// Determine Control Array Input
const expectedLength = 2 + 2 + 2 * result.Number_Registers + 8 + 6;
if (hex_string.length >= expectedLength) {
result.Control_Array = hex_string.substring(4, 4 + 2 * result.Number_Registers);
} else {
return {};
}

return result;
}

function padLeadingZeros(num, size) {
var s = num + "";
while (s.length < size) s = "0" + s;
return s;
}

function get_registers(bytes, header) {
var hex_string = bytes.map(byte => byte.toString(16).padStart(2, '0')).join('').toUpperCase();

var current_frame_ptr = 12;

//modular size
current_frame_ptr = 4 + 2 * parseInt(header.Number_Registers, 16); //fctl 2 + register 2 + Control_Array

//Check for sufficient data
if (hex_string.length >= 10 + 2 * (parseInt(header.Number_Registers, 16) - 1)) {
serial_nr = hex_string.substring(current_frame_ptr, current_frame_ptr + 8);
current_frame_ptr += 8;

current_frame_ptr += 6;
} else {
return {};
}

var range = parseInt(header.Number_Registers, 16);
var measures = {};
var _ctl, _endpointstr, _value, _reg;

for (let i = 1; i <= range; i++) {
_ctl = "";
_endpointstr = "";

_endpointstr = reg2obis(parseInt(header.Control_Array.substring((i - 1) * 2, i * 2), 16).toString(10));

_value = hex_string.substring(current_frame_ptr, current_frame_ptr + 8);
_reg = parseInt(_value, 16).toString(10);

measures[_endpointstr] = _reg;
current_frame_ptr += 8;
}

return measures;
}


function decodeUplink(input) {
//Read Codec Header from Message
var header = parseHeaders(input.bytes);

if (Object.keys(header).length === 0 && header.constructor === Object) {
return {
errors: [
"IIoT Box Decoder: Header decoder returned empty header, stop decoding message",
],
};
}

return {
data: get_registers(input.bytes, header),
};
}
13 changes: 13 additions & 0 deletions vendor/tip/sinus85.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Sinus 85
description: Direct measuring digital three-phase meter for DIN rail mounting

# Firmware versions (at least one is mandatory)
firmwareVersions:
- # Firmware version
version: '1.0.3'
numeric: 1
profiles:
EU863-870:
id: sinus85-profile
lorawanCertified: true
codec: sinus85-codec
Loading