feat: Implement immediate application of active schedule on startup and enhance schedule resume handling

Fixes #24
This commit is contained in:
2025-11-09 12:25:16 -05:00
parent 229bde85e9
commit b346be9431
2 changed files with 27 additions and 1 deletions

18
main.py
View File

@@ -297,6 +297,24 @@ schedule_monitor = ScheduleMonitor(
config=config, # Pass config with schedules
interval=60 # Check schedule every 60 seconds
)
# ===== APPLY ACTIVE SCHEDULE IMMEDIATELY ON STARTUP =====
if config.get('schedule_enabled', False):
try:
# Find and apply the current active schedule
active_schedule = schedule_monitor._find_active_schedule()
if active_schedule:
schedule_monitor._apply_schedule(active_schedule)
print("✅ Active schedule applied on startup: {}".format(
active_schedule.get('name', 'Unnamed')
))
else:
print(" No active schedule found (using manual targets)")
except Exception as e:
print("⚠️ Warning: Could not apply startup schedule: {}".format(e))
else:
print(" Schedules disabled - using manual targets")
# ===== END: APPLY ACTIVE SCHEDULE ON STARTUP =====
# ===== END: Schedule Monitor Setup =====
# ===== START: Print Current Settings =====