diff --git a/conversions/humidity.js b/conversions/humidity.js new file mode 100644 index 0000000..cef4447 --- /dev/null +++ b/conversions/humidity.js @@ -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 + } + }] + }] + }] +} + diff --git a/conversions/pressure.js b/conversions/pressure.js new file mode 100644 index 0000000..fcfa77e --- /dev/null +++ b/conversions/pressure.js @@ -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 + } + }] + }] + }] +}