devices.py 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. from enum import Enum
  2. from typing import Dict, List, Optional
  3. from pydantic import BaseModel, Field
  4. from app.models.domain.feedback import FeedbackValue
  5. class ThermalMode(str, Enum):
  6. cooling = "cooling"
  7. heating = "heating"
  8. hold = "hold"
  9. class DevicesInstructionsBaseResponse(BaseModel):
  10. project_id: str = Field(None, alias="projectId")
  11. device_id: str = Field(None, alias="equipId")
  12. output: Dict
  13. class DevicesEarlyStartTime(BaseModel):
  14. project_id: str = Field(None, alias="projectId")
  15. space_id: str = Field(None, alias="spaceId")
  16. minutes: float
  17. class ACATVIInstructionsRequest(BaseModel):
  18. device_id: str
  19. return_air_temperature: float
  20. running_status: bool
  21. current_speed: str
  22. current_temperature_set: float
  23. space_temperature_target: float
  24. space_realtime_temperature: float
  25. feedback: FeedbackValue
  26. class ACATVIInstructionsTemporaryResponse(BaseModel):
  27. output: Dict
  28. class ACATVIInstructionsResponse(BaseModel):
  29. switch_set: Optional[str]
  30. speed_set: Optional[str]
  31. temperature_set: Optional[float]
  32. mode_set: Optional[str]
  33. class ACATFCInstructionsRequest(BaseModel):
  34. device_id: str
  35. season: str
  36. space_temperature_target: float
  37. space_realtime_temperature: Optional[float]
  38. class ACATFCInstructionsResponse(BaseModel):
  39. switch_set: int = Field(None, alias="onOff")
  40. speed_set: int = Field(None, alias="speed")
  41. temperature_set: float = Field(None, alias="temperature")
  42. mode_set: int = Field(None, alias="mode")
  43. water_valve_switch_set: int = Field(None, alias="water")
  44. class ACATFCEarlyStartPredictionRequest(BaseModel):
  45. space_id: Optional[str]
  46. device_id: str
  47. space_realtime_temperature: float
  48. outdoor_realtime_temperature: float
  49. class ACATFCEarlyStartPredictionResponse(BaseModel):
  50. minutes: float
  51. class Space(BaseModel):
  52. realtime_temperature: float
  53. temperature_target: float
  54. vav_default_weight: float
  55. vav_temporary_weight: float
  56. vav_temporary_update_time: str
  57. class ACATVAInstructionsRequest(BaseModel):
  58. device_id: str
  59. season: str
  60. supply_air_temperature: Optional[float]
  61. acatah_supply_air_temperature: Optional[float]
  62. supply_air_flow: float
  63. supply_air_flow_lower_limit: float
  64. supply_air_flow_upper_limit: float
  65. spaces: List[Space]
  66. class ACATVAInstructionsResponse(BaseModel):
  67. supply_air_flow_set: float = Field(None, alias="SupplyAirFlowSet")
  68. virtual_temperature_target_set: float = Field(None, alias="TargetTemperatureSet")
  69. virtual_realtime_temperature: float = Field(
  70. None, alias="VirtualRealtimeTemperature"
  71. )
  72. class ACATAHFreqSetRequest(BaseModel):
  73. device_id: str
  74. system_supply_static_press: float
  75. system_supply_static_press_set: float
  76. current_freq_set: float
  77. supply_air_temperature_set_list: List[float]
  78. spaces_hot_rate: float
  79. class ACATAHFreqSetResponse(BaseModel):
  80. freq_set: float
  81. class SwitchSet(str, Enum):
  82. on = "on"
  83. off = "off"
  84. hold = "hold"
  85. class SwitchSetRequestBase(BaseModel):
  86. device_id: str
  87. running_status: bool
  88. in_cloud_status: bool
  89. on_time: str
  90. off_time: str
  91. is_workday: bool
  92. class SwitchSetResponseBase(BaseModel):
  93. switch_set: SwitchSet
  94. class ACVTSFSwitchSetRequest(SwitchSetRequestBase):
  95. pass
  96. class ACVTSFSwitchSetResponse(SwitchSetResponseBase):
  97. pass
  98. class ACATFUSwitchSetRequest(SwitchSetRequestBase):
  99. pass
  100. class ACATFUSwitchSetResponse(SwitchSetResponseBase):
  101. pass
  102. class ACATAHSwitchSetRequest(SwitchSetRequestBase):
  103. break_start_time: str
  104. break_end_time: str
  105. class ACATAHSwitchSetResponse(SwitchSetResponseBase):
  106. pass
  107. class VAV(BaseModel):
  108. id: str
  109. virtual_realtime_temperature: float
  110. virtual_temperature_target: float
  111. supply_air_flow_lower_limit: float
  112. supply_air_flow_upper_limit: float
  113. supply_air_flow_set: float
  114. valve_opening: float
  115. class ACATAHRequestBase(BaseModel):
  116. device_id: str
  117. season: str
  118. vav_list: List[VAV]
  119. class ACATAHThermalModeSetRequest(ACATAHRequestBase):
  120. pass
  121. class ACATAHThermalModeSetResponse(BaseModel):
  122. thermal_mode_set: ThermalMode
  123. class ACATAHSupplyAirTempSetRequest(ACATAHRequestBase):
  124. supply_air_temperature: float
  125. return_air_temperature: float
  126. chill_water_valve_opening_set_list: Optional[List[float]]
  127. hot_water_valve_opening_set_list: Optional[List[float]]
  128. equip_switch_set_list: Optional[List[float]]
  129. is_clear_day: Optional[bool]
  130. class ACATAHSupplyAirTempSetResponse(BaseModel):
  131. supply_air_temperature_set: float
  132. class ACATFUSupplyAirTempSetRequest(BaseModel):
  133. device_id: str
  134. supply_air_temperature: float
  135. hot_ratio: float
  136. cold_ratio: float
  137. running_status_list: List[float]
  138. class ACATFUSupplyAirTempSetResponse(BaseModel):
  139. supply_air_temperature_set: float
  140. class ACATFUFreqSetRequest(BaseModel):
  141. device_id: str
  142. freq: float
  143. hot_ratio: float
  144. cold_ratio: float
  145. class ACATFUFreqSetResponse(BaseModel):
  146. freq_set: float