Skip to content

Commit

Permalink
feature: add humidity (130313) and pressure pressure (#88)
Browse files Browse the repository at this point in the history
closes #87
  • Loading branch information
sbender9 authored Dec 22, 2023
1 parent d7060cc commit 9035283
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 0 deletions.
61 changes: 61 additions & 0 deletions conversions/humidity.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@

module.exports = (app, plugin) => {
return [{
pgn: 130313,
title: 'Outside Humidity (PGN130313)',
optionKey: 'HUMIDITY_OUTSIDE',
keys: [
"environment.outside.relativeHumidity"
],
callback: (humidity) => {
return [{
pgn: 130313,
"Instance": 100,
"Source": "Outside",
"Actual Humidity": humidity,
}]
},
tests: [{
input: [ .50 ],
expected: [{
"prio": 2,
"pgn": 130313,
"dst": 255,
"fields": {
"Instance": 100,
"Source": "Outside",
"Actual Humidity": .50
}
}]
}]
}, {
pgn: 130313,
title: 'Inside Humidity (PGN130313)',
optionKey: 'HUMIDITY_INSIDE',
keys: [
"environment.inside.relativeHumidity"
],
callback: (humidity) => {
return [{
pgn: 130313,
"Instance": 100,
"Source": "Inside",
"Actual Humidity": humidity,
}]
},
tests: [{
input: [ 1.0 ],
expected: [{
"prio": 2,
"pgn": 130313,
"dst": 255,
"fields": {
"Instance": 100,
"Source": "Inside",
"Actual Humidity": 1.0
}
}]
}]
}]
}

37 changes: 37 additions & 0 deletions conversions/pressure.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@


let pressMessage = (pres, src) => {
return [{
pgn: 130314,
"Instance": 100,
"Source": src,
"Pressure": pres,
}]
}

module.exports = (app, plugin) => {
return [{
pgn: 130314,
title: 'Atmospheric Pressure (130314)',
optionKey: 'PRESSURE_ATMOSPHERIC',
keys: [
"environment.outside.pressure"
],
callback: (pressure) => {
return pressMessage(pressure, 'Atmospheric')
},
tests: [{
input: [ 103047.8 ],
expected: [{
"prio": 2,
"pgn": 130314,
"dst": 255,
"fields": {
"Instance": 100,
"Source": "Atmospheric",
"Pressure": 103047.8
}
}]
}]
}]
}

0 comments on commit 9035283

Please sign in to comment.