Skip to content

Commit

Permalink
device: add new cold/heat demand parameters
Browse files Browse the repository at this point in the history
These parameters have been introduced in the latest Airzone API updates.

Signed-off-by: Álvaro Fernández Rojas <[email protected]>
  • Loading branch information
Noltari committed May 16, 2023
1 parent 2c94013 commit ad22fce
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
4 changes: 4 additions & 0 deletions aioairzone/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
API_AIR_DEMAND = "air_demand"
API_ANTI_FREEZE = "antifreeze"
API_COLD_ANGLE = "coldangle"
API_COLD_DEMAND = "cold_demand"
API_COLD_STAGE = "coldStage"
API_COLD_STAGES = "coldStages"
API_COOL_MAX_TEMP = "coolmaxtemp"
Expand All @@ -17,6 +18,7 @@
API_ERRORS = "errors"
API_FLOOR_DEMAND = "floor_demand"
API_HEAT_ANGLE = "heatangle"
API_HEAT_DEMAND = "heat_demand"
API_HEAT_MAX_TEMP = "heatmaxtemp"
API_HEAT_MIN_TEMP = "heatmintemp"
API_HEAT_SET_POINT = "heatsetpoint"
Expand Down Expand Up @@ -106,6 +108,7 @@
AZD_BATTERY_LOW = "battery-low"
AZD_CLAMP_METER = "clamp-meter"
AZD_COLD_ANGLE = "cold-angle"
AZD_COLD_DEMAND = "cold-demand"
AZD_COLD_STAGE = "cold-stage"
AZD_COLD_STAGES = "cold-stages"
AZD_COOL_TEMP_MAX = "cool-temp-max"
Expand All @@ -120,6 +123,7 @@
AZD_FULL_NAME = "full-name"
AZD_FLOOR_DEMAND = "floor-demand"
AZD_HEAT_ANGLE = "heat-angle"
AZD_HEAT_DEMAND = "heat-demand"
AZD_HEAT_TEMP_MAX = "heat-temp-max"
AZD_HEAT_TEMP_MIN = "heat-temp-min"
AZD_HEAT_TEMP_SET = "heat-temp-set"
Expand Down
26 changes: 26 additions & 0 deletions aioairzone/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
API_AIR_DEMAND,
API_ANTI_FREEZE,
API_COLD_ANGLE,
API_COLD_DEMAND,
API_COLD_STAGE,
API_COLD_STAGES,
API_COOL_MAX_TEMP,
Expand All @@ -31,6 +32,7 @@
API_ERRORS,
API_FLOOR_DEMAND,
API_HEAT_ANGLE,
API_HEAT_DEMAND,
API_HEAT_MAX_TEMP,
API_HEAT_MIN_TEMP,
API_HEAT_SET_POINT,
Expand Down Expand Up @@ -69,6 +71,7 @@
AZD_BATTERY_LOW,
AZD_CLAMP_METER,
AZD_COLD_ANGLE,
AZD_COLD_DEMAND,
AZD_COLD_STAGE,
AZD_COLD_STAGES,
AZD_COOL_TEMP_MAX,
Expand All @@ -83,6 +86,7 @@
AZD_FLOOR_DEMAND,
AZD_FULL_NAME,
AZD_HEAT_ANGLE,
AZD_HEAT_DEMAND,
AZD_HEAT_STAGE,
AZD_HEAT_STAGES,
AZD_HEAT_TEMP_MAX,
Expand Down Expand Up @@ -369,6 +373,7 @@ def __init__(self, system: System, zone: dict[str, Any]):
self.air_demand: bool | None = None
self.anti_freeze: bool | None = None
self.cold_angle: GrilleAngle | None = None
self.cold_demand: bool | None = None
self.cold_stage: AirzoneStages | None = None
self.cold_stages: list[AirzoneStages] = []
self.cool_temp_max: float | None = None
Expand All @@ -380,6 +385,7 @@ def __init__(self, system: System, zone: dict[str, Any]):
self.errors: list[str] = []
self.floor_demand: bool | None = None
self.heat_angle: GrilleAngle | None = None
self.heat_demand: bool | None = None
self.heat_temp_max: float | None = None
self.heat_temp_min: float | None = None
self.heat_temp_set: float | None = None
Expand Down Expand Up @@ -416,6 +422,11 @@ def __init__(self, system: System, zone: dict[str, Any]):
if API_ANTI_FREEZE in zone:
self.anti_freeze = bool(zone[API_ANTI_FREEZE])

if API_COLD_DEMAND in zone:
self.cold_demand = bool(zone[API_COLD_DEMAND])
if API_HEAT_DEMAND in zone:
self.heat_demand = bool(zone[API_HEAT_DEMAND])

if API_DOUBLE_SET_POINT in zone:
self.double_set_point = bool(zone[API_DOUBLE_SET_POINT])

Expand Down Expand Up @@ -582,6 +593,13 @@ def data(self) -> dict[str, Any]:
if heat_angle is not None:
data[AZD_HEAT_ANGLE] = heat_angle

cold_demand = self.get_cold_demand()
if cold_demand is not None:
data[AZD_COLD_DEMAND] = cold_demand
heat_demand = self.get_heat_demand()
if heat_demand is not None:
data[AZD_HEAT_DEMAND] = heat_demand

cold_stage = self.get_cold_stage()
if cold_stage is not None:
data[AZD_COLD_STAGE] = cold_stage
Expand Down Expand Up @@ -748,6 +766,10 @@ def get_cold_angle(self) -> GrilleAngle | None:
"""Return zone cold angle."""
return self.cold_angle

def get_cold_demand(self) -> bool | None:
"""Return zone cold demand."""
return self.cold_demand

def get_cold_stage(self) -> AirzoneStages | None:
"""Return zone cold stage."""
return self.cold_stage
Expand Down Expand Up @@ -816,6 +838,10 @@ def get_heat_angle(self) -> GrilleAngle | None:
"""Return zone heat angle."""
return self.heat_angle

def get_heat_demand(self) -> bool | None:
"""Return zone heat demand."""
return self.heat_demand

def get_heat_stage(self) -> AirzoneStages | None:
"""Return zone heat stage."""
return self.heat_stage
Expand Down
1 change: 1 addition & 0 deletions pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ disable=
C0103,
R0801,
R0914
max-module-lines = 2000

[REPORTS]
score=no
Expand Down

0 comments on commit ad22fce

Please sign in to comment.