diff --git a/custom_components/xiaomi_miio_fan/fan.py b/custom_components/xiaomi_miio_fan/fan.py index 1f848c5..ab16aff 100644 --- a/custom_components/xiaomi_miio_fan/fan.py +++ b/custom_components/xiaomi_miio_fan/fan.py @@ -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.""" diff --git a/custom_components/xiaomi_miio_fan/manifest.json b/custom_components/xiaomi_miio_fan/manifest.json index df26d41..9eb9ca0 100644 --- a/custom_components/xiaomi_miio_fan/manifest.json +++ b/custom_components/xiaomi_miio_fan/manifest.json @@ -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" diff --git a/custom_components/xiaomi_miio_fan/services.yaml b/custom_components/xiaomi_miio_fan/services.yaml new file mode 100644 index 0000000..610c6f5 --- /dev/null +++ b/custom_components/xiaomi_miio_fan/services.yaml @@ -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