Skip to content

Commit

Permalink
Merge pull request #77 from EtienneSOU/add-zone-properties
Browse files Browse the repository at this point in the history
add fanlevel, vertical swing and horizontal swing to zone class
  • Loading branch information
wmalgadey authored May 5, 2024
2 parents c84aea8 + 136613f commit 50fda73
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions PyTado/zone.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
TADO_HVAC_ACTION_TO_MODES,
TADO_MODES_TO_HVAC_ACTION,
TYPE_AIR_CONDITIONING,
CONST_VERTICAL_SWING_OFF,
CONST_HORIZONTAL_SWING_OFF,
CONST_FAN_SPEED_AUTO,
CONST_FAN_SPEED_OFF,
)

_LOGGER = logging.getLogger(__name__)
Expand All @@ -35,8 +39,11 @@ def __init__(self, data, zone_id):
self._is_away = False
self._current_hvac_action = None
self._current_fan_speed = None
self._current_fan_level = None
self._current_hvac_mode = None
self._current_swing_mode = None
self._current_vertical_swing_mode = None
self._current_horizontal_swing_mode = None
self._target_temp = None
self._available = False
self._power = None
Expand Down Expand Up @@ -169,6 +176,11 @@ def current_fan_speed(self):
"""TADO Fan speed (tado const)."""
return self._current_fan_speed

@property
def current_fan_level(self):
"""TADO Fan level (tado const)."""
return self._current_fan_level

@property
def link(self):
"""Link (internet connection state)."""
Expand All @@ -189,6 +201,16 @@ def current_swing_mode(self):
"""TADO SWING Mode (tado const)."""
return self._current_swing_mode

@property
def current_vertical_swing_mode(self):
"""TADO VERTICAL SWING Mode (tado const)."""
return self._current_vertical_swing_mode

@property
def current_horizontal_swing_mode(self):
"""TADO HORIZONTAL SWING Mode (tado const)."""
return self._current_horizontal_swing_mode

@property
def target_temp(self):
"""Target temperature (C)."""
Expand Down Expand Up @@ -255,10 +277,13 @@ def update_data(self, data):
setting = data["setting"]

self._current_fan_speed = None
self._current_fan_level = None
# If there is no overlay, the mode will always be
# "SMART_SCHEDULE"
self._current_hvac_mode = CONST_MODE_OFF
self._current_swing_mode = CONST_MODE_OFF
self._current_vertical_swing_mode = CONST_VERTICAL_SWING_OFF
self._current_horizontal_swing_mode = CONST_HORIZONTAL_SWING_OFF

if "mode" in setting:
# v3 devices use mode
Expand All @@ -267,6 +292,12 @@ def update_data(self, data):
if "swing" in setting:
self._current_swing_mode = setting["swing"]

if "verticalSwing" in setting:
self._current_vertical_swing_mode = setting["verticalSwing"]

if "horizontalSwing" in setting:
self._current_horizontal_swing_mode = setting["horizontalSwing"]

self._power = setting["power"]
if self._power == "ON":
self._current_hvac_action = CONST_HVAC_IDLE
Expand All @@ -288,6 +319,11 @@ def update_data(self, data):
CONST_FAN_AUTO if self._power == "ON" else CONST_FAN_OFF
)

if "fanLevel" in setting:
self._current_fan_level = setting.get(
"fanLevel", CONST_FAN_SPEED_AUTO if self._power == "ON" else CONST_FAN_SPEED_OFF
)

self._preparation = "preparation" in data and data["preparation"] is not None
self._open_window = "openWindow" in data and data["openWindow"] is not None
self._open_window_detected = (
Expand Down

0 comments on commit 50fda73

Please sign in to comment.