devices.py 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  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.equipment import VRFMode
  8. class ThermalMode(str, Enum):
  9. cooling = "cooling"
  10. heating = "heating"
  11. hold = "hold"
  12. class Speed(str, Enum):
  13. off = "off"
  14. low = "low"
  15. medium = "medium"
  16. high = "high"
  17. hold = "hold"
  18. class ACATVIInstructionsRequest(BaseModel):
  19. device_id: str
  20. return_air_temperature: Optional[float]
  21. running_status: Optional[bool]
  22. work_mode: VRFMode
  23. current_speed: Optional[str]
  24. current_temperature_set: Optional[float]
  25. space_temperature_target: Optional[float]
  26. space_realtime_temperature: Optional[float]
  27. feedback: FeedbackValue
  28. on_time: Optional[str]
  29. off_time: Optional[str]
  30. class ACATVIInstructionsResponse(BaseModel):
  31. switch_set: Optional[str]
  32. speed_set: Optional[str]
  33. temperature_set: Optional[float]
  34. class ACATVIModeRequest(BaseModel):
  35. season: Season
  36. space_temperature_list: List[float]
  37. class ACATVIModeResponse(BaseModel):
  38. mode: str
  39. class ACATFCInstructionsRequestBase(BaseModel):
  40. device_id: str
  41. season: str
  42. space_temperature_target: Optional[float]
  43. space_realtime_temperature: Optional[float]
  44. running_status: Optional[bool]
  45. speed: Optional[Speed]
  46. feedback: FeedbackValue
  47. class ACATFC2InstructionsRequest(ACATFCInstructionsRequestBase):
  48. pass
  49. class ACATFC4InstructionsRequest(ACATFCInstructionsRequestBase):
  50. pass
  51. class ACATFCInstructionsResponseBase(BaseModel):
  52. speed_set: str
  53. switch_set: str
  54. class ACATFC2InstructionsResponse(ACATFCInstructionsResponseBase):
  55. water_valve_set: str
  56. class ACATFC4InstructionsResponse(ACATFCInstructionsResponseBase):
  57. chill_water_valve_set: str
  58. hot_water_valve_set: str
  59. class ACATFCInstructionsResponse(BaseModel):
  60. switch_set: int = Field(None, alias="onOff")
  61. speed_set: int = Field(None, alias="speed")
  62. temperature_set: float = Field(None, alias="temperature")
  63. mode_set: int = Field(None, alias="mode")
  64. water_valve_switch_set: int = Field(None, alias="water")
  65. class ACATFCEarlyStartPredictionRequest(BaseModel):
  66. season: Season
  67. space_id: Optional[str]
  68. device_id: str
  69. space_realtime_temperature: Optional[float]
  70. outdoor_realtime_temperature: Optional[float]
  71. class ACATFCEarlyStartPredictionResponse(BaseModel):
  72. minutes: float
  73. class Space(BaseModel):
  74. realtime_temperature: Optional[float]
  75. class ACATVASpace(Space):
  76. temperature_target: Optional[float]
  77. vav_default_weight: Optional[float]
  78. vav_temporary_weight: Optional[float]
  79. vav_temporary_update_time: Optional[str]
  80. class ACATAHSpace(Space):
  81. temperature_target: Optional[float]
  82. ahu_default_weight: Optional[float]
  83. ahu_temporary_weight: Optional[float]
  84. ahu_temporary_update_time: Optional[str]
  85. class ACATFUSpace(Space):
  86. realtime_co2: Optional[float]
  87. class ACATVAInstructionsRequestBase(BaseModel):
  88. device_id: str
  89. spaces: List[ACATVASpace]
  90. class ACATVAInstructionsRequest(ACATVAInstructionsRequestBase):
  91. season: str
  92. supply_air_temperature: Optional[float]
  93. acatah_supply_air_temperature: Optional[float]
  94. supply_air_flow: Optional[float]
  95. supply_air_flow_lower_limit: Optional[float]
  96. supply_air_flow_upper_limit: Optional[float]
  97. class ACATVAInstructionsRequestV2(ACATVAInstructionsRequestBase):
  98. season: str
  99. return_air_temperature: Optional[float]
  100. class ACATVAInstructionsResponse(BaseModel):
  101. supply_air_flow_set: float = Field(None, alias="SupplyAirFlowSet")
  102. virtual_temperature_target_set: float = Field(None, alias="TargetTemperatureSet")
  103. virtual_realtime_temperature: float = Field(
  104. None, alias="VirtualRealtimeTemperature"
  105. )
  106. class ACATVAInstructionsResponseV2(BaseModel):
  107. temperature_target_set: float
  108. virtual_target_temperature: float
  109. virtual_realtime_temperature: float
  110. class ACATAHFreqSetRequest(BaseModel):
  111. device_id: str
  112. system_supply_static_press: Optional[float]
  113. system_supply_static_press_set: Optional[float]
  114. current_freq_set: Optional[float]
  115. supply_air_temperature_set_list: List[float]
  116. spaces_hot_rate: Optional[float]
  117. class ACATAHFreqSetResponse(BaseModel):
  118. freq_set: float
  119. class ACATAHInstructionsRequest(BaseModel):
  120. device_id: str
  121. season: Season
  122. spaces: List[ACATAHSpace]
  123. running_status: Optional[bool]
  124. return_air_temperature: Optional[float]
  125. return_air_temperature_set: Optional[float]
  126. supply_air_temperature: Optional[float]
  127. supply_air_temperature_set: Optional[float]
  128. freq: Optional[float]
  129. freq_set: Optional[float]
  130. fan_freq_upper_limit_set: Optional[float]
  131. fan_freq_lower_limit_set: Optional[float]
  132. class ACATAHInstructionsResponse(BaseModel):
  133. switch_set: str
  134. return_air_temp_set: Optional[float]
  135. supply_air_temp_set: Optional[float]
  136. freq_set: Optional[float]
  137. class SwitchSetRequestBase(BaseModel):
  138. device_id: str
  139. running_status: Optional[bool]
  140. in_cloud_status: Optional[bool]
  141. on_time: Optional[str]
  142. off_time: Optional[str]
  143. is_workday: Optional[bool]
  144. class SwitchSetResponseBase(BaseModel):
  145. switch_set: SwitchSet
  146. class ACVTSFSwitchSetRequest(SwitchSetRequestBase):
  147. pass
  148. class ACVTSFSwitchSetResponse(SwitchSetResponseBase):
  149. pass
  150. class ACATFUSwitchSetRequest(SwitchSetRequestBase):
  151. break_start_time: Optional[str]
  152. break_end_time: Optional[str]
  153. class ACATFUCO2SwitchSetRequest(ACATFUSwitchSetRequest):
  154. co2_list: List[float]
  155. class ACATFUSwitchSetResponse(SwitchSetResponseBase):
  156. pass
  157. class ACATAHSwitchSetRequest(SwitchSetRequestBase):
  158. break_start_time: Optional[str]
  159. break_end_time: Optional[str]
  160. class ACATAHSwitchSetResponse(SwitchSetResponseBase):
  161. pass
  162. class VAV(BaseModel):
  163. id: str
  164. virtual_realtime_temperature: Optional[float]
  165. virtual_temperature_target: Optional[float]
  166. supply_air_flow_lower_limit: Optional[float]
  167. supply_air_flow_upper_limit: Optional[float]
  168. supply_air_flow_set: Optional[float]
  169. valve_opening: Optional[float]
  170. class ACATAHRequestBase(BaseModel):
  171. device_id: str
  172. season: str
  173. vav_list: List[VAV]
  174. class ACATAHThermalModeSetRequest(ACATAHRequestBase):
  175. pass
  176. class ACATAHThermalModeSetResponse(BaseModel):
  177. thermal_mode_set: ThermalMode
  178. class ACATAHSupplyAirTempSetRequest(ACATAHRequestBase):
  179. supply_air_temperature_set: Optional[float]
  180. return_air_temperature: Optional[float]
  181. chill_water_valve_opening_set_list: List[float]
  182. hot_water_valve_opening_set_list: List[float]
  183. equip_switch_set_list: List[float]
  184. is_clear_day: Optional[bool]
  185. class ACATAHSupplyAirTempSetResponse(BaseModel):
  186. supply_air_temperature_set: float
  187. class ACATFUSupplyAirTempSetRequest(BaseModel):
  188. device_id: str
  189. season: Season
  190. supply_air_temperature_set: Optional[float]
  191. hot_ratio: Optional[float]
  192. cold_ratio: Optional[float]
  193. running_status_list: List[float]
  194. class ACATFUSupplyAirTempSetResponse(BaseModel):
  195. supply_air_temperature_set: float
  196. class ACATFUFreqSetRequest(BaseModel):
  197. device_id: str
  198. freq: Optional[float]
  199. fresh_air_temperature: Optional[float]
  200. spaces: List[ACATFUSpace]
  201. season: Season
  202. running_status_list: List[float]
  203. class ACATFUFreqSetResponse(BaseModel):
  204. freq_set: float