Compare commits
No commits in common. "1fb3511ed55a8ac9b1f539c9c5313f1b465852ca" and "02db62725d6519d703175cc7b39bea7ebe6741a9" have entirely different histories.
1fb3511ed5
...
02db62725d
@ -47,24 +47,6 @@ class TempWebServer:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Web server error: {e}")
|
print(f"Web server error: {e}")
|
||||||
|
|
||||||
def _save_config_to_file(self, ac_monitor, heater_monitor):
|
|
||||||
"""Save current settings to config.json file."""
|
|
||||||
try:
|
|
||||||
import json
|
|
||||||
config = {
|
|
||||||
'ac_target': ac_monitor.target_temp,
|
|
||||||
'ac_swing': ac_monitor.temp_swing,
|
|
||||||
'heater_target': heater_monitor.target_temp,
|
|
||||||
'heater_swing': heater_monitor.temp_swing
|
|
||||||
}
|
|
||||||
with open('config.json', 'w') as f:
|
|
||||||
json.dump(config, f)
|
|
||||||
print("Settings saved to config.json")
|
|
||||||
return True
|
|
||||||
except Exception as e:
|
|
||||||
print("Error saving config: {}".format(e))
|
|
||||||
return False
|
|
||||||
|
|
||||||
def _handle_update(self, request, sensors, ac_monitor, heater_monitor):
|
def _handle_update(self, request, sensors, ac_monitor, heater_monitor):
|
||||||
"""Handle form submission and update settings."""
|
"""Handle form submission and update settings."""
|
||||||
try:
|
try:
|
||||||
@ -80,11 +62,11 @@ class TempWebServer:
|
|||||||
# Update AC settings
|
# Update AC settings
|
||||||
if 'ac_target' in params and ac_monitor:
|
if 'ac_target' in params and ac_monitor:
|
||||||
ac_monitor.target_temp = params['ac_target']
|
ac_monitor.target_temp = params['ac_target']
|
||||||
print("AC target updated to {}°F".format(params['ac_target']))
|
print(f"AC target updated to {params['ac_target']}°F")
|
||||||
|
|
||||||
if 'ac_swing' in params and ac_monitor:
|
if 'ac_swing' in params and ac_monitor:
|
||||||
ac_monitor.temp_swing = params['ac_swing']
|
ac_monitor.temp_swing = params['ac_swing']
|
||||||
print("AC swing updated to {}°F".format(params['ac_swing']))
|
print(f"AC swing updated to {params['ac_swing']}°F")
|
||||||
|
|
||||||
# Update heater settings
|
# Update heater settings
|
||||||
if 'heater_target' in params and heater_monitor:
|
if 'heater_target' in params and heater_monitor:
|
||||||
@ -95,10 +77,6 @@ class TempWebServer:
|
|||||||
heater_monitor.temp_swing = params['heater_swing']
|
heater_monitor.temp_swing = params['heater_swing']
|
||||||
print("Heater swing updated to {}°F".format(params['heater_swing']))
|
print("Heater swing updated to {}°F".format(params['heater_swing']))
|
||||||
|
|
||||||
# Save settings to file
|
|
||||||
if self._save_config_to_file(ac_monitor, heater_monitor):
|
|
||||||
print("Settings persisted to disk")
|
|
||||||
|
|
||||||
# Send Discord notification
|
# Send Discord notification
|
||||||
from scripts.discord_webhook import send_discord_message
|
from scripts.discord_webhook import send_discord_message
|
||||||
ac_target_str = str(params.get('ac_target', 'N/A'))
|
ac_target_str = str(params.get('ac_target', 'N/A'))
|
||||||
|
|||||||
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"ac_target": 77.0,
|
|
||||||
"ac_swing": 1.0,
|
|
||||||
"heater_target": 80.0,
|
|
||||||
"heater_swing": 2.0
|
|
||||||
}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user