Skip to content

Commit

Permalink
device: add dual setpoint config
Browse files Browse the repository at this point in the history
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
  • Loading branch information
Noltari committed Oct 21, 2024
1 parent d26d841 commit c7f12d7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions aioairzone_cloud/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
API_DISCH_COMP_TEMP_UE: Final[str] = "disch_comp_temp_ue"
API_DISCONNECTION_DATE: Final[str] = "disconnection_date"
API_DOUBLE_SET_POINT: Final[str] = "double_sp"
API_DUAL_SP_CONF: Final[str] = "dualsp_auto_conf"
API_ECO_CONF: Final[str] = "eco_conf"
API_EMAIL: Final[str] = "email"
API_ERRORS: Final[str] = "errors"
Expand Down Expand Up @@ -171,6 +172,7 @@
AZD_CONNECTION_DATE: Final[str] = "connection-date"
AZD_DISCONNECTION_DATE: Final[str] = "disconnection-date"
AZD_DOUBLE_SET_POINT: Final[str] = "double-set-point"
AZD_DUAL_SP_CONF: Final[str] = "dual-set-point-conf"
AZD_ERRORS: Final[str] = "errors"
AZD_FIRMWARE: Final[str] = "firmware"
AZD_FLOOR_DEMAND: Final[str] = "floor-demand"
Expand Down
15 changes: 15 additions & 0 deletions aioairzone_cloud/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
API_CONFIG,
API_DEVICE_ID,
API_DOUBLE_SET_POINT,
API_DUAL_SP_CONF,
API_ERRORS,
API_IS_CONNECTED,
API_META,
Expand All @@ -33,6 +34,7 @@
AZD_AQ_STATUS,
AZD_AVAILABLE,
AZD_DOUBLE_SET_POINT,
AZD_DUAL_SP_CONF,
AZD_ERRORS,
AZD_ID,
AZD_INSTALLATION,
Expand Down Expand Up @@ -65,6 +67,7 @@ def __init__(self, inst_id: str, ws_id: str, device_data: dict[str, Any]):
self.aq_present: bool | None = None
self.aq_status: str | None = None
self.double_set_point: bool | None = None
self.dual_sp_conf: bool | None = None
self.errors: list[str] = []
self.id = str(device_data[API_DEVICE_ID])
self.installation_id = inst_id
Expand Down Expand Up @@ -133,6 +136,10 @@ def data(self) -> dict[str, Any]:
if aq_status is not None:
data[AZD_AQ_STATUS] = aq_status

dual_sp_conf = self.get_dual_sp_conf()
if dual_sp_conf is not None:
data[AZD_DUAL_SP_CONF] = dual_sp_conf

errors = self.get_errors()
if len(errors) > 0:
data[AZD_ERRORS] = errors
Expand Down Expand Up @@ -193,6 +200,10 @@ def get_double_set_point(self) -> bool:
return self.double_set_point
return False

def get_dual_sp_conf(self) -> bool | None:
"""Return Device dual set point config."""
return self.dual_sp_conf

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

dual_sp_conf = parse_bool(data.get(API_DUAL_SP_CONF))
if dual_sp_conf is not None:
self.dual_sp_conf = dual_sp_conf

errors = data.get(API_ERRORS)
if errors is not None:
self.errors = []
Expand Down

0 comments on commit c7f12d7

Please sign in to comment.