-
Notifications
You must be signed in to change notification settings - Fork 389
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Johan Stokking <[email protected]>
- Loading branch information
1 parent
a1ab482
commit de6a2c2
Showing
8 changed files
with
323 additions
and
0 deletions.
There are no files selected for viewing
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
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,61 @@ | ||
# 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: ath20.js | ||
# Examples (optional) | ||
examples: | ||
- description: Temperature | ||
input: | ||
fPort: 2 | ||
bytes: [0x00, 0x01, 0x1F, 0x02, 0x0B, 0x01, 0x32, 0x00, 0x00, 0x00, 0x01] | ||
output: | ||
data: { 'Bat': 3.1, 'Humi': 52.3, 'Temp': 30.6 } | ||
# # Normalized output, uses the normalizeUplink function (optional) | ||
# normalizedOutput: | ||
# data: | ||
# - air: | ||
# location: 'indoor' | ||
# temperature: 30.6 | ||
# relativeHumidity: 52.3 | ||
# - air: | ||
# location: 'outdoor' | ||
# temperature: 27.81 | ||
# battery: 3.062 | ||
|
||
# - description: Unknown FPort | ||
# input: | ||
# fPort: 42 | ||
# bytes: [0x00, 0x01, 0x1F, 0x02, 0x0B, 0x01, 0x32, 0x00, 0x00, 0x00, 0x01] | ||
# output: | ||
# errors: | ||
# - unknown FPort | ||
|
||
# Downlink encoder encodes JSON object into a binary data downlink (optional) | ||
downlinkEncoder: | ||
fileName: ath20.js | ||
examples: | ||
- description: Change Reporting interval | ||
input: | ||
data: | ||
minutes: 10 | ||
output: | ||
bytes: [0x00, 0x00, 0x02, 0x58] | ||
fPort: 1 | ||
# - 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: Air-Temperature-and-Humidity-Sensor.js | ||
# examples: | ||
# - description: Turn green | ||
# input: | ||
# fPort: 2 | ||
# bytes: [1] | ||
# output: | ||
# data: | ||
# led: green |
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,54 @@ | ||
function decodeUplink(input) { | ||
|
||
// var num = input.bytes[0] * 256 + input.bytes[1] | ||
var bat = input.bytes[2] / 10.0 | ||
var humi = (input.bytes[3] * 256 + input.bytes[4]) / 10.0 | ||
// var temp = (input.bytes[5] * 256 + input.bytes[6] ) / 10.0 | ||
|
||
var temp = input.bytes[5] * 256 + input.bytes[6] | ||
if (temp >= 0x8000) { | ||
temp -= 0x10000; | ||
} | ||
temp = temp / 10.0 | ||
|
||
|
||
return { | ||
data: { | ||
Bat: bat, | ||
Humi: humi, | ||
Temp: temp, | ||
}, | ||
|
||
}; | ||
} | ||
|
||
|
||
|
||
// Encoder function to be used in the TTN console for downlink payload | ||
function encodeDownlink(input) { | ||
var minutes = input.data.minutes; | ||
|
||
// Converting minutes to seconds | ||
var seconds = minutes * 60; | ||
|
||
// If the number of seconds is less than 300 seconds, set it to 300 seconds | ||
if (seconds < 300) { | ||
seconds = 300; | ||
} | ||
var bytes1 = (seconds >> 24) & 0xFF; | ||
var bytes2 = (seconds >> 16) & 0xFF; | ||
var bytes3 = (seconds >> 8) & 0xFF; | ||
var bytes4 = seconds & 0xFF; | ||
|
||
// var payload = [ | ||
// (seconds >> 24) & 0xFF, | ||
// (seconds >> 16) & 0xFF, | ||
// (seconds >> 8) & 0xFF, | ||
// seconds & 0xFF | ||
// ]; | ||
|
||
return { | ||
bytes: [bytes1,bytes2,bytes3,bytes4], | ||
fPort: 1, | ||
}; | ||
} |
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,109 @@ | ||
name: ath20 - air-temperature-and-humidity-sensor # Device name can not contain the vendor name | ||
description: LoRaWAN Temperature & Humidity sensor | ||
|
||
# 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: '2.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. | ||
# vendorID: example | ||
# Identifier of the profile (lowercase, alphanumeric with dashes, max 36 characters) | ||
id: eu868-profile | ||
lorawanCertified: true | ||
codec: ath20-codec | ||
US902-928: | ||
id: us915-profile | ||
lorawanCertified: true | ||
codec: ath20-codec | ||
|
||
# - # You can add more firmware versions and use different profiles per version | ||
# version: '2.0' | ||
# numeric: 2 | ||
# hardwareVersions: | ||
# - '1.0-rev-A' | ||
# profiles: | ||
# EU863-870: | ||
# id: windsensor-profile | ||
# lorawanCertified: true | ||
# codec: windsensor-codec | ||
# US902-928: | ||
# id: windsensor-profile | ||
# lorawanCertified: true | ||
# codec: windsensor-codec | ||
# AS923: | ||
# id: windsensor-profile | ||
# codec: windsensor-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, | ||
# digital output, dissolved oxygen, distance, dust, energy, gps, gyroscope, h2s, hall effect, humidity, iaq, infrared, leaf wetness, level, | ||
# light, lightning, link, magnetometer, moisture, motion, nfc, no, no2, o3, occupancy, optical meter, particulate matter, ph, pir, | ||
# pm2.5, pm10, potentiometer, power, precipitation, pressure, proximity, pulse count, pulse frequency, radar, rainfall, reed switch, rssi, | ||
# sap flow, smart valve, smoke, snr, so2, solar radiation, sound, strain, surface temperature, switch, temperature, tilt, time, turbidity, | ||
# tvoc, uv, vapor pressure, velocity, vibration, voltage, water potential, water, weight, wifi ssid, wind direction, wind speed. | ||
sensors: | ||
- temperature | ||
- humidity | ||
|
||
# Operating conditions (optional) | ||
operatingConditions: | ||
# Temperature (Celsius) | ||
temperature: | ||
min: -40 | ||
max: 85 | ||
# Relative humidity (fraction of 1) | ||
relativeHumidity: | ||
min: 0 | ||
max: 1 | ||
|
||
# # IP rating (optional) | ||
# ipCode: IP68 | ||
|
||
# Product and data sheet URLs (optional) | ||
productURL: https://www.agrosense.cc/pd.jsp?recommendFromPid=0&id=6&fromMid=366 | ||
dataSheetURL: https://github.com/Makerfabs/Agrosense-Decoder/blob/main/AgroSense%20LoRaWAN%40%20Sensor%20Catalogue_V1.0.pdf | ||
|
||
# Commercial information | ||
sellerURLs: | ||
- name: 'makerfabs' | ||
region: # valid regions are: Argentina, Australia, Brazil, Canada, China, European Union, India, Indonesia. | ||
# Japan, Mexico, Russia, Saudi Arabia, South Africa, South Korea, Turkey, United States, United Kingdom, Other | ||
- china | ||
url: http://www.makerfabs.com/ | ||
|
||
# Photos | ||
photos: | ||
main: ath20.jpg # Image needs to have a transparent background | ||
# other: | ||
# - windsensor-package.png # Image needs to have a transparent background | ||
|
||
# Youtube or Vimeo Video (optional) | ||
videos: | ||
main: https://www.youtube.com/watch?v=SXF6HpzQwL0 |
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,47 @@ | ||
# 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 |
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,2 @@ | ||
endDevices: | ||
- ath20 |
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,47 @@ | ||
# 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: 20 | ||
# 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 |