Explorar el Código

modify some objects

highing666 hace 2 años
padre
commit
0a9d163836
Se han modificado 3 ficheros con 19 adiciones y 43 borrados
  1. 1 17
      app/models/domain/devices.py
  2. 14 14
      app/schemas/equipment.py
  3. 4 12
      app/schemas/space.py

+ 1 - 17
app/models/domain/devices.py

@@ -23,23 +23,11 @@ class Speed(str, Enum):
     hold = "hold"
 
 
-class DevicesInstructionsBaseResponse(BaseModel):
-    project_id: str = Field(None, alias="projectId")
-    device_id: str = Field(None, alias="equipId")
-    output: Dict
-
-
-class DevicesEarlyStartTime(BaseModel):
-    project_id: str = Field(None, alias="projectId")
-    space_id: str = Field(None, alias="spaceId")
-    minutes: float
-
-
 class ACATVIInstructionsRequest(BaseModel):
     device_id: str
     return_air_temperature: Optional[float]
     running_status: Optional[bool]
-    work_mode: VRFMode
+    work_mode: Optional[VRFMode]
     current_speed: Optional[str]
     current_temperature_set: Optional[float]
     space_temperature_target: Optional[float]
@@ -49,10 +37,6 @@ class ACATVIInstructionsRequest(BaseModel):
     off_time: Optional[str]
 
 
-class ACATVIInstructionsTemporaryResponse(BaseModel):
-    output: Dict
-
-
 class ACATVIInstructionsResponse(BaseModel):
     switch_set: Optional[str]
     speed_set: Optional[str]

+ 14 - 14
app/schemas/equipment.py

@@ -25,11 +25,11 @@ class VRFMode(str, Enum):
 
 class BaseEquipment(BaseModel):
     id: Optional[str]
-    running_status: Optional[bool] = False
+    running_status: Optional[bool]
     in_cloud_status: Optional[bool]
     on_time: Optional[str]
     off_time: Optional[str]
-    equip_switch_set: Optional[bool] = False
+    equip_switch_set: Optional[bool]
 
 
 class FCU(BaseEquipment):
@@ -38,10 +38,10 @@ class FCU(BaseEquipment):
     air_valve_speed_set: Optional[AirValveSpeed] = AirValveSpeed.off
     recommended_speed: Optional[AirValveSpeed] = AirValveSpeed.off
     space: Optional[Space]
-    setting_temperature: Optional[float] = 0.0
-    supply_air_temperature: Optional[float] = 0.0
-    water_out_temperature: Optional[float] = 0.0
-    water_in_temperature: Optional[float] = 0.0
+    setting_temperature: Optional[float]
+    supply_air_temperature: Optional[float]
+    water_out_temperature: Optional[float]
+    water_in_temperature: Optional[float]
     speed_limit: Optional[AirValveSpeed] = AirValveSpeed.high
 
 
@@ -60,14 +60,14 @@ class VAVBox(BaseEquipment):
 
 
 class AHU(BaseEquipment):
-    supply_air_temperature: Optional[float] = np.NAN
-    supply_air_temperature_set: Optional[float] = np.NAN
-    return_air_temperature: Optional[float] = np.NAN
-    return_air_temperature_set: Optional[float] = np.NAN
-    freq: Optional[float] = np.NAN
-    freq_set: Optional[float] = np.NAN
-    fan_freq_upper_limit_set: Optional[float] = np.NAN
-    fan_freq_lower_limit_set: Optional[float] = np.NAN
+    supply_air_temperature: Optional[float]
+    supply_air_temperature_set: Optional[float]
+    return_air_temperature: Optional[float]
+    return_air_temperature_set: Optional[float]
+    freq: Optional[float]
+    freq_set: Optional[float]
+    fan_freq_upper_limit_set: Optional[float]
+    fan_freq_lower_limit_set: Optional[float]
 
 
 class VentilationFan(BaseEquipment):

+ 4 - 12
app/schemas/space.py

@@ -3,20 +3,12 @@
 from typing import List, Optional
 
 import numpy as np
-from pydantic import BaseModel as PydanticBaseModel, validator
-
-
-class BaseModel(PydanticBaseModel):
-    @validator("*")
-    def change_to_nan(cls, v):
-        if v == -999.9:
-            v = np.NAN
-        return v
+from pydantic import BaseModel
 
 
 class SpaceBase(BaseModel):
     id: Optional[str]
-    realtime_temperature: float = np.NAN
+    realtime_temperature: Optional[float]
 
 
 class Space(SpaceBase):
@@ -33,8 +25,8 @@ class SpaceATVA(Space):
 
 
 class SpaceATAH(Space):
-    ahu_default_weight: Optional[float] = np.NAN
-    ahu_temporary_weight: Optional[float] = np.NAN
+    ahu_default_weight: Optional[float]
+    ahu_temporary_weight: Optional[float]
     ahu_temporary_update_time: Optional[str] = ""