mirror of
https://github.com/oasis6212/Meshbot_weather.git
synced 2025-12-10 00:06:12 -06:00
added node shutdown disable
This commit is contained in:
parent
dd87bb2802
commit
695ef24cf9
27
meshbot.py
27
meshbot.py
@ -418,23 +418,28 @@ def signal_handler(sig, frame):
|
||||
logger.info("\nInitiating shutdown...")
|
||||
try:
|
||||
if interface is not None:
|
||||
# logger.info("Sending shutdown command to node...")
|
||||
try:
|
||||
# Send shutdown command
|
||||
interface.localNode.shutdown()
|
||||
# Give the node sufficient time to complete its shutdown process
|
||||
logger.info("Waiting for node to complete shutdown...")
|
||||
time.sleep(17) # Time delay for node to finish shutting down
|
||||
except Exception as e:
|
||||
logger.error(f"Error sending shutdown command: {e}")
|
||||
|
||||
if settings.get('SHUTDOWN_NODE_ON_EXIT', false):
|
||||
logger.info("Sending shutdown command to node...")
|
||||
try:
|
||||
# Send shutdown command
|
||||
interface.localNode.shutdown()
|
||||
# Give the node sufficient time to complete its shutdown process
|
||||
logger.info("Waiting for node to complete shutdown...")
|
||||
time.sleep(17) # Time delay for node to finish shutting down
|
||||
except Exception as e:
|
||||
logger.error(f"Error sending shutdown command: {e}")
|
||||
|
||||
else:
|
||||
logger.info("Node shutdown disabled in settings, skipping shutdown command")
|
||||
|
||||
logger.info("Closing Meshtastic interface...")
|
||||
interface.close()
|
||||
logger.info("Shutdown complete")
|
||||
except Exception as e:
|
||||
logger.error(f"Error during shutdown: {e}")
|
||||
logger.error(f"Error sending shutdown command: {e}")
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
def main():
|
||||
global interface, alerts # Add alerts to global declaration
|
||||
signal.signal(signal.SIGINT, signal_handler)
|
||||
|
||||
@ -4,13 +4,13 @@ MYNODES:
|
||||
FIREWALL: false # If true, only responds to node ids listed under "MYNODES:"
|
||||
DM_MODE: true # If true, bot responds to direct messages only. Recommend not changing this
|
||||
DUTYCYCLE: false # If true, will limit to 10% duty cycle
|
||||
NWS_OFFICE: "BGM" # Location settings for the weather forecast api calls, see readme for details
|
||||
NWS_GRID_X: "84"
|
||||
NWS_GRID_Y: "89"
|
||||
NWS_OFFICE: "LOX" # Location settings for the weather forecast api calls, see readme for details
|
||||
NWS_GRID_X: "155"
|
||||
NWS_GRID_Y: "45"
|
||||
USER_AGENT_APP: "myweatherapp" # Used for NWS API calls, can be whatever you want, more unique the better.
|
||||
USER_AGENT_EMAIL: "contact@example.com" # Your email, in the event NWS detects excess api calls they can contact you
|
||||
ALERT_LAT: "37.9807" # Location settings for alerts, use your coordinates. No more than 4 digits past the decimal point
|
||||
ALERT_LON: "-101.7526"
|
||||
ALERT_LAT: "34.0522" # Location settings for alerts, use your coordinates. No more than 4 digits past the decimal point
|
||||
ALERT_LON: "-118.2433"
|
||||
ALERT_CHECK_INTERVAL: 300 # Time in seconds between alert checks (default: 300 = 5 minutes)
|
||||
FIRST_MESSAGE_DELAY: 0 # Delay in seconds between receiving a request and sending the first message back.
|
||||
MESSAGE_DELAY: 15 # Delay in seconds between subsequent messages of a multi-message response
|
||||
@ -23,4 +23,5 @@ FULL_MENU: true # When true, includes all weather commands. When false, shows o
|
||||
ENABLE_AUTO_REBOOT: false # Set to true to enable automatic daily reboot of the connected node
|
||||
AUTO_REBOOT_HOUR: 3 # Hour for daily reboot (24-hour format)
|
||||
AUTO_REBOOT_MINUTE: 0 # Minute for daily reboot
|
||||
REBOOT_DELAY_SECONDS: 10 # Delay in seconds before reboot occurs (recommend not changing this)
|
||||
REBOOT_DELAY_SECONDS: 10 # Delay in seconds before reboot occurs (recommend not changing this)
|
||||
SHUTDOWN_NODE_ON_EXIT: false #Set to true to shut down the node when you close the program
|
||||
Loading…
x
Reference in New Issue
Block a user