-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: Add Ellenex sensors decoders * chore: Update schema for connector_details.json * chore: Ignore specific files in linter configuration
- Loading branch information
1 parent
2093033
commit 6823777
Showing
81 changed files
with
2,489 additions
and
2 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"$schema": "../../../../schema/connector.json", | ||
"name": "Ellenex DUS2-L", | ||
"images": { | ||
"logo": "./assets/logo.png" | ||
}, | ||
"versions": { | ||
"v1.0.0": { | ||
"src": "./v1.0.0/payload.js", | ||
"manifest": "./v1.0.0/payload-config.jsonc" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
LoRaWAN low power ultrasonic level sensor for liquid or solid media |
25 changes: 25 additions & 0 deletions
25
decoders/connector/ellenex/dus2-l/v1.0.0/payload-config.jsonc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"$schema": "../../../../../schema/connector_details.json", | ||
"description": "../description.md", | ||
"install_text": "", | ||
"install_end_text": "", | ||
"device_annotation": "", | ||
"device_parameters": [], | ||
"networks": [ | ||
"../../../../network/lorawan-actility/v1.0.0/payload.js", | ||
"../../../../network/lorawan-citykinect/v1.0.0/payload.js", | ||
"../../../../network/lorawan-everynet/v1.0.0/payload.js", | ||
"../../../../network/lorawan-kerlink/v1.0.0/payload.js", | ||
"../../../../network/lorawan-loriot-/v1.0.0/payload.js", | ||
"../../../../network/lorawan-machineq/v1.0.0/payload.js", | ||
"../../../../network/lorawan-orbiwise/v1.0.0/payload.js", | ||
"../../../../network/lorawan-senet/v1.0.0/payload.js", | ||
"../../../../network/lorawan-senra/v1.0.0/payload.js", | ||
"../../../../network/lorawan-tektelic/v1.0.0/payload.js", | ||
"../../../../network/lorawan-ttittn-v3/v1.0.0/payload.js", | ||
"../../../../network/lorawan-swisscom/v1.0.0/payload.js", | ||
"../../../../network/lorawan-chirpstack/v1.0.0/payload.js", | ||
"../../../../network/lorawan-helium/v1.0.0/payload.js", | ||
"../../../../network/lorawan-brdot-/v1.0.0/payload.js" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
/* This is an generic payload parser example. | ||
** The code find the payload variable and parse it if exists. | ||
** | ||
** IMPORTANT: In most case, you will only need to edit the parsePayload function. | ||
** | ||
** Testing: | ||
** You can do manual tests to this parse by using the Device Emulator. Copy and Paste the following code: | ||
** [{ "variable": "payload", "value": "01880009CD078F22" }] | ||
** | ||
** The ignore_vars variable in this code should be used to ignore variables | ||
** from the device that you don't want. | ||
*/ | ||
|
||
// let payload = [{ variable: 'payload', value: '01880009CD078F22' }]; | ||
|
||
// Add ignorable variables in this array. | ||
const ignore_vars = []; | ||
|
||
function toTagoFormat(object_item, serie, prefix = '') { | ||
const result = []; | ||
for (const key in object_item) { | ||
if (ignore_vars.includes(key)) continue; | ||
|
||
if (typeof object_item[key] === 'object') { | ||
result.push({ | ||
variable: object_item[key].variable || `${prefix}${key}`.toLowerCase(), | ||
value: object_item[key].value, | ||
serie: object_item[key].serie || serie, | ||
metadata: object_item[key].metadata, | ||
location: object_item[key].location, | ||
unit: object_item[key].unit, | ||
}); | ||
} else { | ||
result.push({ | ||
variable: `${prefix}${key}`.toLowerCase(), | ||
value: object_item[key], | ||
serie, | ||
}); | ||
} | ||
} | ||
|
||
return result; | ||
} | ||
|
||
|
||
/** | ||
* This is the main function to parse the payload. Everything else doesn't require your attention. | ||
* @param {String} payload_raw | ||
* @returns {Object} containing key and value to TagoIO | ||
*/ | ||
function parsePayload(payload_raw) { | ||
try { | ||
const bytes = Buffer.from(payload_raw, 'hex'); | ||
const data = []; | ||
// Decode an uplink message from a buffer | ||
// (array) of bytes to an object of fields. | ||
|
||
const tank_height = Number(device.params.find(param => param.key === 'tank_height').value); | ||
if (!tank_height && typeof tank_height !== 'number') throw 'Missing "tank_height" key in the configuration parameters'; | ||
|
||
const board_serial = bytes.readUIntBE(0, 2); | ||
const sensor_reading_type = bytes.readUIntBE(2, 1); | ||
const battery = bytes.readUIntBE(7, 1) * 0.1; | ||
|
||
data.push({ variable: 'board_serial', value: board_serial }, | ||
{ variable: 'sensor_reading_type', value: sensor_reading_type }); | ||
if (sensor_reading_type === 0) { | ||
const distance = bytes.readUIntBE(3, 2); | ||
const level = tank_height - bytes.readUIntBE(3, 2); | ||
|
||
data.push( | ||
{ variable: 'distance', value: distance, unit: 'mm' }, | ||
{ variable: 'level', value: level, unit: 'mm' }, | ||
{ variable: 'battery', value: battery, unit: 'V' }, | ||
); | ||
} | ||
|
||
|
||
return data; | ||
} catch (e) { | ||
console.log(e); | ||
// Return the variable parse_error for debugging. | ||
return { parse_error: e.message }; | ||
} | ||
} | ||
// Remove unwanted variables. | ||
payload = payload.filter(x => !ignore_vars.includes(x.variable)); | ||
|
||
// Payload is an environment variable. Is where what is being inserted to your device comes in. | ||
// Payload always is an array of objects. [ { variable, value...}, {variable, value...} ...] | ||
const payload_raw = payload.find(x => x.variable === 'payload_raw' || x.variable === 'payload' || x.variable === 'data'); | ||
if (payload_raw) { | ||
// Get a unique serie for the incoming data. | ||
// Get a unique serie for the incoming data. | ||
const { value, time } = payload_raw; | ||
let { serie } = payload_raw; | ||
serie = new Date().getTime(); | ||
|
||
// Parse the payload_raw to JSON format (it comes in a String format) | ||
if (value) { | ||
payload = payload.concat(toTagoFormat(parsePayload(value.replace(/ /g, '')), serie)); | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"$schema": "../../../../schema/connector.json", | ||
"name": "Ellenex FMS2-L", | ||
"images": { | ||
"logo": "./assets/logo.png" | ||
}, | ||
"versions": { | ||
"v1.0.0": { | ||
"src": "./v1.0.0/payload.js", | ||
"manifest": "./v1.0.0/payload-config.jsonc" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
LoRaWAN low power pulse counter and analogue interface for the water meter and flowmeter totalising for usage and leakage monitoring |
25 changes: 25 additions & 0 deletions
25
decoders/connector/ellenex/fms2-l/v1.0.0/payload-config.jsonc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"$schema": "../../../../../schema/connector_details.json", | ||
"description": "../description.md", | ||
"install_text": "", | ||
"install_end_text": "", | ||
"device_annotation": "", | ||
"device_parameters": [], | ||
"networks": [ | ||
"../../../../network/lorawan-actility/v1.0.0/payload.js", | ||
"../../../../network/lorawan-citykinect/v1.0.0/payload.js", | ||
"../../../../network/lorawan-everynet/v1.0.0/payload.js", | ||
"../../../../network/lorawan-kerlink/v1.0.0/payload.js", | ||
"../../../../network/lorawan-machineq/v1.0.0/payload.js", | ||
"../../../../network/lorawan-loriot-/v1.0.0/payload.js", | ||
"../../../../network/lorawan-orbiwise/v1.0.0/payload.js", | ||
"../../../../network/lorawan-senet/v1.0.0/payload.js", | ||
"../../../../network/lorawan-senra/v1.0.0/payload.js", | ||
"../../../../network/lorawan-tektelic/v1.0.0/payload.js", | ||
"../../../../network/lorawan-ttittn-v3/v1.0.0/payload.js", | ||
"../../../../network/lorawan-swisscom/v1.0.0/payload.js", | ||
"../../../../network/lorawan-chirpstack/v1.0.0/payload.js", | ||
"../../../../network/lorawan-helium/v1.0.0/payload.js", | ||
"../../../../network/lorawan-brdot-/v1.0.0/payload.js" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
/* This is an generic payload parser example. | ||
** The code find the payload variable and parse it if exists. | ||
** | ||
** IMPORTANT: In most case, you will only need to edit the parsePayload function. | ||
** | ||
** Testing: | ||
** You can do manual tests to this parse by using the Device Emulator. Copy and Paste the following code: | ||
** [{ "variable": "payload", "value": "80162600005b2224" }] | ||
** | ||
** The ignore_vars variable in this code should be used to ignore variables | ||
** from the device that you don't want. | ||
*/ | ||
|
||
// let payload = [{ variable: 'payload', value: '80162600005b2224' }]; | ||
|
||
// Add ignorable variables in this array. | ||
const ignore_vars = []; | ||
|
||
function toTagoFormat(object_item, serie, prefix = '') { | ||
const result = []; | ||
for (const key in object_item) { | ||
if (ignore_vars.includes(key)) continue; | ||
|
||
if (typeof object_item[key] === 'object') { | ||
result.push({ | ||
variable: object_item[key].variable || `${prefix}${key}`.toLowerCase(), | ||
value: object_item[key].value, | ||
serie: object_item[key].serie || serie, | ||
metadata: object_item[key].metadata, | ||
location: object_item[key].location, | ||
unit: object_item[key].unit, | ||
}); | ||
} else { | ||
result.push({ | ||
variable: `${prefix}${key}`.toLowerCase(), | ||
value: object_item[key], | ||
serie, | ||
}); | ||
} | ||
} | ||
|
||
return result; | ||
} | ||
|
||
|
||
/** | ||
* This is the main function to parse the payload. Everything else doesn't require your attention. | ||
* @param {String} payload_raw | ||
* @returns {Object} containing key and value to TagoIO | ||
*/ | ||
function parsePayload(payload_raw) { | ||
try { | ||
const bytes = Buffer.from(payload_raw, 'hex'); | ||
const data = []; | ||
// Decode an uplink message from a buffer | ||
// (array) of bytes to an object of fields. | ||
|
||
// Payload = 80 16 26 00 00 5b 22 24 | ||
const pressure = bytes.readUIntBE(1, 2); | ||
const pulse_counter = bytes.readUIntBE(3, 4); | ||
const battery = bytes.readUIntBE(7, 1) * 0.1; | ||
|
||
|
||
data.push( | ||
{ variable: 'pressure', value: pressure }, | ||
{ variable: 'pulse_counter', value: pulse_counter }, | ||
{ variable: 'battery', value: battery, unit: 'V' }, | ||
); | ||
|
||
|
||
return data; | ||
} catch (e) { | ||
console.log(e); | ||
// Return the variable parse_error for debugging. | ||
return { parse_error: e.message }; | ||
} | ||
} | ||
// Remove unwanted variables. | ||
payload = payload.filter(x => !ignore_vars.includes(x.variable)); | ||
|
||
// Payload is an environment variable. Is where what is being inserted to your device comes in. | ||
// Payload always is an array of objects. [ { variable, value...}, {variable, value...} ...] | ||
const payload_raw = payload.find(x => x.variable === 'payload_raw' || x.variable === 'payload' || x.variable === 'data'); | ||
if (payload_raw) { | ||
// Get a unique serie for the incoming data. | ||
const { value, time } = payload_raw; | ||
let { serie } = payload_raw; | ||
serie = new Date().getTime(); | ||
|
||
// Parse the payload_raw to JSON format (it comes in a String format) | ||
if (value) { | ||
payload = payload.concat(toTagoFormat(parsePayload(value.replace(/ /g, '')), serie)); | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"$schema": "../../../../schema/connector.json", | ||
"name": "Ellenex PDS2-L", | ||
"images": { | ||
"logo": "./assets/logo.png" | ||
}, | ||
"versions": { | ||
"v1.0.0": { | ||
"src": "./v1.0.0/payload.js", | ||
"manifest": "./v1.0.0/payload-config.jsonc" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
LoRaWAN Operated Low Power Differential Pressure Transmitter for Liquid and Gas Media |
38 changes: 38 additions & 0 deletions
38
decoders/connector/ellenex/pds2-l/v1.0.0/payload-config.jsonc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"$schema": "../../../../../schema/connector_details.json", | ||
"description": "../description.md", | ||
"install_text": "* Compatible with all LoRaWAN ® frequencies\n* Wide range of industrial applications\n* High accuracy\n* Designed to meet outdoor applications\n* Long-term durable performance in harsh environment\n* Ultra-low power\n* Suitable for liquids and gases compatible with SS", | ||
"install_end_text": "", | ||
"device_annotation": "", | ||
"device_parameters": [ | ||
{ | ||
"name": "K", | ||
"type": "number" | ||
}, | ||
{ | ||
"name": "m", | ||
"type": "number" | ||
}, | ||
{ | ||
"name": "b", | ||
"type": "number" | ||
} | ||
], | ||
"networks": [ | ||
"../../../../network/lorawan-actility/v1.0.0/payload.js", | ||
"../../../../network/lorawan-citykinect/v1.0.0/payload.js", | ||
"../../../../network/lorawan-everynet/v1.0.0/payload.js", | ||
"../../../../network/lorawan-kerlink/v1.0.0/payload.js", | ||
"../../../../network/lorawan-loriot-/v1.0.0/payload.js", | ||
"../../../../network/lorawan-machineq/v1.0.0/payload.js", | ||
"../../../../network/lorawan-orbiwise/v1.0.0/payload.js", | ||
"../../../../network/lorawan-senet/v1.0.0/payload.js", | ||
"../../../../network/lorawan-senra/v1.0.0/payload.js", | ||
"../../../../network/lorawan-tektelic/v1.0.0/payload.js", | ||
"../../../../network/lorawan-ttittn-v3/v1.0.0/payload.js", | ||
"../../../../network/lorawan-swisscom/v1.0.0/payload.js", | ||
"../../../../network/lorawan-chirpstack/v1.0.0/payload.js", | ||
"../../../../network/lorawan-helium/v1.0.0/payload.js", | ||
"../../../../network/lorawan-brdot-/v1.0.0/payload.js" | ||
] | ||
} |
Oops, something went wrong.