work: Добваил нагрев в автоматизацию

This commit is contained in:
Fedorov Dmitriy
2026-09-19 18:09:03 +03:00
parent bff8efb85b
commit c6d92c10ee
19 changed files with 2661 additions and 91 deletions
+16 -11
View File
@@ -26,6 +26,8 @@ from app.auto import (
load_auto_config,
)
from app.auto.temperature_policy import TemperaturePolicy
from app.tion import (
TionController,
TionService,
@@ -108,9 +110,7 @@ async def lifespan(app: FastAPI):
schedule_load_error = None
try:
auto_config = load_auto_config(
AUTO_CONFIG_FILE
)
auto_config = load_auto_config(AUTO_CONFIG_FILE)
auto_policy = Co2SpeedPolicy(
base_speed=(
@@ -124,14 +124,15 @@ async def lifespan(app: FastAPI):
),
)
auto_interval = (
auto_config.check_interval
)
temperature_policy = TemperaturePolicy(auto_config.temperature)
auto_interval = (auto_config.check_interval)
auto_load_error = None
except Exception as exc:
auto_policy = None
temperature_policy = None
# Безопасный встроенный интервал нужен,
# потому что auto.yaml сейчас недоступен.
@@ -146,6 +147,7 @@ async def lifespan(app: FastAPI):
qingping_service=qingping_service,
tion_service=service,
policy=auto_policy,
temperature_policy=temperature_policy,
interval=auto_interval,
)
@@ -336,6 +338,8 @@ def get_schedule_status() -> dict:
"current": None,
"next": None,
"auto_active": False,
"auto_fallback_speed": None,
"auto_target_temp": None,
"override_active": False,
"override_until": None,
"override_settings": {},
@@ -393,11 +397,12 @@ def get_schedule_status() -> dict:
"next": occurrence_to_dict(resolution.next),
"auto_active": resolution.auto_active,
"scheduled_settings": (
resolution
.scheduled_settings
.to_dict()
),
"auto_fallback_speed": resolution.auto_fallback_speed,
"auto_target_temp": resolution.auto_target_temp,
"scheduled_settings": resolution.scheduled_settings.to_dict(),
"override_active":schedule_service.override_active,