Skip to content

Commit

Permalink
Override oscillation ranges with device-specific information
Browse files Browse the repository at this point in the history
relates #106
relates #115
  • Loading branch information
Airblader committed Sep 13, 2024
1 parent a3a05ca commit 0de3cd1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
16 changes: 16 additions & 0 deletions custom_components/dreo/pydreo/pydreoaircirculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,14 @@ def horizontally_oscillating(self, value: bool) -> None:
else:
raise NotImplementedError("Horizontal oscillation is not supported.")

@property
def horizontal_osc_angle_left_range(self):
return self.horizontal_angle_range

@property
def horizontal_osc_angle_right_range(self):
return self.horizontal_angle_range

@property
def vertically_oscillating(self):
"""Returns `True` if vertical oscillation is on."""
Expand All @@ -210,6 +218,14 @@ def vertically_oscillating(self, value: bool) -> None:
else:
raise NotImplementedError("Vertical oscillation is not supported.")

@property
def vertical_osc_angle_top_range(self):
return self.vertical_angle_range

@property
def vertical_osc_angle_bottom_range(self):
return self.vertical_angle_range

def set_horizontal_oscillation_angle(self, angle: int) -> None:
"""Set the horizontal oscillation angle."""
_LOGGER.debug("PyDreoAirCirculatorFan:set_horizontal_oscillation_angle")
Expand Down
4 changes: 4 additions & 0 deletions tests/pydreo/test_pydreoaircirculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ def test_HAF004S(self): # pylint: disable=invalid-name
assert fan.preset_modes == ['normal', 'natural', 'sleep', 'auto', 'turbo', 'custom']
assert fan.oscillating is True
assert fan.vertically_oscillating is True
assert fan.vertical_osc_angle_top_range == (-30, 90)
assert fan.vertical_osc_angle_bottom_range == (-30, 90)
assert fan.horizontally_oscillating is False
assert fan.horizontal_osc_angle_left_range == (-60, 60)
assert fan.horizontal_osc_angle_right_range == (-60, 60)

with patch(PATCH_SEND_COMMAND) as mock_send_command:
fan.is_on = True
Expand Down

0 comments on commit 0de3cd1

Please sign in to comment.