devices.py 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. from fastapi import APIRouter, Query
  2. from app.controllers.equipment.ahu.supply_air_temperature_set import get_next_supply_air_temperature_set
  3. from app.controllers.equipment.ahu.thermal_mode import get_thermal_mode
  4. from app.models.domain.devices import DevicesInstructionsBaseResponse
  5. router = APIRouter()
  6. @router.get('/instructions/acatah/thermal-mode-set', response_model=DevicesInstructionsBaseResponse)
  7. async def get_acatah_thermal_mode_set(
  8. project_id: str = Query(..., max_length=50, regex='^Pj', alias='projectId'),
  9. device_id: str = Query(..., max_length=50, regex='^Eq', alias='equipId')
  10. ):
  11. thermal_mode = await get_thermal_mode(project_id, device_id)
  12. return {
  13. 'projectId': project_id,
  14. 'equipId': device_id,
  15. 'output': {
  16. 'thermalModeSet': thermal_mode
  17. }
  18. }
  19. @router.get('/instructions/acatah/supply-air-temperature-set', response_model=DevicesInstructionsBaseResponse)
  20. async def get_acatah_supply_air_temperature_set(
  21. project_id: str = Query(..., max_length=50, regex='^Pj', alias='projectId'),
  22. device_id: str = Query(..., max_length=50, regex='^Eq', alias='equipId')
  23. ):
  24. next_supply_air_temperature_set = await get_next_supply_air_temperature_set(project_id, device_id)
  25. return {
  26. 'projectId': project_id,
  27. 'equipId': device_id,
  28. 'output': {
  29. 'supplyAirTemperatureSet': next_supply_air_temperature_set
  30. }
  31. }