Skip to content

Commit

Permalink
update: Add Koidra Inc. profile (#635)
Browse files Browse the repository at this point in the history
* update: Add Koidra Inc. profile

* fix profile name

* run validate fmt

---------

Co-authored-by: Jaime Trinidad <[email protected]>
Co-authored-by: Jaime Trinidad <[email protected]>
  • Loading branch information
3 people authored Jul 11, 2023
1 parent b94b9c5 commit b921bfc
Show file tree
Hide file tree
Showing 19 changed files with 852 additions and 253 deletions.
320 changes: 68 additions & 252 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"homepage": "https://github.com/TheThingsNetwork/lorawan-devices#readme",
"devDependencies": {
"ajv": "^6.12.6",
"ajv-cli": "^5.0.0",
"ajv-cli": "^0.6.0",
"prettier": "^2.6.2"
},
"dependencies": {
Expand Down
8 changes: 8 additions & 0 deletions vendor/index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1961,3 +1961,11 @@ vendors:
name: dnt Innovation GmbH
website: https://www.dnt.de/
logo: dnt-logo.svg

- id: koidra
name: Koidra Inc.
description: Koidra is an intelligent automation company, dedicated to modernizing the automation of manufacturing facilities, with the high-tech greenhouse industry being the core market. Our tiered products deliver a comprehensive solution that enhances industrial efficiency.
website: https://www.koidra.ai/
logo: koidra-logo.svg
social:
linkedin: https://www.linkedin.com/company/koidra/
8 changes: 8 additions & 0 deletions vendor/koidra/index.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# 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)
- sdi-12-dra # look in sdi-12-dra.yaml for the end device definition
# - rs-485-ln # look in windsensor.yaml for the end device definition
# - rs-485-bl # look in windsensor.yaml for the end device definition
- sdi-12-tek # look in sdi-12-tek.yaml for the end device definition
1 change: 1 addition & 0 deletions vendor/koidra/koidra-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
65 changes: 65 additions & 0 deletions vendor/koidra/sdi-12-dra-codec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# 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: sdi-12-dra.js
# Examples (optional)
# examples:
# - description: 32 knots from the North
# input:
# fPort: 1
# bytes: [0, 32]
# output:
# data:
# direction: 'N'
# speed: 32
# # Normalized output, uses the normalizeUplink function (optional)
# normalizedOutput:
# data:
# - wind:
# speed: 16.4608
# direction: 0
# - description: 42 knots from the East
# input:
# fPort: 1
# bytes: [1, 42]
# output:
# data:
# direction: 'E'
# speed: 42
# - description: Unknown FPort
# input:
# fPort: 42
# bytes: [1, 42]
# output:
# errors:
# - unknown FPort
# # Downlink encoder encodes JSON object into a binary data downlink (optional)
# downlinkEncoder:
# fileName: windsensor.js
# examples:
# - description: Turn green
# input:
# data:
# led: green
# output:
# bytes: [1]
# fPort: 2
# - description: Invalid color
# input:
# data:
# led: blue
# output:
# errors:
# - invalid LED color

# # Downlink decoder decodes the encoded downlink message (optional, must be symmetric with downlinkEncoder)
# downlinkDecoder:
# fileName: windsensor.js
# examples:
# - description: Turn green
# input:
# fPort: 2
# bytes: [1]
# output:
# data:
# led: green
Binary file added vendor/koidra/sdi-12-dra-package.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
52 changes: 52 additions & 0 deletions vendor/koidra/sdi-12-dra-profile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# 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: 0

# 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
# If your device is an ABP device (supportsJoin is false), uncomment the following fields:
# RX1 delay
#rx1Delay: 5
# RX1 data rate offset
#rx1DataRateOffset: 0
# RX2 data rate index
#rx2DataRateIndex: 0
# RX2 frequency (MHz)
#rx2Frequency: 869.525
# Factory preset frequencies (MHz)
#factoryPresetFrequencies: [868.1, 868.3, 868.5, 867.1, 867.3, 867.5, 867.7, 867.9]

# Maximum EIRP
maxEIRP: 16
# Whether the end device supports 32-bit frame counters
supports32bitFCnt: true

# Whether the end device supports class B
supportsClassB: false
# If your device supports class B, uncomment the following fields:
# Maximum delay for the end device to answer a MAC request or confirmed downlink frame (seconds)
#classBTimeout: 60
# Ping slot period (seconds)
#pingSlotPeriod: 128
# Ping slot data rate index
#pingSlotDataRateIndex: 0
# Ping slot frequency (MHz). Set to 0 if the band supports ping slot frequency hopping.
#pingSlotFrequency: 869.525

# Whether the end device supports class C
supportsClassC: false
# If your device supports class C, uncomment the following fields:
# Maximum delay for the end device to answer a MAC request or confirmed downlink frame (seconds)
#classCTimeout: 60
Binary file added vendor/koidra/sdi-12-dra.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
123 changes: 123 additions & 0 deletions vendor/koidra/sdi-12-dra.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
// Only for AT+DATAUP=0 & AT+ALLDATAMOD=0
function Decoder(bytes, port) {
if(port==5)
{
var freq_band;
var sub_band;
var sensor;

if(bytes[0]==0x17)
sensor= "SDI12-LB";

var firm_ver= (bytes[1]&0x0f)+'.'+(bytes[2]>>4&0x0f)+'.'+(bytes[2]&0x0f);

if(bytes[3]==0x01)
freq_band="EU868";
else if(bytes[3]==0x02)
freq_band="US915";
else if(bytes[3]==0x03)
freq_band="IN865";
else if(bytes[3]==0x04)
freq_band="AU915";
else if(bytes[3]==0x05)
freq_band="KZ865";
else if(bytes[3]==0x06)
freq_band="RU864";
else if(bytes[3]==0x07)
freq_band="AS923";
else if(bytes[3]==0x08)
freq_band="AS923_1";
else if(bytes[3]==0x09)
freq_band="AS923_2";
else if(bytes[3]==0x0A)
freq_band="AS923_3";
else if(bytes[3]==0x0F)
freq_band="AS923_4";
else if(bytes[3]==0x0B)
freq_band="CN470";
else if(bytes[3]==0x0C)
freq_band="EU433";
else if(bytes[3]==0x0D)
freq_band="KR920";
else if(bytes[3]==0x0E)
freq_band="MA869";

if(bytes[4]==0xff)
sub_band="NULL";
else
sub_band=bytes[4];

var bat= (bytes[5]<<8 | bytes[6])/1000;

return {
SENSOR_MODEL:sensor,
FIRMWARE_VERSION:firm_ver,
FREQUENCY_BAND:freq_band,
SUB_BAND:sub_band,
BAT:bat,
}
}
else if(port==100)
{
var datas_sum={};
for(var j=0;j<bytes.length;j++)
{
var datas= String.fromCharCode(bytes[j]);
if(j=='0')
datas_sum.datas_sum=datas;
else
datas_sum.datas_sum+=datas;
}

return datas_sum;
}
else
{
var decode={};
var garbage = 0;
const Suppose_Len = 18;
decode.msg_length = bytes.length;
decode.EXTI_Trigger= (bytes[0] & 0x80)? "TRUE":"FALSE";
decode.BatV= ((bytes[0]<<8 | bytes[1])&0x7FFF)/1000;
decode.Payver= bytes[2];

// for(var i=3;i<bytes.length;i++)
// {
// var data= String.fromCharCode(bytes[i]);
// if(i=='3')
// decode.data_sum=data;
// else
// decode.data_sum+=data;
// }
decode.data_sum = String.fromCharCode(...bytes.slice(3));
data_sum_infos = decode.data_sum.split('+');

if (!isNaN(parseFloat(data_sum_infos[0]))) {
// 2626.96+21.8+38
wc_Root = parseFloat(data_sum_infos[0]);
decode.wc_Root = 6.771*Math.pow(10, -10) * Math.pow(wc_Root, 3) - 5.105*Math.pow(10, -6) * Math.pow(wc_Root, 2) + 1.302*Math.pow(10, -2) * wc_Root - 10.848;
} else if (!isNaN(parseFloat(data_sum_infos[1])) && bytes.length > Suppose_Len) {
// ñ\u00170+2574.78+22.2+637JZL\r\n
garbage = 1;
tempWc = parseFloat(data_sum_infos[1]);
decode.wc_Root = 6.771*Math.pow(10, -10) * Math.pow(tempWc, 3) - 5.105*Math.pow(10, -6) * Math.pow(tempWc, 2) + 1.302*Math.pow(10, -2) * tempWc - 10.848;
} else {
decode.wc_Root = null;
}

if (garbage) {
decode.T_Root = !isNaN(parseFloat(data_sum_infos[2])) ? parseFloat(data_sum_infos[2]) : null;
const numberRegex = /\d+/g;
const numberMatches = data_sum_infos[3].match(numberRegex);
tempEc = numberMatches % 100;
decode.ec_Root = numberMatches ? (parseInt(tempEc) / 1000) : null;
} else {
decode.T_Root = !isNaN(parseFloat(data_sum_infos[1])) ? parseFloat(data_sum_infos[1]) : null;
const numberRegex = /\d+/g;
const numberMatches = data_sum_infos[2].match(numberRegex);
decode.ec_Root = numberMatches ? (parseInt(numberMatches.join("")) / 1000) : null;
}

return decode;
}
}
113 changes: 113 additions & 0 deletions vendor/koidra/sdi-12-dra.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
name: SDI-12-DRA
description: The Koidra SDI-12 is an SDI-12 to LoRaWAN® converter. It allows the SDI-12 devices to use LoRaWAN wireless protocol which simplifies the IoT installation and reduces the installation/maintaining cost.

# Hardware versions (optional, use when you have revisions)
# hardwareVersions:
# - version: '1.0'
# numeric: 1
# - version: '1.0-rev-A'
# numeric: 2

# Firmware versions (at least one is mandatory)
firmwareVersions:
- # Firmware version
version: '1.0'
numeric: 1
# Corresponding hardware versions (optional)
# hardwareVersions:
# - '1.2'

# LoRaWAN Device Profiles per region
# Supported regions are EU863-870, US902-928, AU915-928, AS923, KR920-923, IN865-867, RU864-870
profiles:
EU863-870:
# Unique identifier of the profile (lowercase, alphanumeric with dashes, max 36 characters)
id: sdi-12-dra-profile
codec: sdi-12-dra-codec
US902-928:
id: us915-sdi-12-dra-profile
codec: sdi-12-dra-codec
KR920-923:
id: sdi-12-dra-profile
codec: sdi-12-dra-codec
AU915-928:
id: sdi-12-dra-profile
codec: sdi-12-dra-codec
RU864-870:
id: sdi-12-dra-profile
codec: sdi-12-dra-codec
IN865-867:
id: sdi-12-dra-profile
codec: sdi-12-dra-codec
AS923:
id: sdi-12-dra-profile
codec: sdi-12-dra-codec

# Sensors that this device features (optional)
# Valid values are:
# 4-20 ma, accelerometer, altitude, analog input, auxiliary, barometer, battery, button, bvoc, co, co2, conductivity,
# current, digital input, dissolved oxygen, distance, dust, energy, gps, gyroscope, h2s, humidity, iaq, level, light,
# lightning, link, magnetometer, moisture, motion, no, no2, o3, particulate matter, ph, pir, pm2.5, pm10, potentiometer,
# power, precipitation, pressure, proximity, pulse count, pulse frequency, radar, rainfall, rssi, snr, solar radiation,
# sound, strain, surface temperature, temperature, tilt, time, tvoc, uv, vapor pressure, velocity, vibration, voltage,
# water potential, water, weight, wifi ssid, wind direction, wind speed.
#sensors:
# - wind direction
# - wind speed

# Dimensions in mm (optional)
# Use width, height, length and/or diameter
dimensions:
width: 100
length: 160
height: 60

# Weight in grams (optional)
weight: 910

# Battery information (optional)
battery:
replaceable: true
# type: AA

# Operating conditions (optional)
operatingConditions:
# Temperature (Celsius)
temperature:
min: -30
max: 85
# Relative humidity (fraction of 1)
relativeHumidity:
min: 0
max: 0.97

# IP rating (optional)
ipCode: IP67

# Key provisioning (optional)
# Valid values are: custom (user can configure keys), join server and manifest.
keyProvisioning:
- custom
- join server

# Key security (optional)
# Valid values are: none, read protected and secure element.
# keySecurity: none
keyProgramming:
- serial
- firmware

# Product and data sheet URLs (optional)
# productURL: http://www.dragino.com/products/lora-lorawan-end-node/item/154-rs485-ln.html
# dataSheetURL: http://www.dragino.com/products/lora-lorawan-end-node/item/154-rs485-ln.html
sellerURLs:
- name: 'Koidra'
region:
- Vietnam
url: https://www.koidra.ai/

# Photos
photos:
main: sdi-12-dra.jpg
other:
- sdi-12-dra-package.jpg
Loading

0 comments on commit b921bfc

Please sign in to comment.