devices.py 7.7 KB

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