devices.py 5.4 KB

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