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": { "topics": {
"igniter": "hestia/status/igniter", "igniter": "hestia/status/igniter",
"exhaust": "hestia/status/exhaust", "exhaust": "hestia/status/exhaust",
"auger": "hestia/status/auger" "auger": "hestia/status/auger",
"pof": "hestia/status/pof",
"vacuum": "hestia/status/vacuum"
} }
}, },
"states": { "states": {
"elements": [ "elements": [
"igniter", "igniter",
"exhaust", "exhaust",
"auger" "auger",
"pof",
"vacuum"
] ]
}, },
"pins": [ "pins": [

View File

@ -29,6 +29,13 @@ module.exports = {
stateChanges.push(`Set ${pin.key} pin to ${pin.defaultState}.`); stateChanges.push(`Set ${pin.key} pin to ${pin.defaultState}.`);
state[pin.key].power(communicator, pin.defaultState); state[pin.key].power(communicator, pin.defaultState);
}).catch(e => console.error(e)); }).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));
} }
}); });