devices.py 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  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(None, alias='VirtualRealtimeTemperature')
  70. class ACATAHFreqSetRequest(BaseModel):
  71. device_id: str
  72. system_supply_static_press: float
  73. system_supply_static_press_set: float
  74. current_freq_set: float
  75. supply_air_temperature_set_list: List[float]
  76. spaces_hot_rate: float
  77. class ACATAHFreqSetResponse(BaseModel):
  78. freq_set: float
  79. class SwitchSet(str, Enum):
  80. on = 'on'
  81. off = 'off'
  82. hold = 'hold'
  83. class SwitchSetRequestBase(BaseModel):
  84. device_id: str
  85. running_status: bool
  86. in_cloud_status: bool
  87. on_time: str
  88. off_time: str
  89. is_workday: bool
  90. class SwitchSetResponseBase(BaseModel):
  91. switch_set: SwitchSet
  92. class ACVTSFSwitchSetRequest(SwitchSetRequestBase):
  93. pass
  94. class ACVTSFSwitchSetResponse(SwitchSetResponseBase):
  95. pass
  96. class ACATFUSwitchSetRequest(SwitchSetRequestBase):
  97. pass
  98. class ACATFUSwitchSetResponse(SwitchSetResponseBase):
  99. pass
  100. class ACATAHSwitchSetRequest(SwitchSetRequestBase):
  101. break_start_time: str
  102. break_end_time: str
  103. class ACATAHSwitchSetResponse(SwitchSetResponseBase):
  104. pass
  105. class VAV(BaseModel):
  106. id: str
  107. virtual_realtime_temperature: float
  108. virtual_temperature_target: float
  109. supply_air_flow_lower_limit: float
  110. supply_air_flow_upper_limit: float
  111. supply_air_flow_set: float
  112. valve_opening: float
  113. class ACATAHRequestBase(BaseModel):
  114. device_id: str
  115. season: str
  116. vav_list: List[VAV]
  117. class ACATAHThermalModeSetRequest(ACATAHRequestBase):
  118. pass
  119. class ACATAHThermalModeSetResponse(BaseModel):
  120. thermal_mode_set: ThermalMode
  121. class ACATAHSupplyAirTempSetRequest(ACATAHRequestBase):
  122. supply_air_temperature: float
  123. return_air_temperature: float
  124. chill_water_valve_opening_set_list: Optional[List[float]]
  125. hot_water_valve_opening_set_list: Optional[List[float]]
  126. equip_switch_set_list: Optional[List[float]]
  127. is_clear_day: Optional[bool]
  128. class ACATAHSupplyAirTempSetResponse(BaseModel):
  129. supply_air_temperature_set: float
  130. class ACATFUSupplyAirTempSetRequest(BaseModel):
  131. device_id: str
  132. supply_air_temperature: float
  133. hot_ratio: float
  134. cold_ratio: float
  135. running_status_list: List[float]
  136. class ACATFUSupplyAirTempSetResponse(BaseModel):
  137. supply_air_temperature_set: float
  138. class ACATFUFreqSetRequest(BaseModel):
  139. device_id: str
  140. freq: float
  141. hot_ratio: float
  142. cold_ratio: float
  143. class ACATFUFreqSetResponse(BaseModel):
  144. freq_set: float