devices.py 4.9 KB

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