devices.py 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. from enum import Enum
  2. from typing import Dict, List, Optional
  3. from pydantic import BaseModel, Field
  4. from app.controllers.equipment.switch import SwitchSet
  5. from app.models.domain.feedback import FeedbackValue
  6. from app.schemas.season import Season
  7. from app.schemas.space import SpaceATFU
  8. class ThermalMode(str, Enum):
  9. cooling = "cooling"
  10. heating = "heating"
  11. hold = "hold"
  12. class DevicesInstructionsBaseResponse(BaseModel):
  13. project_id: str = Field(None, alias="projectId")
  14. device_id: str = Field(None, alias="equipId")
  15. output: Dict
  16. class DevicesEarlyStartTime(BaseModel):
  17. project_id: str = Field(None, alias="projectId")
  18. space_id: str = Field(None, alias="spaceId")
  19. minutes: float
  20. class ACATVIInstructionsRequest(BaseModel):
  21. device_id: str
  22. return_air_temperature: float
  23. running_status: bool
  24. current_speed: str
  25. current_temperature_set: float
  26. space_temperature_target: float
  27. space_realtime_temperature: float
  28. feedback: FeedbackValue
  29. class ACATVIInstructionsTemporaryResponse(BaseModel):
  30. output: Dict
  31. class ACATVIInstructionsResponse(BaseModel):
  32. switch_set: Optional[str]
  33. speed_set: Optional[str]
  34. temperature_set: Optional[float]
  35. mode_set: Optional[str]
  36. class ACATFCInstructionsRequest(BaseModel):
  37. device_id: str
  38. season: str
  39. space_temperature_target: float
  40. space_realtime_temperature: Optional[float]
  41. class ACATFCInstructionsResponse(BaseModel):
  42. switch_set: int = Field(None, alias="onOff")
  43. speed_set: int = Field(None, alias="speed")
  44. temperature_set: float = Field(None, alias="temperature")
  45. mode_set: int = Field(None, alias="mode")
  46. water_valve_switch_set: int = Field(None, alias="water")
  47. class ACATFCEarlyStartPredictionRequest(BaseModel):
  48. space_id: Optional[str]
  49. device_id: str
  50. space_realtime_temperature: float
  51. outdoor_realtime_temperature: float
  52. class ACATFCEarlyStartPredictionResponse(BaseModel):
  53. minutes: float
  54. class Space(BaseModel):
  55. realtime_temperature: float
  56. temperature_target: float
  57. vav_default_weight: float
  58. vav_temporary_weight: float
  59. vav_temporary_update_time: str
  60. class ACATVAInstructionsRequest(BaseModel):
  61. device_id: str
  62. season: str
  63. supply_air_temperature: Optional[float]
  64. acatah_supply_air_temperature: Optional[float]
  65. supply_air_flow: float
  66. supply_air_flow_lower_limit: float
  67. supply_air_flow_upper_limit: float
  68. spaces: List[Space]
  69. class ACATVAInstructionsResponse(BaseModel):
  70. supply_air_flow_set: float = Field(None, alias="SupplyAirFlowSet")
  71. virtual_temperature_target_set: float = Field(None, alias="TargetTemperatureSet")
  72. virtual_realtime_temperature: float = Field(
  73. None, alias="VirtualRealtimeTemperature"
  74. )
  75. class ACATAHFreqSetRequest(BaseModel):
  76. device_id: str
  77. system_supply_static_press: float
  78. system_supply_static_press_set: float
  79. current_freq_set: float
  80. supply_air_temperature_set_list: List[float]
  81. spaces_hot_rate: float
  82. class ACATAHFreqSetResponse(BaseModel):
  83. freq_set: float
  84. class SwitchSetRequestBase(BaseModel):
  85. device_id: str
  86. running_status: bool
  87. in_cloud_status: bool
  88. on_time: str
  89. off_time: str
  90. is_workday: bool
  91. class SwitchSetResponseBase(BaseModel):
  92. switch_set: SwitchSet
  93. class ACVTSFSwitchSetRequest(SwitchSetRequestBase):
  94. pass
  95. class ACVTSFSwitchSetResponse(SwitchSetResponseBase):
  96. pass
  97. class ACATFUSwitchSetRequest(SwitchSetRequestBase):
  98. pass
  99. class ACATFUSwitchSetResponse(SwitchSetResponseBase):
  100. pass
  101. class ACATAHSwitchSetRequest(SwitchSetRequestBase):
  102. break_start_time: str
  103. break_end_time: str
  104. class ACATAHSwitchSetResponse(SwitchSetResponseBase):
  105. pass
  106. class VAV(BaseModel):
  107. id: str
  108. virtual_realtime_temperature: float
  109. virtual_temperature_target: float
  110. supply_air_flow_lower_limit: float
  111. supply_air_flow_upper_limit: float
  112. supply_air_flow_set: float
  113. valve_opening: float
  114. class ACATAHRequestBase(BaseModel):
  115. device_id: str
  116. season: str
  117. vav_list: List[VAV]
  118. class ACATAHThermalModeSetRequest(ACATAHRequestBase):
  119. pass
  120. class ACATAHThermalModeSetResponse(BaseModel):
  121. thermal_mode_set: ThermalMode
  122. class ACATAHSupplyAirTempSetRequest(ACATAHRequestBase):
  123. supply_air_temperature: float
  124. return_air_temperature: float
  125. chill_water_valve_opening_set_list: Optional[List[float]]
  126. hot_water_valve_opening_set_list: Optional[List[float]]
  127. equip_switch_set_list: Optional[List[float]]
  128. is_clear_day: Optional[bool]
  129. class ACATAHSupplyAirTempSetResponse(BaseModel):
  130. supply_air_temperature_set: float
  131. class ACATFUSupplyAirTempSetRequest(BaseModel):
  132. device_id: str
  133. supply_air_temperature: float
  134. hot_ratio: float
  135. cold_ratio: float
  136. running_status_list: List[float]
  137. class ACATFUSupplyAirTempSetResponse(BaseModel):
  138. supply_air_temperature_set: float
  139. class ACATFUFreqSetRequest(BaseModel):
  140. device_id: str
  141. freq: float
  142. fresh_air_temperature: float
  143. spaces: List[SpaceATFU]
  144. season: Season
  145. running_status_list: List[float]
  146. class ACATFUFreqSetResponse(BaseModel):
  147. freq_set: float