devices.py 7.8 KB

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