Skip to content

Commit

Permalink
device: move double setpoint from hvac
Browse files Browse the repository at this point in the history
Double setpoint is also present on system devices.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
  • Loading branch information
Noltari committed Oct 21, 2024
1 parent 308e05b commit d26d841
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
14 changes: 14 additions & 0 deletions aioairzone_cloud/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
API_AQ_STATUS,
API_CONFIG,
API_DEVICE_ID,
API_DOUBLE_SET_POINT,
API_ERRORS,
API_IS_CONNECTED,
API_META,
Expand All @@ -31,6 +32,7 @@
AZD_AQ_PRESENT,
AZD_AQ_STATUS,
AZD_AVAILABLE,
AZD_DOUBLE_SET_POINT,
AZD_ERRORS,
AZD_ID,
AZD_INSTALLATION,
Expand Down Expand Up @@ -62,6 +64,7 @@ def __init__(self, inst_id: str, ws_id: str, device_data: dict[str, Any]):
self.aq_pm_10: int | None = None
self.aq_present: bool | None = None
self.aq_status: str | None = None
self.double_set_point: bool | None = None
self.errors: list[str] = []
self.id = str(device_data[API_DEVICE_ID])
self.installation_id = inst_id
Expand Down Expand Up @@ -96,6 +99,7 @@ def data(self) -> dict[str, Any]:
"""Return Device data."""
data: dict[str, Any] = {
AZD_AVAILABLE: self.get_available(),
AZD_DOUBLE_SET_POINT: self.get_double_set_point(),
AZD_ID: self.get_id(),
AZD_INSTALLATION: self.get_installation(),
AZD_IS_CONNECTED: self.get_is_connected(),
Expand Down Expand Up @@ -183,6 +187,12 @@ def get_available(self) -> bool:
"""Return availability status."""
return self.is_connected and self.ws_connected

def get_double_set_point(self) -> bool:
"""Return Device double set point."""
if self.double_set_point is not None:
return self.double_set_point
return False

def get_errors(self) -> list[str]:
"""Return Device errors."""
return self.errors
Expand Down Expand Up @@ -276,6 +286,10 @@ def update_data(self, update: EntityUpdate) -> None:
if aq_status is not None:
self.aq_status = aq_status

double_set_point = parse_bool(data.get(API_DOUBLE_SET_POINT))
if double_set_point is not None:
self.double_set_point = double_set_point

errors = data.get(API_ERRORS)
if errors is not None:
self.errors = []
Expand Down
14 changes: 0 additions & 14 deletions aioairzone_cloud/hvac.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
API_CONSUMPTION_UE,
API_DEFAULT_TEMP_STEP,
API_DISCH_COMP_TEMP_UE,
API_DOUBLE_SET_POINT,
API_EXCH_HEAT_TEMP_IU,
API_EXCH_HEAT_TEMP_UE,
API_EXT_TEMP,
Expand Down Expand Up @@ -71,7 +70,6 @@
AZD_AQ_ACTIVE,
AZD_AQ_MODE_CONF,
AZD_AQ_MODE_VALUES,
AZD_DOUBLE_SET_POINT,
AZD_HUMIDITY,
AZD_INDOOR_EXCHANGER_TEMP,
AZD_INDOOR_RETURN_TEMP,
Expand Down Expand Up @@ -133,7 +131,6 @@ def __init__(self, inst_id: str, ws_id: str, device_data: dict[str, Any]):
self.aq_active: bool | None = None
self.aq_mode_conf: AirQualityMode | None = None
self.aq_mode_values: list[AirQualityMode] | None = None
self.double_set_point: bool | None = None
self.floor_demand: bool | None = None
self.humidity: int | None = None
self.indoor_exchanger_temp: float | None = None
Expand Down Expand Up @@ -185,7 +182,6 @@ def data(self) -> dict[str, Any]:

data[AZD_ACTION] = self.get_action()
data[AZD_ACTIVE] = self.get_active()
data[AZD_DOUBLE_SET_POINT] = self.get_double_set_point()
data[AZD_POWER] = self.get_power()
data[AZD_TEMP] = self.get_temperature()
data[AZD_TEMP_STEP] = self.get_temp_step()
Expand Down Expand Up @@ -411,12 +407,6 @@ def get_aq_mode_values(self) -> list[AirQualityMode] | None:
return self.aq_mode_values
return None

def get_double_set_point(self) -> bool:
"""Return HVAC double set point."""
if self.double_set_point is not None:
return self.double_set_point
return False

def get_floor_demand(self) -> bool | None:
"""Return HVAC device floor demand status."""
return self.floor_demand
Expand Down Expand Up @@ -797,10 +787,6 @@ def update_data(self, update: EntityUpdate) -> None:
for aq_mode_value in aq_mode_values:
self.aq_mode_values += [AirQualityMode(aq_mode_value)]

double_set_point = parse_bool(data.get(API_DOUBLE_SET_POINT))
if double_set_point is not None:
self.double_set_point = double_set_point

humidity = parse_int(data.get(API_HUMIDITY))
if humidity is not None:
self.humidity = humidity
Expand Down

0 comments on commit d26d841

Please sign in to comment.