From c08c8c7996ed8cc1787a6403f88df1d37341f74b Mon Sep 17 00:00:00 2001 From: Sebastian Muszynski Date: Sun, 22 Oct 2017 11:02:01 +0200 Subject: [PATCH] Xiaomi Aqara: New xiaomi wireless button (sensor_switch.aq3) introduced (#10008) * New xiaomi wireless button (sensor_switch.aq3) introduced. * The next version of PyXiaomiGateway (0.5.3) is needed. --- .../components/binary_sensor/xiaomi_aqara.py | 13 +++---------- homeassistant/components/xiaomi_aqara.py | 2 +- requirements_all.txt | 2 +- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/homeassistant/components/binary_sensor/xiaomi_aqara.py b/homeassistant/components/binary_sensor/xiaomi_aqara.py index a610269cedf..1ff432a937f 100644 --- a/homeassistant/components/binary_sensor/xiaomi_aqara.py +++ b/homeassistant/components/binary_sensor/xiaomi_aqara.py @@ -25,13 +25,9 @@ def setup_platform(hass, config, add_devices, discovery_info=None): for (_, gateway) in hass.data[PY_XIAOMI_GATEWAY].gateways.items(): for device in gateway.devices['binary_sensor']: model = device['model'] - if model == 'motion': + if model in ['motion', 'sensor_motion.aq2']: devices.append(XiaomiMotionSensor(device, hass, gateway)) - elif model == 'sensor_motion.aq2': - devices.append(XiaomiMotionSensor(device, hass, gateway)) - elif model == 'magnet': - devices.append(XiaomiDoorSensor(device, gateway)) - elif model == 'sensor_magnet.aq2': + elif model in ['magnet', 'sensor_magnet.aq2']: devices.append(XiaomiDoorSensor(device, gateway)) elif model == 'sensor_wleak.aq1': devices.append(XiaomiWaterLeakSensor(device, gateway)) @@ -39,10 +35,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None): devices.append(XiaomiSmokeSensor(device, gateway)) elif model == 'natgas': devices.append(XiaomiNatgasSensor(device, gateway)) - elif model == 'switch': - devices.append(XiaomiButton(device, 'Switch', 'status', - hass, gateway)) - elif model == 'sensor_switch.aq2': + elif model in ['switch', 'sensor_switch.aq2', 'sensor_switch.aq3']: devices.append(XiaomiButton(device, 'Switch', 'status', hass, gateway)) elif model == '86sw1': diff --git a/homeassistant/components/xiaomi_aqara.py b/homeassistant/components/xiaomi_aqara.py index 700018ac29c..37187324184 100644 --- a/homeassistant/components/xiaomi_aqara.py +++ b/homeassistant/components/xiaomi_aqara.py @@ -8,7 +8,7 @@ from homeassistant.components.discovery import SERVICE_XIAOMI_GW from homeassistant.const import (ATTR_BATTERY_LEVEL, EVENT_HOMEASSISTANT_STOP, CONF_MAC, CONF_HOST, CONF_PORT) -REQUIREMENTS = ['PyXiaomiGateway==0.5.2'] +REQUIREMENTS = ['PyXiaomiGateway==0.5.3'] ATTR_GW_MAC = 'gw_mac' ATTR_RINGTONE_ID = 'ringtone_id' diff --git a/requirements_all.txt b/requirements_all.txt index e3dbfa34ab1..25f173629ad 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -37,7 +37,7 @@ PyMVGLive==1.1.4 PyMata==2.14 # homeassistant.components.xiaomi_aqara -PyXiaomiGateway==0.5.2 +PyXiaomiGateway==0.5.3 # homeassistant.components.rpi_gpio # RPi.GPIO==0.6.1