|
@@ -1,12 +1,16 @@
|
|
|
-from fastapi import APIRouter, BackgroundTasks, Query
|
|
|
+from fastapi import APIRouter, BackgroundTasks, Depends, Query
|
|
|
+from loguru import logger
|
|
|
+from sqlalchemy.orm import Session
|
|
|
|
|
|
+from app.api.dependencies.db import get_db
|
|
|
from app.controllers.equipment.ahu.supply_air_temperature_set import get_next_supply_air_temperature_set
|
|
|
from app.controllers.equipment.ahu.thermal_mode import get_thermal_mode
|
|
|
+from app.controllers.equipment.fcu.early_start import get_recommended_early_start_time
|
|
|
from app.controllers.equipment.fcu.on_ratio import start_on_ratio_mode
|
|
|
from app.controllers.equipment.pau.switch import get_switch_action
|
|
|
from app.controllers.equipment.pau.supply_air_temperature_set import get_next_acatfu_supply_air_temperature_set
|
|
|
from app.controllers.equipment.pau.freq_set import get_next_acatfu_freq_set
|
|
|
-from app.models.domain.devices import DevicesInstructionsBaseResponse
|
|
|
+from app.models.domain.devices import DevicesInstructionsBaseResponse, DevicesEarlyStartTime
|
|
|
|
|
|
|
|
|
router = APIRouter()
|
|
@@ -100,3 +104,17 @@ async def get_acatfu_freq_set(
|
|
|
'fanFreqSet': freq_set
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+@router.get('/early-start/prediction', response_model=DevicesEarlyStartTime)
|
|
|
+async def get_acatfc_early_start_time(
|
|
|
+ project_id: str = Query(..., max_length=50, regex='^Pj', alias='projectId'),
|
|
|
+ space_id: str = Query(..., max_length=50, regex='^Sp', alias='spaceId'),
|
|
|
+ db: Session = Depends(get_db)
|
|
|
+):
|
|
|
+ minutes = await get_recommended_early_start_time(db, project_id, space_id)
|
|
|
+ return {
|
|
|
+ 'projectId': project_id,
|
|
|
+ 'spaceId': space_id,
|
|
|
+ 'minutes': minutes
|
|
|
+ }
|