events.py 632 B

123456789101112131415161718192021222324
  1. # -*- coding: utf-8 -*-
  2. from typing import Callable, Optional
  3. from fastapi import FastAPI
  4. from app.controllers.equipment.events import (
  5. regulate_ahu_freq,
  6. regulate_ahu_switch,
  7. regulate_pau_switch,
  8. regulate_ventilation_fan_switch
  9. )
  10. from app.controllers.events import load_q_learning_model
  11. def create_start_app_handler(app: Optional[FastAPI] = None) -> Callable:
  12. async def start_app() -> None:
  13. await load_q_learning_model()
  14. await regulate_ahu_freq()
  15. await regulate_ahu_switch()
  16. await regulate_pau_switch()
  17. await regulate_ventilation_fan_switch()
  18. return start_app