Skip to content

Commit

Permalink
Improve the support of the Air Humidifier CA1
Browse files Browse the repository at this point in the history
  • Loading branch information
syssi committed Oct 8, 2018
1 parent b769607 commit e976615
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions custom_components/fan/xiaomi_miio.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
'zhimi.airfresh.va2']),
})

REQUIREMENTS = ['python-miio>=0.4.2']
REQUIREMENTS = ['python-miio>=0.4.3']

ATTR_MODEL = 'model'

Expand Down Expand Up @@ -171,22 +171,26 @@
ATTR_BUTTON_PRESSED: 'button_pressed',
}

AVAILABLE_ATTRIBUTES_AIRHUMIDIFIER = {
AVAILABLE_ATTRIBUTES_AIRHUMIDIFIER_COMMON = {
ATTR_TEMPERATURE: 'temperature',
ATTR_HUMIDITY: 'humidity',
ATTR_MODE: 'mode',
ATTR_BUZZER: 'buzzer',
ATTR_CHILD_LOCK: 'child_lock',
ATTR_TRANS_LEVEL: 'trans_level',
ATTR_TARGET_HUMIDITY: 'target_humidity',
ATTR_LED_BRIGHTNESS: 'led_brightness',
ATTR_BUTTON_PRESSED: 'button_pressed',
ATTR_USE_TIME: 'use_time',
ATTR_HARDWARE_VERSION: 'hardware_version',
}

AVAILABLE_ATTRIBUTES_AIRHUMIDIFIER = {
**AVAILABLE_ATTRIBUTES_AIRHUMIDIFIER_COMMON,
ATTR_TRANS_LEVEL: 'trans_level',
ATTR_BUTTON_PRESSED: 'button_pressed',
}

AVAILABLE_ATTRIBUTES_AIRHUMIDIFIER_CA = {
**AVAILABLE_ATTRIBUTES_AIRHUMIDIFIER,
**AVAILABLE_ATTRIBUTES_AIRHUMIDIFIER_COMMON,
ATTR_SPEED: 'speed',
ATTR_DEPTH: 'depth',
ATTR_DRY: 'dry',
Expand Down Expand Up @@ -379,7 +383,7 @@ async def async_setup_platform(hass, config, async_add_entities,
device = XiaomiAirPurifier(name, air_purifier, model, unique_id)
elif model.startswith('zhimi.humidifier.'):
from miio import AirHumidifier
air_humidifier = AirHumidifier(host, token)
air_humidifier = AirHumidifier(host, token, model=model)
device = XiaomiAirHumidifier(name, air_humidifier, model, unique_id)
elif model.startswith('zhimi.airfresh.'):
from miio import AirFresh
Expand Down

0 comments on commit e976615

Please sign in to comment.