Skip to content

Commit

Permalink
New vendor - SmartRural (TheThingsNetwork#546)
Browse files Browse the repository at this point in the history
* New vendor - SmartRural

New vendor - SmartRural

* Verification fix

* Update grain-probe-codec.yaml

* Missing '}'

* Update grain-probe-01.yaml

* Update grain-probe-01.yaml

* rename of file

* codec update

* further codec updates

* Even further codec updates

* Prettier run to help with validation.

* changed the make file back to linux

* Delete .gitignore

* Revert deleting .gitignore

* Remove Powershell Makefile

* Remove windsensor example files

* Remove windsensor photo reference

Co-authored-by: Jaime Trinidad <[email protected]>
Co-authored-by: Johan Stokking <[email protected]>
  • Loading branch information
3 people authored Nov 29, 2022
1 parent 64a0821 commit 80c0f68
Show file tree
Hide file tree
Showing 6 changed files with 299 additions and 0 deletions.
6 changes: 6 additions & 0 deletions vendor/index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1930,3 +1930,9 @@ vendors:
name: ELV Elektronik AG
website: https://de.elv.com/
logo: elv-logo.svg

- id: smartrural
name: SmartRural
website: https://smartrural.coop/
linkedin: https://www.linkedin.com/company/smartrural-coop/
twitter: SmartRuralCoop
158 changes: 158 additions & 0 deletions vendor/smartrural/grain-probe-01.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
name: SmartRural Built Grain Probe
description: Grain probe for use as a 0006-000002 Grain monitor

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

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

# Firmware features (optional)
# Valid values are: remote rejoin (trigger a join from the application layer), transmission interval (configure how
# often he device sends a message).
features:
- remote rejoin
- transmission interval

# 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:
# Optional identifier of the vendor of the profile. When you specify the vendorID, the profile is loaded from
# the vendorID's folder. This allows you to reuse profiles from module or LoRaWAN end device stack vendors.
# If vendorID is empty, the current vendor ID is used. In this example, the vendorID is the current vendor ID,
# which is verbose.
# Identifier of the profile (lowercase, alphanumeric with dashes, max 36 characters)
id: grain-probe-profile
lorawanCertified: true
codec: grain-probe-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, smart valve, snr, so2,
# 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:
- temperature

# Additional radios that this device has (optional)
# Valid values are: ble, nfc, wifi, cellular.
#additionalRadios:
# - ble
# - cellular

# Bridge interfaces (optional)
# Valid values are: modbus, m-bus, can bus, rs-485, sdi-12, analog.
#bridgeInterfaces:
# - m-bus
# - rs-485

# Dimensions in mm (optional)
# Use width, height, length and/or diameter
dimensions:
width: 74
length: 50
height: 3000

# Weight in grams (optional)
weight: 2000

# Battery information (optional)
battery:
replaceable: false
type: 8500mAh industrial battery

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

# IP rating (optional)
ipCode: IP64

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

# Key programming (optional)
# Valid values are: bluetooth, nfc, wifi, serial (when the user has a serial interface to set the keys)
# and firmware (when the user should change the firmware to set the keys).
keyProgramming:
- serial
- firmware

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

# Firmware programming (optional)
# Valid values are: serial (when the user has a serial interface to update the firmware), fuota lorawan (when the device
# supports LoRaWAN FUOTA via standard interfaces) and fuota other (other wireless update mechanism).
firmwareProgramming:
- serial
- fuota lorawan

# Product and data sheet URLs (optional)
productURL: https://example.org/wind-sensor
dataSheetURL: https://example.org/wind-sensor/datasheet.pdf

# Commercial information
resellerURLs:
- name: 'Reseller 1'
region:
- European Union
url: https://example.org/reseller1
- name: 'Reseller 2'
region:
- United States
- Canada
url: https://example.org/reseller2
msrp:
EUR: 90
USD: 120

# Photos
#photos:
# main: windsensor.jpg
# other:
# - windsensor-package.jpg

# Youtube or Vimeo Video (optional)
videos:
main: https://www.youtube.com/watch?v=JHzxcD2oEn8

# Regulatory compliances (optional)
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.0
18 changes: 18 additions & 0 deletions vendor/smartrural/grain-probe-codec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
uplinkDecoder:
fileName: grain-probe.js
examples:
- description: Grain Tempearture Sensor
input:
fPort: 2
bytes: [0x0E, 0x55, 0x01, 0x08, 0x62, 0x08, 0x67, 0x60, 0xE4, 0x3C, 0xC6]
output:
data:
{ 'Ext': 1, 'Systimestamp': 1625570502, 'battery': 3.669, 'debug': { 'bytes': [14, 85, 1, 8, 98, 8, 103, 96, 228, 60, 198], 'errors': [], 'warnings': [] }, 'temperatures': [21.46, 21.51] }

- description: Unknown FPort
input:
fPort: 42
bytes: [0x0E, 0x55, 0x01, 0x08, 0x62, 0x08, 0x67, 0x60, 0xE4, 0x3C, 0xC6]
output:
errors:
- unknown FPort
52 changes: 52 additions & 0 deletions vendor/smartrural/grain-probe-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
60 changes: 60 additions & 0 deletions vendor/smartrural/grain-probe.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@

function bytes2float(byte0, byte1, byte2, byte3) {
var bits = (byte0 << 24) | (byte1 << 16) | (byte2 << 8) | (byte3);
var sign = ((bits >>> 31) === 0) ? 1.0 : -1.0;
var e = ((bits >>> 23) & 0xff);
var m = (e === 0) ? (bits & 0x7fffff) << 1 : (bits & 0x7fffff) | 0x800000;
var f = sign * m * Math.pow(2, e - 150);
return f;
}
function decodeUplink(input) {
var port = input.fPort;
var bytes = input.bytes;
var poll_message_status=(bytes[2]&0x40)>>6;
var data = {};
switch (input.fPort) {
case 2:

if(poll_message_status===0)
{
data.Ext= bytes[2]&0x0F;
data.BatV= ((bytes[0]<<8 | bytes[1]) & 0x3FFF)/1000;

if(data.Ext==0x01)
{
data.Temp_Channel1=parseFloat(((bytes[3]<<24>>16 | bytes[4])/100).toFixed(2));
data.Temp_Channel2=parseFloat(((bytes[5]<<24>>16 | bytes[6])/100).toFixed(2));
}
else if(data.Ext==0x02)
{
data.Temp_Channel1=parseFloat(((bytes[3]<<24>>16 | bytes[4])/10).toFixed(1));
data.Temp_Channel2=parseFloat(((bytes[5]<<24>>16 | bytes[6])/10).toFixed(1));
}
else if(data.Ext==0x03)
{
data.Res_Channel1=parseFloat(((bytes[3]<<8 | bytes[4])/100).toFixed(2));
data.Res_Channel2=parseFloat(((bytes[5]<<8 | bytes[6])/100).toFixed(2));
}

data.Systimestamp=(bytes[7]<<24 | bytes[8]<<16 | bytes[9]<<8 | bytes[10] );
}

return {
data:{
"temperatures": [data.Temp_Channel1,data.Temp_Channel2],
"Systimestamp": data.Systimestamp,
"Ext": data.Ext,
"battery": data.BatV,
"debug": {
bytes: input.bytes,
warnings: [],
errors: []
}
}
};
default:
return {
errors: ["unknown FPort"]
}
}
}
5 changes: 5 additions & 0 deletions vendor/smartrural/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)
- grain-probe-01 # look in grain-probe-01.yaml for the end device definition

0 comments on commit 80c0f68

Please sign in to comment.