feat: Reset hold modes to automatic on boot and save configuration

This commit is contained in:
Aaron 2025-11-08 16:39:49 -05:00
parent 3e926f997b
commit 64a5d0ae7e

16
main.py
View File

@ -95,6 +95,22 @@ def load_config():
# Load configuration from file
config = load_config()
# ===== START: Reset hold modes on startup =====
# Always reset to automatic mode on boot (don't persist hold states)
if 'schedule_enabled' in config:
config['schedule_enabled'] = True # Always enable schedules on boot
if 'permanent_hold' in config:
config['permanent_hold'] = False # Always clear permanent hold on boot
# Save the reset config immediately
try:
with open('config.json', 'w') as f:
json.dump(config, f)
print("✅ Hold modes reset - Automatic mode active")
except Exception as e:
print("⚠️ Warning: Could not save config reset: {}".format(e))
# ===== END: Reset hold modes on startup =====
# ===== END: Configuration Loading =====
# ===== START: WiFi Connection =====