Minor fixes

This commit is contained in:
Skylar Grant 2024-08-22 20:34:17 -04:00
parent 6276a51f05
commit 42b5576be5
2 changed files with 13 additions and 2 deletions

View File

@ -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": [

View File

@ -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));
}
});