devices.py 5.4 KB

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