Skip to content

Commit

Permalink
localapi: add speed(s) zone parameter
Browse files Browse the repository at this point in the history
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
  • Loading branch information
Noltari committed Mar 31, 2022
1 parent e5efe3d commit 1ac5029
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
9 changes: 8 additions & 1 deletion aioairzone/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
API_POWER = "power"
API_ROOM_TEMP = "roomTemp"
API_SET_POINT = "setpoint"
API_SPEED = "speed"
API_SPEEDS = "speeds"
API_SYSTEM_FIRMWARE = "system_firmware"
API_SYSTEM_ID = "systemID"
API_SYSTEM_TYPE = "system_type"
Expand All @@ -50,7 +52,10 @@
API_ERROR_ZONE_ID_NOT_AVAILABLE = "zoneid not avaiable"
API_ERROR_ZONE_ID_OUT_RANGE = "zoneid out of range"

API_SYSTEM_PARAMS = [API_MODE]
API_SYSTEM_PARAMS = [
API_MODE,
API_SPEED,
]
API_ZONE_PARAMS = [
API_COOL_SET_POINT,
API_COLD_STAGE,
Expand Down Expand Up @@ -90,6 +95,8 @@
AZD_ON = "on"
AZD_POWER = "power"
AZD_PROBLEMS = "problems"
AZD_SPEED = "speed"
AZD_SPEEDS = "speeds"
AZD_SYSTEM = "system"
AZD_SYSTEMS = "systems"
AZD_SYSTEMS_NUM = "num_systems"
Expand Down
24 changes: 24 additions & 0 deletions aioairzone/localapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
API_POWER,
API_ROOM_TEMP,
API_SET_POINT,
API_SPEED,
API_SPEEDS,
API_SYSTEM_FIRMWARE,
API_SYSTEM_ID,
API_SYSTEM_PARAMS,
Expand Down Expand Up @@ -96,6 +98,8 @@
AZD_ON,
AZD_POWER,
AZD_PROBLEMS,
AZD_SPEED,
AZD_SPEEDS,
AZD_SYSTEM,
AZD_SYSTEMS,
AZD_SYSTEMS_NUM,
Expand Down Expand Up @@ -582,6 +586,8 @@ def __init__(self, system: System, zone: dict[str, Any]):
self.modes: list[OperationMode] = []
self.name = str(zone[API_NAME])
self.on = bool(zone[API_ON])
self.speed: int | None = None
self.speeds: int | None = None
self.temp = float(zone[API_ROOM_TEMP])
self.temp_max = float(zone[API_MAX_TEMP])
self.temp_min = float(zone[API_MIN_TEMP])
Expand Down Expand Up @@ -622,6 +628,11 @@ def __init__(self, system: System, zone: dict[str, Any]):
for key, val in error.items():
self.add_error(key, val)

if API_SPEED in zone:
self.speed = int(zone[API_SPEED])
if API_SPEEDS in zone:
self.speeds = int(zone[API_SPEEDS])

if self.master:
for mode in zone[API_MODES]:
self.modes.append(OperationMode(mode))
Expand Down Expand Up @@ -671,6 +682,11 @@ def data(self) -> dict[str, Any]:
if self.heat_stages:
data[AZD_HEAT_STAGES] = self.get_heat_stages()

if self.speed:
data[AZD_SPEED] = self.speed
if self.speeds:
data[AZD_SPEEDS] = self.speeds

if len(self.errors) > 0:
data[AZD_ERRORS] = self.get_errors()

Expand Down Expand Up @@ -812,6 +828,14 @@ def get_problems(self) -> bool:
"""Return zone problems."""
return bool(self.errors)

def get_speed(self) -> int | None:
"""Return zone speed."""
return self.speed

def get_speeds(self) -> int | None:
"""Return zone speedS."""
return self.speeds

def get_system_id(self) -> int:
"""Return system ID."""
return self.system.get_id()
Expand Down

0 comments on commit 1ac5029

Please sign in to comment.