devices.py 6.0 KB

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