implementace LED loxone u zaporncyh cen
Some checks failed
CI and deploy / migration-check (push) Failing after 10s
CI and deploy / deploy (push) Has been skipped

This commit is contained in:
Dusan Vojacek
2026-04-26 22:49:47 +02:00
parent 1d04790f28
commit 50a0ca95f4
7 changed files with 1027 additions and 89 deletions

View File

@@ -26,6 +26,10 @@ from services.heartbeat_service import send_heartbeat
from services.notification_service import notify_operating_mode_changed
from services.price_importer import import_ote_prices, ote_prague_day_slots_look_complete
from services.telemetry_collector import run_telemetry_loop_wrapper
from services.signal_service import (
run_signal_outbound_send_for_active_sites,
run_signal_outbound_verify_for_active_sites,
)
logger = logging.getLogger(__name__)
@@ -145,6 +149,18 @@ async def lifespan(app: FastAPI):
"scheduled_control_export site=%s: %s", site["id"], e
)
async def scheduled_signal_outbound_send() -> None:
try:
await run_signal_outbound_send_for_active_sites(app.state.pg_pool)
except Exception:
logger.exception("scheduled_signal_outbound_send failed")
async def scheduled_signal_outbound_verify() -> None:
try:
await run_signal_outbound_verify_for_active_sites(app.state.pg_pool)
except Exception:
logger.exception("scheduled_signal_outbound_verify failed")
async def scheduled_verify_modbus() -> None:
"""
Ověří příkazy ve stavu written z posledních 20 minut.
@@ -362,6 +378,20 @@ async def lifespan(app: FastAPI):
id="verify_modbus",
replace_existing=True,
)
scheduler.add_job(
scheduled_signal_outbound_send,
"interval",
seconds=15,
id="signal_outbound_send",
replace_existing=True,
)
scheduler.add_job(
scheduled_signal_outbound_verify,
"interval",
seconds=15,
id="signal_outbound_verify",
replace_existing=True,
)
scheduler.add_job(scheduled_daily_plan, "cron", hour=15, minute=0, id="daily_plan")
scheduler.add_job(
scheduled_rolling_replan,