Refactor TemperatureMonitor logging to remove sensor ID and simplify log format; update ScheduleMonitor to indicate HOLD mode when scheduling is disabled.

This commit is contained in:
Aaron 2025-11-05 22:31:49 -05:00
parent 33e2944fd8
commit 2c10fdff62
2 changed files with 3 additions and 6 deletions

View File

@ -146,10 +146,6 @@ class TemperatureMonitor(Monitor):
def _log_temperature(self, temp):
"""Log temperature to CSV file."""
try:
# Get sensor ID
sensor_ids = self.sensor.get_sensor_ids()
sensor_id = sensor_ids[0] if sensor_ids else "unknown"
# Get timestamp
t = time.localtime()
timestamp = "{:04d}-{:02d}-{:02d} {:02d}:{:02d}:{:02d}".format(
@ -158,8 +154,8 @@ class TemperatureMonitor(Monitor):
# Append to log file
with open(self.log_file, 'a') as f:
f.write("{},{},{},{:.2f}\n".format(
timestamp, self.label, sensor_id, temp
f.write("{},{},{:.2f}\n".format(
timestamp, self.label, temp
))
except Exception as e:
print("Error logging temperature: {}".format(e))

View File

@ -47,6 +47,7 @@ class ScheduleMonitor:
def _find_active_schedule(self):
"""Find which schedule should be active right now."""
if not self.config.get('schedule_enabled', False):
# Schedule is disabled (HOLD mode)
return None
schedules = self.config.get('schedules', [])