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 5f7d9cc + 7e1ad17 commit d9dae03
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ This custom component is more or less the beta version of the [official componen
| Air Dog X5 | airdog.airpurifier.x5 | | |
| Air Dog X7SM | airdog.airpurifier.x7sm | | |
| Air Humidifier | zhimi.humidifier.v1 | | |
| Air Humidifier CA1 | [zhimi.humidifier.ca1](docs/zhimi.humidifier.ca1.yaml) | | |
| Air Humidifier CA1 | [zhimi.humidifier.ca1](docs/zhimi.humidifier.ca1.yaml) | CJXJSQ02ZM, SKV6001RT | 8W, 240x240x363mm |
| Smartmi Humidifier Evaporator 2 | zhimi.humidifier.ca4 | CJXJSQ04ZM | |
| Smartmi Evaporative Humidifier | zhimi.humidifier.cb1 | CJXJSQ02ZM, SKV6001EU | 8W, 240x240x363mm |
| Smartmi Evaporative Humidifier (Korea Version) | zhimi.humidifier.cb2 | CJXJSQ02ZM | 8W, 240x240x363mm |
| Mijia Smart Sterilization Humidifier S | deerma.humidifier.mjjsq | MJJSQ03DY | 4.5L, <=39dB, 450mL/h, 40W |
| Mijia Intelligent Sterilization Humidifier (EU version?) | deerma.humidifier.jsq | ZNJSQ01DEM | 4.5L, <=38dB, 300mL/h, 24W |
| Mijia Intelligent Sterilization Humidifier (EU version?) | deerma.humidifier.jsq5 | ZNJSQ01DEM | 4.5L, <=38dB, 300mL/h, 24W |
Expand Down
23 changes: 16 additions & 7 deletions custom_components/xiaomi_miio_airpurifier/fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,14 @@
LedBrightness as AirpurifierMiotLedBrightness,
OperationMode as AirpurifierMiotOperationMode,
)
from miio.fan import ( # pylint: disable=import-error, import-error
from miio.fan_common import ( # pylint: disable=import-error, import-error
LedBrightness as FanLedBrightness,
MoveDirection as FanMoveDirection,
OperationMode as FanOperationMode,
)
from miio.fan_leshow import ( # pylint: disable=import-error, import-error
from miio.integrations.fan.leshow.fan_leshow import ( # pylint: disable=import-error, import-error
OperationMode as FanLeshowOperationMode,
)
from miio.fan_miot import OperationModeMiot as FanOperationModeMiot
import voluptuous as vol

from homeassistant.components.fan import (
Expand Down Expand Up @@ -134,6 +133,7 @@
MODEL_AIRHUMIDIFIER_CA1 = "zhimi.humidifier.ca1"
MODEL_AIRHUMIDIFIER_CA4 = "zhimi.humidifier.ca4"
MODEL_AIRHUMIDIFIER_CB1 = "zhimi.humidifier.cb1"
MODEL_AIRHUMIDIFIER_CB2 = "zhimi.humidifier.cb2"
MODEL_AIRHUMIDIFIER_MJJSQ = "deerma.humidifier.mjjsq"
MODEL_AIRHUMIDIFIER_JSQ = "deerma.humidifier.jsq"
MODEL_AIRHUMIDIFIER_JSQ1 = "deerma.humidifier.jsq1"
Expand Down Expand Up @@ -190,6 +190,7 @@
MODEL_AIRHUMIDIFIER_CA1,
MODEL_AIRHUMIDIFIER_CA4,
MODEL_AIRHUMIDIFIER_CB1,
MODEL_AIRHUMIDIFIER_CB2,
MODEL_AIRHUMIDIFIER_MJJSQ,
MODEL_AIRHUMIDIFIER_JSQ,
MODEL_AIRHUMIDIFIER_JSQ1,
Expand Down Expand Up @@ -549,7 +550,11 @@
ATTR_EXTRA_FEATURES: "extra_features",
}

AVAILABLE_ATTRIBUTES_AIRFRESH_VA4 = {**AVAILABLE_ATTRIBUTES_AIRFRESH, ATTR_PTC: "ptc", ATTR_NTC_TEMPERATURE: "ntc_temperature"}
AVAILABLE_ATTRIBUTES_AIRFRESH_VA4 = {
**AVAILABLE_ATTRIBUTES_AIRFRESH,
ATTR_PTC: "ptc",
ATTR_NTC_TEMPERATURE: "ntc_temperature",
}

AVAILABLE_ATTRIBUTES_AIRFRESH_A1 = {
ATTR_POWER: "power",
Expand Down Expand Up @@ -1637,7 +1642,11 @@ def __init__(self, name, device, model, unique_id):
"""Initialize the plug switch."""
super().__init__(name, device, model, unique_id)

if self._model in [MODEL_AIRHUMIDIFIER_CA1, MODEL_AIRHUMIDIFIER_CB1]:
if self._model in [
MODEL_AIRHUMIDIFIER_CA1,
MODEL_AIRHUMIDIFIER_CB1,
MODEL_AIRHUMIDIFIER_CB2,
]:
self._device_features = FEATURE_FLAGS_AIRHUMIDIFIER_CA_AND_CB
self._available_attributes = AVAILABLE_ATTRIBUTES_AIRHUMIDIFIER_CA_AND_CB
self._preset_modes = [
Expand Down Expand Up @@ -2904,7 +2913,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 @@ -2915,7 +2924,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
4 changes: 2 additions & 2 deletions custom_components/xiaomi_miio_airpurifier/manifest.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"domain": "xiaomi_miio_airpurifier",
"name": "Xiaomi Mi Air Purifier, Air Humidifier, Air Fresh and Pedestal Fan Integration",
"version": "0.6.17",
"version": "2022.3.0",
"iot_class": "local_polling",
"config_flow": false,
"documentation": "https://github.com/syssi/xiaomi_airpurifier",
"issue_tracker": "https://github.com/syssi/xiaomi_airpurifier/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 d9dae03

Please sign in to comment.