Skip to content

Commit

Permalink
Merge branch 'release/2022.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
syssi committed Mar 3, 2022
2 parents d430358 + a69fa4d commit e4812e9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
29 changes: 15 additions & 14 deletions custom_components/xiaomi_miio_fan/fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import homeassistant.helpers.config_validation as cv
import voluptuous as vol
from homeassistant.components.fan import (
ATTR_SPEED,
PLATFORM_SCHEMA,
SPEED_OFF,
SUPPORT_DIRECTION,
Expand Down Expand Up @@ -46,14 +45,15 @@
FanP11,
)
from miio.miot_device import MiotDevice, DeviceStatus
from miio.fan import (
from miio.fan_common import (
LedBrightness as FanLedBrightness, # pylint: disable=import-error, import-error
MoveDirection as FanMoveDirection,
OperationMode as FanOperationMode,
FanException,
)
from miio.fan import MoveDirection as FanMoveDirection
from miio.fan_leshow import (
from miio.integrations.fan.leshow.fan_leshow import (
OperationMode as FanLeshowOperationMode, # pylint: disable=import-error, import-error
)
from miio.fan_miot import OperationModeMiot as FanOperationModeMiot

_LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -902,7 +902,7 @@ async def async_update(self):
self._available = True
self._percentage = state.speed
self._oscillate = state.oscillate
self._natural_mode = state.mode == FanOperationModeMiot.Nature
self._natural_mode = state.mode == FanOperationMode.Nature
self._state = state.is_on

for preset_mode, range in FAN_PRESET_MODES.items():
Expand Down Expand Up @@ -973,7 +973,7 @@ async def async_set_natural_mode_on(self):
await self._try_command(
"Turning on natural mode of the miio device failed.",
self._device.set_mode,
FanOperationModeMiot.Nature,
FanOperationMode.Nature,
)

async def async_set_natural_mode_off(self):
Expand All @@ -984,7 +984,7 @@ async def async_set_natural_mode_off(self):
await self._try_command(
"Turning on natural mode of the miio device failed.",
self._device.set_mode,
FanOperationModeMiot.Normal,
FanOperationMode.Normal,
)

async def async_set_delay_off(self, delay_off_countdown: int) -> None:
Expand All @@ -1001,6 +1001,7 @@ class XiaomiFanMiot(XiaomiFanP5):
"""Representation of a Xiaomi Pedestal Fan P9, P10, P11, P18."""
pass


class XiaomiFanLeshow(XiaomiGenericDevice):
"""Representation of a Xiaomi Fan Leshow SS4."""

Expand Down Expand Up @@ -1302,7 +1303,7 @@ async def async_set_natural_mode_on(self):
await self._try_command(
"Setting fan natural mode of the miio device failed.",
self._device.set_mode,
FanOperationModeMiot.Nature,
FanOperationMode.Nature,
)

async def async_set_natural_mode_off(self):
Expand All @@ -1313,7 +1314,7 @@ async def async_set_natural_mode_off(self):
await self._try_command(
"Setting fan natural mode of the miio device failed.",
self._device.set_mode,
FanOperationModeMiot.Normal,
FanOperationMode.Normal,
)


Expand Down Expand Up @@ -1355,7 +1356,7 @@ async def async_update(self):
self._available = True
self._percentage = state.fan_speed
self._oscillate = state.swing_mode
self._natural_mode = state.mode == FanOperationModeMiot.Nature
self._natural_mode = state.mode == FanOperationMode.Nature
self._state = state.power

for preset_mode, value in FAN_PRESET_MODES_ZA5.items():
Expand Down Expand Up @@ -1470,7 +1471,7 @@ async def async_set_natural_mode_on(self):
await self._try_command(
"Setting fan natural mode of the miio device failed.",
self._device.set_mode,
FanOperationModeMiot.Nature,
FanOperationMode.Nature,
)

async def async_set_natural_mode_off(self):
Expand All @@ -1481,7 +1482,7 @@ async def async_set_natural_mode_off(self):
await self._try_command(
"Setting fan natural mode of the miio device failed.",
self._device.set_mode,
FanOperationModeMiot.Normal,
FanOperationMode.Normal,
)

async def async_set_led_brightness(self, brightness: int = 2):
Expand Down Expand Up @@ -1736,7 +1737,7 @@ def set_light(self, light: int):

return self.set_property("light", light)

def set_mode(self, mode: FanOperationModeMiot):
def set_mode(self, mode: FanOperationMode):
"""Set mode."""
return self.set_property("mode", OperationModeFanZA5[mode.name].value)

Expand Down
4 changes: 2 additions & 2 deletions custom_components/xiaomi_miio_fan/manifest.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"domain": "xiaomi_miio_fan",
"name": "Xiaomi Mi Smart Pedestal Fan",
"version": "0.5.4",
"version": "2022.3.0",
"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.9.2"
"python-miio>=0.5.10"
],
"dependencies": [],
"codeowners": [
Expand Down

0 comments on commit e4812e9

Please sign in to comment.