devices.py 6.3 KB

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