diff --git a/src/_EMR/panel.sh b/src/_EMR/panel.sh index d05f044..3cf862e 100755 --- a/src/_EMR/panel.sh +++ b/src/_EMR/panel.sh @@ -21,6 +21,7 @@ while true; do echo "# 6. Stop Auger Loop #" echo "# #" echo "# 7. Restart Auger Loop #" + echo "# 8. Edit ENV Variables #" echo "###################################" echo "# 0. Exit #" echo "###################################" @@ -65,6 +66,11 @@ while true; do echo "Restarting Auger Loop" pm2 restart hestia-emr ;; + 8) + echo "Editing ENV Variables" + cd $ROOT_PATH + nano .env + ;; 0) echo "Exiting" exit diff --git a/src/custom_modules/config.json b/src/custom_modules/config.json index bd815fe..d12655c 100644 --- a/src/custom_modules/config.json +++ b/src/custom_modules/config.json @@ -1,6 +1,6 @@ { "mqtt": { - "address": "wss://127.0.0.1", + "address": "wss://192.168.0.12", "port": 9001, "topics": { "igniter": "hestia/status/igniter", @@ -62,6 +62,6 @@ "exhaustDelay": 600000 } }, - "gpioScript": "src/python/gpio_interface.py", + "gpioScript": "src/python/fake_gpio_interface.py", "augerTotalCycleTime": 2000 } \ No newline at end of file diff --git a/src/custom_modules/functions.js b/src/custom_modules/functions.js index 640299c..533d760 100644 --- a/src/custom_modules/functions.js +++ b/src/custom_modules/functions.js @@ -47,11 +47,12 @@ module.exports = { const promises = pins.map(pin => { if (pin.mode === 'OUT') { return gpio.setPin(pin.board, pin.defaultState).then(() => { - stateChanges.push(`Set ${pin.key} pin to ${pin.defaultState}.`); + stateChanges.push(` -- Set Defaults: Set ${pin.key} pin to ${pin.defaultState}.`); state[pin.key].power(comlink, pin.defaultState); + // Wait a second and check the pin states setTimeout(() => { gpio.readPin(pin.board).then(pinState => { - module.exports.log(`Read Pin: ${pin.key} is ${pinState}`); + module.exports.log(`Set Defaults: Confirm Pin: ${pin.key} is ${pinState}`, 'DEBUG'); }).catch(e => console.error(e)); }, 1000); }).catch(e => console.error(e)); @@ -60,7 +61,7 @@ module.exports = { const boolState = pinState === '1' ? true : false; state[pin.key].on = boolState; comlink.send(config.mqtt.topics[pin.key], JSON.stringify(state[pin.key])); - stateChanges.push(`${pin.key}: ${state}`); + stateChanges.push(` -- Set Defaults: Read: ${pin.key}: ${pinState} [Old: ${state[pin.key].on}]`); }).catch(e => console.error(e)); } }); @@ -72,10 +73,10 @@ module.exports = { }); }, async init(comlink, state) { - module.exports.log('Resetting all output pins.'); + module.exports.log('GPIO Init: Resetting all output pins.'); module.exports.gpio.setDefaults(comlink, state).then((changes) => { - module.exports.log(changes); - }).catch(e => console.error(e)); + module.exports.log(`GPIO Init:\n${changes}`); + }).catch(e => console.error(`GPIO Init: ${e}`)); } }, routines: {