devices.py 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  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 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: float
  29. running_status: bool
  30. work_mode: float
  31. current_speed: str
  32. current_temperature_set: float
  33. space_temperature_target: float
  34. space_realtime_temperature: float
  35. feedback: FeedbackValue
  36. on_time: str
  37. off_time: 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. # mode_set: Optional[str]
  45. class ACATVIModeRequest(BaseModel):
  46. season: Season
  47. space_temperature_list: List[float]
  48. class ACATVIModeResponse(BaseModel):
  49. mode: str
  50. class ACATFCInstructionsRequestBase(BaseModel):
  51. device_id: str
  52. season: str
  53. space_temperature_target: float
  54. space_realtime_temperature: Optional[float]
  55. running_status: bool
  56. speed: Speed
  57. feedback: FeedbackValue
  58. class ACATFC2InstructionsRequest(ACATFCInstructionsRequestBase):
  59. pass
  60. class ACATFC4InstructionsRequest(ACATFCInstructionsRequestBase):
  61. pass
  62. class ACATFCInstructionsResponseBase(BaseModel):
  63. speed_set: str
  64. switch_set: str
  65. class ACATFC2InstructionsResponse(ACATFCInstructionsResponseBase):
  66. water_valve_set: str
  67. class ACATFC4InstructionsResponse(ACATFCInstructionsResponseBase):
  68. chill_water_valve_set: str
  69. hot_water_valve_set: str
  70. class ACATFCInstructionsResponse(BaseModel):
  71. switch_set: int = Field(None, alias="onOff")
  72. speed_set: int = Field(None, alias="speed")
  73. temperature_set: float = Field(None, alias="temperature")
  74. mode_set: int = Field(None, alias="mode")
  75. water_valve_switch_set: int = Field(None, alias="water")
  76. class ACATFCEarlyStartPredictionRequest(BaseModel):
  77. season: Season
  78. space_id: Optional[str]
  79. device_id: str
  80. space_realtime_temperature: float
  81. outdoor_realtime_temperature: float
  82. class ACATFCEarlyStartPredictionResponse(BaseModel):
  83. minutes: float
  84. class Space(BaseModel):
  85. realtime_temperature: float
  86. temperature_target: float
  87. vav_default_weight: float
  88. vav_temporary_weight: float
  89. vav_temporary_update_time: str
  90. class ACATVAInstructionsRequestBase(BaseModel):
  91. device_id: str
  92. spaces: List[Space]
  93. class ACATVAInstructionsRequest(ACATVAInstructionsRequestBase):
  94. season: str
  95. supply_air_temperature: Optional[float]
  96. acatah_supply_air_temperature: Optional[float]
  97. supply_air_flow: Optional[float]
  98. supply_air_flow_lower_limit: Optional[float]
  99. supply_air_flow_upper_limit: Optional[float]
  100. class ACATVAInstructionsRequestV2(ACATVAInstructionsRequestBase):
  101. season: str
  102. # temperature_set: float
  103. return_air_temp: float
  104. class ACATVAInstructionsResponse(BaseModel):
  105. supply_air_flow_set: float = Field(None, alias="SupplyAirFlowSet")
  106. virtual_temperature_target_set: float = Field(None, alias="TargetTemperatureSet")
  107. virtual_realtime_temperature: float = Field(
  108. None, alias="VirtualRealtimeTemperature"
  109. )
  110. class ACATVAInstructionsResponseV2(BaseModel):
  111. temperature_target_set: float
  112. virtual_target_temperature: float
  113. virtual_realtime_temperature: float
  114. class ACATAHFreqSetRequest(BaseModel):
  115. device_id: str
  116. system_supply_static_press: float
  117. system_supply_static_press_set: float
  118. current_freq_set: float
  119. supply_air_temperature_set_list: List[float]
  120. spaces_hot_rate: float
  121. class ACATAHFreqSetResponse(BaseModel):
  122. freq_set: float
  123. class SwitchSetRequestBase(BaseModel):
  124. device_id: str
  125. running_status: bool
  126. in_cloud_status: bool
  127. on_time: str
  128. off_time: str
  129. is_workday: bool
  130. class SwitchSetResponseBase(BaseModel):
  131. switch_set: SwitchSet
  132. class ACVTSFSwitchSetRequest(SwitchSetRequestBase):
  133. pass
  134. class ACVTSFSwitchSetResponse(SwitchSetResponseBase):
  135. pass
  136. class ACATFUSwitchSetRequest(SwitchSetRequestBase):
  137. break_start_time: Optional[str]
  138. break_end_time: Optional[str]
  139. class ACATFUSwitchSetResponse(SwitchSetResponseBase):
  140. pass
  141. class ACATAHSwitchSetRequest(SwitchSetRequestBase):
  142. break_start_time: Optional[str]
  143. break_end_time: Optional[str]
  144. class ACATAHSwitchSetResponse(SwitchSetResponseBase):
  145. pass
  146. class VAV(BaseModel):
  147. id: str
  148. virtual_realtime_temperature: float
  149. virtual_temperature_target: float
  150. supply_air_flow_lower_limit: float
  151. supply_air_flow_upper_limit: float
  152. supply_air_flow_set: float
  153. valve_opening: float
  154. class ACATAHRequestBase(BaseModel):
  155. device_id: str
  156. season: str
  157. vav_list: List[VAV]
  158. class ACATAHThermalModeSetRequest(ACATAHRequestBase):
  159. pass
  160. class ACATAHThermalModeSetResponse(BaseModel):
  161. thermal_mode_set: ThermalMode
  162. class ACATAHSupplyAirTempSetRequest(ACATAHRequestBase):
  163. supply_air_temperature_set: float
  164. return_air_temperature: float
  165. chill_water_valve_opening_set_list: Optional[List[float]]
  166. hot_water_valve_opening_set_list: Optional[List[float]]
  167. equip_switch_set_list: Optional[List[float]]
  168. is_clear_day: Optional[bool]
  169. class ACATAHSupplyAirTempSetResponse(BaseModel):
  170. supply_air_temperature_set: float
  171. class ACATFUSupplyAirTempSetRequest(BaseModel):
  172. device_id: str
  173. season: Season
  174. supply_air_temperature_set: float
  175. hot_ratio: float
  176. cold_ratio: float
  177. running_status_list: List[float]
  178. class ACATFUSupplyAirTempSetResponse(BaseModel):
  179. supply_air_temperature_set: float
  180. class ACATFUFreqSetRequest(BaseModel):
  181. device_id: str
  182. freq: float
  183. fresh_air_temperature: float
  184. spaces: List[SpaceATFU]
  185. season: Season
  186. running_status_list: List[float]
  187. class ACATFUFreqSetResponse(BaseModel):
  188. freq_set: float