From 42b5576be5c84592a5d5e0046bdf882a4fb47216 Mon Sep 17 00:00:00 2001 From: Skylar Grant Date: Thu, 22 Aug 2024 20:34:17 -0400 Subject: [PATCH] Minor fixes --- src/custom_modules/config.json | 8 ++++++-- src/custom_modules/functions.js | 7 +++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/custom_modules/config.json b/src/custom_modules/config.json index 8868f05..8180f95 100644 --- a/src/custom_modules/config.json +++ b/src/custom_modules/config.json @@ -6,14 +6,18 @@ "topics": { "igniter": "hestia/status/igniter", "exhaust": "hestia/status/exhaust", - "auger": "hestia/status/auger" + "auger": "hestia/status/auger", + "pof": "hestia/status/pof", + "vacuum": "hestia/status/vacuum" } }, "states": { "elements": [ "igniter", "exhaust", - "auger" + "auger", + "pof", + "vacuum" ] }, "pins": [ diff --git a/src/custom_modules/functions.js b/src/custom_modules/functions.js index 0ed8fb8..63142ff 100644 --- a/src/custom_modules/functions.js +++ b/src/custom_modules/functions.js @@ -29,6 +29,13 @@ module.exports = { stateChanges.push(`Set ${pin.key} pin to ${pin.defaultState}.`); state[pin.key].power(communicator, pin.defaultState); }).catch(e => console.error(e)); + } else if (pin.mode === 'IN') { + return gpio.readPin(pin.board).then(pinState => { + const boolState = pinState === '1' ? true : false; + state[pin.key].on = boolState; + communicator.send(config.mqtt.topics[pin.key], JSON.stringify(state[pin.key])); + stateChanges.push(`${pin.key}: ${state}`); + }).catch(e => console.error(e)); } });