Skip to content

Commit

Permalink
Merge branch 'release/2024.7.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
syssi committed Jul 8, 2024
2 parents 48afb55 + 22944a5 commit 770be5c
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 47 deletions.
41 changes: 21 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,27 @@ Credits: Thanks to [Rytilahti](https://github.com/rytilahti/python-miio) for all

## Supported devices

| Name | Model | Model no. | Specs |
| ----------------------- | ---------------------- | --------- | ----- |
| Pedestal Fan Fan V2 | zhimi.fan.v2 | | |
| Pedestal Fan Fan V3 | zhimi.fan.v3 | | |
| Pedestal Fan Fan SA1 | zhimi.fan.sa1 | | |
| Pedestal Fan Fan ZA1 | zhimi.fan.za1 | | |
| Pedestal Fan Fan ZA3 | zhimi.fan.za3 | | |
| Pedestal Fan Fan ZA4 | zhimi.fan.za4 | ZLBPLDS04ZM | |
| Smartmi Standing Fan 3 | zhimi.fan.za5 | | |
| Pedestal Fan Fan 1C | dmaker.fan.1c | | |
| Pedestal Fan Fan P5 | dmaker.fan.p5 | | |
| Pedestal Fan Fan P8 | dmaker.fan.p8 | | |
| Pedestal Fan Fan P9 | dmaker.fan.p9 | | |
| Pedestal Fan Fan P10 | dmaker.fan.p10 | | |
| Mijia Pedestal Fan | dmaker.fan.p11 | BPLDS03DM | 2800mAh, 24W, <=58dB |
| Smart Standing Fan 2 Pro| dmaker.fan.p33 | BPLDS03DM | 2800mAh, 24W, <=58dB |
| Pedestal Fan Fan P15 | dmaker.fan.p15 | | |
| Mi Smart Standing Fan 2 | dmaker.fan.p18 | BPLDS02DM | AC, 15W, 30.2-55.8bB |
| Rosou SS4 Ventilator | leshow.fan.ss4 | | |
| Xiaomi Smart Tower Fan | dmaker.fan.p39 | BPTS01DM | 22W, <=63dB |
| Name | Model | Model no. | Specs |
| ----------------------------| ---------------------- | --------- | ----- |
| Pedestal Fan Fan V2 | zhimi.fan.v2 | | |
| Pedestal Fan Fan V3 | zhimi.fan.v3 | | |
| Pedestal Fan Fan SA1 | zhimi.fan.sa1 | | |
| Pedestal Fan Fan ZA1 | zhimi.fan.za1 | | |
| Pedestal Fan Fan ZA3 | zhimi.fan.za3 | | |
| Pedestal Fan Fan ZA4 | zhimi.fan.za4 | ZLBPLDS04ZM | |
| Smartmi Standing Fan 3 | zhimi.fan.za5 | | |
| Pedestal Fan Fan 1C | dmaker.fan.1c | | |
| Pedestal Fan Fan P5 | dmaker.fan.p5 | | |
| Pedestal Fan Fan P8 | dmaker.fan.p8 | | |
| Pedestal Fan Fan P9 | dmaker.fan.p9 | | |
| Pedestal Fan Fan P10 | dmaker.fan.p10 | | |
| Mijia Pedestal Fan | dmaker.fan.p11 | BPLDS03DM | 2800mAh, 24W, <=58dB |
| Smart Standing Fan 2 Pro | dmaker.fan.p33 | BPLDS03DM | 2800mAh, 24W, <=58dB |
| Pedestal Fan Fan P15 | dmaker.fan.p15 | | |
| Mi Smart Standing Fan 2 P18 | dmaker.fan.p18 | BPLDS02DM | AC, 15W, 30.2-55.8bB |
| Mi Smart Standing Fan 2 P30 | dmaker.fan.p30 | BPLDS02DM | AC, 15W, 30.2-55.8bB |
| Rosou SS4 Ventilator | leshow.fan.ss4 | | |
| Xiaomi Smart Tower Fan | dmaker.fan.p39 | BPTS01DM | 22W, <=63dB |


## Features
Expand Down
51 changes: 25 additions & 26 deletions custom_components/xiaomi_miio_fan/fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@
import voluptuous as vol
from homeassistant.components.fan import (
PLATFORM_SCHEMA,
SUPPORT_DIRECTION,
SUPPORT_OSCILLATE,
SUPPORT_PRESET_MODE,
SUPPORT_SET_SPEED,
FanEntity,
FanEntityFeature,
)

from homeassistant.const import (
ATTR_ENTITY_ID,
ATTR_MODE,
Expand Down Expand Up @@ -76,7 +74,8 @@
MODEL_FAN_P10 = "dmaker.fan.p10" # Pedestal Fan Fan P10
MODEL_FAN_P11 = "dmaker.fan.p11" # Mijia Pedestal Fan
MODEL_FAN_P15 = "dmaker.fan.p15" # Pedestal Fan Fan P15
MODEL_FAN_P18 = "dmaker.fan.p18" # Mi Smart Standing Fan 2
MODEL_FAN_P18 = "dmaker.fan.p18" # Mi Smart Standing Fan 2 P18
MODEL_FAN_P30 = "dmaker.fan.p30" # Mi Smart Standing Fan 2 P30
MODEL_FAN_P33 = "dmaker.fan.p33" # Mi Smart Standing Fan Pro 2
MODEL_FAN_P39 = "dmaker.fan.p39" # Smart Tower Fan
MODEL_FAN_LESHOW_SS4 = "leshow.fan.ss4"
Expand All @@ -103,6 +102,7 @@
MODEL_FAN_P11,
MODEL_FAN_P15,
MODEL_FAN_P18,
MODEL_FAN_P30,
MODEL_FAN_P33,
MODEL_FAN_P39,
MODEL_FAN_LESHOW_SS4,
Expand Down Expand Up @@ -480,7 +480,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
device = XiaomiFanMiot(
name, fan, model, unique_id, retries, preset_modes_override
)
elif model in [MODEL_FAN_P10, MODEL_FAN_P18]:
elif model in [MODEL_FAN_P10, MODEL_FAN_P18, MODEL_FAN_P30]:
fan = FanMiot(host, token, model=MODEL_FAN_P10)
device = XiaomiFanMiot(
name, fan, model, unique_id, retries, preset_modes_override
Expand Down Expand Up @@ -725,15 +725,14 @@ def __init__(self, name, device, model, unique_id, retries, preset_modes_overrid
self._state_attrs.update(
{attribute: None for attribute in self._available_attributes}
)

@property
def supported_features(self) -> int:
"""Supported features."""
return (
SUPPORT_SET_SPEED
| SUPPORT_PRESET_MODE
| SUPPORT_OSCILLATE
| SUPPORT_DIRECTION
FanEntityFeature.SET_SPEED
| FanEntityFeature.PRESET_MODE
| FanEntityFeature.OSCILLATE
| FanEntityFeature.DIRECTION
)

async def async_update(self):
Expand Down Expand Up @@ -1075,7 +1074,7 @@ async def async_set_delay_off(self, delay_off_countdown: int) -> None:


class XiaomiFanMiot(XiaomiFanP5):
"""Representation of a Xiaomi Pedestal Fan P9, P10, P11, P18."""
"""Representation of a Xiaomi Pedestal Fan P9, P10, P11, P18, P30."""

pass

Expand All @@ -1102,7 +1101,7 @@ def __init__(self, name, device, model, unique_id, retries, preset_modes_overrid
@property
def supported_features(self) -> int:
"""Supported features."""
return SUPPORT_SET_SPEED | SUPPORT_PRESET_MODE | SUPPORT_OSCILLATE
return FanEntityFeature.SET_SPEED | FanEntityFeature.PRESET_MODE | FanEntityFeature.OSCILLATE

async def async_update(self):
"""Fetch state from the device."""
Expand Down Expand Up @@ -1240,7 +1239,7 @@ def __init__(self, name, device, model, unique_id, retries, preset_modes_overrid
@property
def supported_features(self) -> int:
"""Supported features."""
return SUPPORT_SET_SPEED | SUPPORT_PRESET_MODE | SUPPORT_OSCILLATE
return FanEntityFeature.SET_SPEED | FanEntityFeature.PRESET_MODE | FanEntityFeature.OSCILLATE

async def async_update(self):
"""Fetch state from the device."""
Expand Down Expand Up @@ -1416,10 +1415,10 @@ def __init__(self, name, device, model, unique_id, retries, preset_modes_overrid
@property
def supported_features(self) -> int:
return (
SUPPORT_DIRECTION
| SUPPORT_OSCILLATE
| SUPPORT_PRESET_MODE
| SUPPORT_SET_SPEED
FanEntityFeature.DIRECTION
| FanEntityFeature.OSCILLATE
| FanEntityFeature.PRESET_MODE
| FanEntityFeature.SET_SPEED
)

async def async_update(self):
Expand Down Expand Up @@ -1857,10 +1856,10 @@ def __init__(self, name, device, model, unique_id, retries, preset_modes_overrid
@property
def supported_features(self) -> int:
return (
SUPPORT_DIRECTION
| SUPPORT_OSCILLATE
| SUPPORT_PRESET_MODE
| SUPPORT_SET_SPEED
FanEntityFeature.DIRECTION
| FanEntityFeature.OSCILLATE
| FanEntityFeature.PRESET_MODE
| FanEntityFeature.SET_SPEED
)

"""
Expand Down Expand Up @@ -2164,10 +2163,10 @@ def __init__(self, name, device, model, unique_id, retries, preset_modes_overrid
@property
def supported_features(self) -> int:
return (
SUPPORT_DIRECTION
| SUPPORT_OSCILLATE
| SUPPORT_PRESET_MODE
| SUPPORT_SET_SPEED
FanEntityFeature.DIRECTION
| FanEntityFeature.OSCILLATE
| FanEntityFeature.PRESET_MODE
| FanEntityFeature.SET_SPEED
)

async def async_update(self):
Expand Down
2 changes: 1 addition & 1 deletion custom_components/xiaomi_miio_fan/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
"construct==2.10.68",
"python-miio>=0.5.12"
],
"version": "2023.12.0.0"
"version": "2024.7.0.0"
}

0 comments on commit 770be5c

Please sign in to comment.