Skip to content

Commit

Permalink
Merge branch 'release/0.3.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
syssi committed May 8, 2021
2 parents cc12fc9 + efcf462 commit b4dc9a6
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 10 deletions.
25 changes: 15 additions & 10 deletions custom_components/xiaomi_miio_fan/fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -682,20 +682,25 @@ async def async_set_percentage(self, percentage: int) -> None:

async def async_set_direction(self, direction: str) -> None:
"""Set the direction of the fan."""
if direction in ["left", "right"]:
if self._oscillate:
await self._try_command(
"Setting oscillate off of the miio device failed.",
self._device.set_oscillate,
False,
)
if direction == 'forward':
direction = 'right'

if direction == 'reverse':
direction = 'left'

if self._oscillate:
await self._try_command(
"Setting move direction of the miio device failed.",
self._device.set_rotate,
FanMoveDirection(direction),
"Setting oscillate off of the miio device failed.",
self._device.set_oscillate,
False,
)

await self._try_command(
"Setting move direction of the miio device failed.",
self._device.set_rotate,
FanMoveDirection(direction),
)

@property
def oscillating(self):
"""Return the oscillation state."""
Expand Down
1 change: 1 addition & 0 deletions custom_components/xiaomi_miio_fan/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"version": "0.3.3",
"iot_class": "local_polling",
"documentation": "https://github.com/syssi/xiaomi_fan",
"issue_tracker": "https://github.com/syssi/xiaomi_fan/issues",
"requirements": [
"construct==2.10.56",
"python-miio>=0.5.6"
Expand Down
71 changes: 71 additions & 0 deletions custom_components/xiaomi_miio_fan/services.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
fan_set_buzzer_on:
description: Turn the buzzer on.
fields:
entity_id:
description: Name of the xiaomi miio entity.
example: "xiaomi_miio_fan.xiaomi_miio_device"

fan_set_buzzer_off:
description: Turn the buzzer off.
fields:
entity_id:
description: Name of the xiaomi miio entity.
example: "xiaomi_miio_fan.xiaomi_miio_device"

fan_set_child_lock_on:
description: Turn the child lock on.
fields:
entity_id:
description: Name of the xiaomi miio entity.
example: "xiaomi_miio_fan.xiaomi_miio_device"

fan_set_child_lock_off:
description: Turn the child lock off.
fields:
entity_id:
description: Name of the xiaomi miio entity.
example: "xiaomi_miio_fan.xiaomi_miio_device"

fan_set_led_brightness:
description: Set the led brightness.
fields:
entity_id:
description: Name of the xiaomi miio entity.
example: "xiaomi_miio_fan.xiaomi_miio_device"
brightness:
description: Brightness (0 = Bright, 1 = Dim, 2 = Off)
example: 1

fan_set_natural_mode_on:
description: Turn the natural mode on.
fields:
entity_id:
description: Name of the xiaomi miio entity.
example: "xiaomi_miio_fan.xiaomi_miio_device"

fan_set_natural_mode_off:
description: Turn the natural mode off.
fields:
entity_id:
description: Name of the xiaomi miio entity.
example: "xiaomi_miio_fan.xiaomi_miio_device"

fan_set_oscillation_angle:
description: Set the oscillation angle.
fields:
entity_id:
description: Name of the xiaomi miio entity.
example: "xiaomi_miio_fan.xiaomi_miio_device"
angle:
description: Supported values are 30, 60, 90, 120, 140 or 150 degrees.
example: 30

fan_set_delay_off:
description: Set the scheduled turn off time.
fields:
entity_id:
description: Name of the xiaomi miio entity.
example: "xiaomi_miio_fan.xiaomi_miio_device"
delay_off_countdown:
description: Time in minutes. Valid values are 0, 60, 120, 180, 240, 300, 240, 300, 360, 420, 480 minutes.
example: 60

0 comments on commit b4dc9a6

Please sign in to comment.