mirror of
https://github.com/oasis6212/Meshbot_weather.git
synced 2025-12-10 08:33:51 -06:00
added node shutdown disable
This commit is contained in:
parent
dd87bb2802
commit
695ef24cf9
@ -418,7 +418,8 @@ def signal_handler(sig, frame):
|
|||||||
logger.info("\nInitiating shutdown...")
|
logger.info("\nInitiating shutdown...")
|
||||||
try:
|
try:
|
||||||
if interface is not None:
|
if interface is not None:
|
||||||
# logger.info("Sending shutdown command to node...")
|
if settings.get('SHUTDOWN_NODE_ON_EXIT', false):
|
||||||
|
logger.info("Sending shutdown command to node...")
|
||||||
try:
|
try:
|
||||||
# Send shutdown command
|
# Send shutdown command
|
||||||
interface.localNode.shutdown()
|
interface.localNode.shutdown()
|
||||||
@ -428,13 +429,17 @@ def signal_handler(sig, frame):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error sending shutdown command: {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...")
|
logger.info("Closing Meshtastic interface...")
|
||||||
interface.close()
|
interface.close()
|
||||||
logger.info("Shutdown complete")
|
logger.info("Shutdown complete")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error during shutdown: {e}")
|
logger.error(f"Error sending shutdown command: {e}")
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
global interface, alerts # Add alerts to global declaration
|
global interface, alerts # Add alerts to global declaration
|
||||||
signal.signal(signal.SIGINT, signal_handler)
|
signal.signal(signal.SIGINT, signal_handler)
|
||||||
|
|||||||
@ -4,13 +4,13 @@ MYNODES:
|
|||||||
FIREWALL: false # If true, only responds to node ids listed under "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
|
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
|
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_OFFICE: "LOX" # Location settings for the weather forecast api calls, see readme for details
|
||||||
NWS_GRID_X: "84"
|
NWS_GRID_X: "155"
|
||||||
NWS_GRID_Y: "89"
|
NWS_GRID_Y: "45"
|
||||||
USER_AGENT_APP: "myweatherapp" # Used for NWS API calls, can be whatever you want, more unique the better.
|
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
|
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_LAT: "34.0522" # Location settings for alerts, use your coordinates. No more than 4 digits past the decimal point
|
||||||
ALERT_LON: "-101.7526"
|
ALERT_LON: "-118.2433"
|
||||||
ALERT_CHECK_INTERVAL: 300 # Time in seconds between alert checks (default: 300 = 5 minutes)
|
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.
|
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
|
MESSAGE_DELAY: 15 # Delay in seconds between subsequent messages of a multi-message response
|
||||||
@ -24,3 +24,4 @@ ENABLE_AUTO_REBOOT: false # Set to true to enable automatic daily reboot of the
|
|||||||
AUTO_REBOOT_HOUR: 3 # Hour for daily reboot (24-hour format)
|
AUTO_REBOOT_HOUR: 3 # Hour for daily reboot (24-hour format)
|
||||||
AUTO_REBOOT_MINUTE: 0 # Minute for daily reboot
|
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