From 528988a192c9af9d78e55922e2885fbab7850d84 Mon Sep 17 00:00:00 2001 From: Daniel Lashua Date: Mon, 12 Dec 2016 07:21:27 -0600 Subject: [PATCH 01/19] UNIT and ID type changes allow UNIT and ID to contain alphanumeric characters --- homeassistant/components/switch/pilight.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/switch/pilight.py b/homeassistant/components/switch/pilight.py index 84cbbd9fb0e858..c55378406c1462 100644 --- a/homeassistant/components/switch/pilight.py +++ b/homeassistant/components/switch/pilight.py @@ -30,9 +30,9 @@ vol.Optional(CONF_PROTOCOL): cv.string, vol.Optional('on'): cv.positive_int, vol.Optional('off'): cv.positive_int, - vol.Optional(CONF_UNIT): cv.positive_int, + vol.Optional(CONF_UNIT): cv.string, vol.Optional(CONF_UNITCODE): cv.positive_int, - vol.Optional(CONF_ID): cv.positive_int, + vol.Optional(CONF_ID): cv.string, vol.Optional(CONF_STATE): cv.string, vol.Optional(CONF_SYSTEMCODE): cv.positive_int, }, extra=vol.ALLOW_EXTRA) From 186984c0d5a4285695e38d3a824b31471a9953b6 Mon Sep 17 00:00:00 2001 From: Daniel Lashua Date: Tue, 13 Dec 2016 16:55:22 -0600 Subject: [PATCH 02/19] make unit a positive int --- homeassistant/components/switch/pilight.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/switch/pilight.py b/homeassistant/components/switch/pilight.py index c55378406c1462..4a0f757a59ed3d 100644 --- a/homeassistant/components/switch/pilight.py +++ b/homeassistant/components/switch/pilight.py @@ -30,7 +30,7 @@ vol.Optional(CONF_PROTOCOL): cv.string, vol.Optional('on'): cv.positive_int, vol.Optional('off'): cv.positive_int, - vol.Optional(CONF_UNIT): cv.string, + vol.Optional(CONF_UNIT): cv.positive_int, vol.Optional(CONF_UNITCODE): cv.positive_int, vol.Optional(CONF_ID): cv.string, vol.Optional(CONF_STATE): cv.string, From 3d5690b9ffd820bf437b7cb617139dd567037d06 Mon Sep 17 00:00:00 2001 From: Daniel Lashua Date: Tue, 4 Sep 2018 12:41:10 -0500 Subject: [PATCH 03/19] Support Xiaomi Vibration Sensor --- .../components/binary_sensor/xiaomi_aqara.py | 45 +++++++++++++++++++ .../components/sensor/xiaomi_aqara.py | 13 ++++++ 2 files changed, 58 insertions(+) diff --git a/homeassistant/components/binary_sensor/xiaomi_aqara.py b/homeassistant/components/binary_sensor/xiaomi_aqara.py index 730b662b90b8a9..83363acd187cc7 100644 --- a/homeassistant/components/binary_sensor/xiaomi_aqara.py +++ b/homeassistant/components/binary_sensor/xiaomi_aqara.py @@ -65,6 +65,9 @@ def setup_platform(hass, config, add_entities, discovery_info=None): 'dual_channel', hass, gateway)) elif model in ['cube', 'sensor_cube', 'sensor_cube.aqgl01']: devices.append(XiaomiCube(device, hass, gateway)) + elif model in ['vibration']: + devices.append(XiaomiVibration(device, 'Vibration', + 'status', hass, gateway)) add_entities(devices) @@ -311,6 +314,48 @@ def parse_data(self, data, raw_data): return False +class XiaomiVibration(XiaomiBinarySensor): + """Representation of a Xiaomi Vibration Sensor.""" + + def __init__(self, device, name, data_key, hass, xiaomi_hub): + """Initialize the XiaomiVibration.""" + self._hass = hass + self._last_action = None + XiaomiBinarySensor.__init__(self, device, name, xiaomi_hub, + data_key, None) + + @property + def device_state_attributes(self): + """Return the state attributes.""" + attrs = {ATTR_LAST_ACTION: self._last_action} + attrs.update(super().device_state_attributes) + return attrs + + def parse_data(self, data, raw_data): + """Parse data sent by gateway.""" + value = data.get(self._data_key) + if value is None: + return False + + if value == 'vibrate': + movement_type = 'vibrate' + elif value == 'tilt': + movement_type = 'tilt' + elif value == "free_fall": + movement_type = 'free_fall' + else: + _LOGGER.warning("Unsupported movement_type detected: %s", value) + return False + + self._hass.bus.fire('movement', { + 'entity_id': self.entity_id, + 'movement_type': movement_type + }) + self._last_action = movement_type + + return True + + class XiaomiButton(XiaomiBinarySensor): """Representation of a Xiaomi Button.""" diff --git a/homeassistant/components/sensor/xiaomi_aqara.py b/homeassistant/components/sensor/xiaomi_aqara.py index 8a3a11db05148c..5248433ef00341 100644 --- a/homeassistant/components/sensor/xiaomi_aqara.py +++ b/homeassistant/components/sensor/xiaomi_aqara.py @@ -41,6 +41,16 @@ def setup_platform(hass, config, add_entities, discovery_info=None): elif device['model'] in ['gateway', 'gateway.v3', 'acpartner.v3']: devices.append(XiaomiSensor(device, 'Illumination', 'illumination', gateway)) + elif device['model'] in ['vibration']: + devices.append(XiaomiSensor(device, 'Bed Activity', + 'bed_activity', gateway)) + devices.append(XiaomiSensor(device, 'Tilt Angle', + 'final_tilt_angle',gateway)) + devices.append(XiaomiSensor(device, 'Coordination', + 'coordination', gateway)) + else: + _LOGGER.warn("Unmapped Device Model ") + _LOGGER.warn(device) add_entities(devices) @@ -84,6 +94,9 @@ def parse_data(self, data, raw_data): value = data.get(self._data_key) if value is None: return False + if self._data_key in ['coordination','status']: + self._state = value + return True value = float(value) if self._data_key in ['temperature', 'humidity', 'pressure']: value /= 100 From 9e36434a9f0762661209aa9f8c935d4a3d093b16 Mon Sep 17 00:00:00 2001 From: Daniel Lashua Date: Tue, 4 Sep 2018 12:51:35 -0500 Subject: [PATCH 04/19] adding whitespace before comma --- homeassistant/components/sensor/xiaomi_aqara.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/sensor/xiaomi_aqara.py b/homeassistant/components/sensor/xiaomi_aqara.py index 5248433ef00341..696858fb4c08a2 100644 --- a/homeassistant/components/sensor/xiaomi_aqara.py +++ b/homeassistant/components/sensor/xiaomi_aqara.py @@ -94,7 +94,7 @@ def parse_data(self, data, raw_data): value = data.get(self._data_key) if value is None: return False - if self._data_key in ['coordination','status']: + if self._data_key in ['coordination', 'status']: self._state = value return True value = float(value) From 34b8c656285d111e42e9324090f4091eb225399e Mon Sep 17 00:00:00 2001 From: Daniel Lashua Date: Tue, 4 Sep 2018 12:52:18 -0500 Subject: [PATCH 05/19] adding whitespace before comma --- homeassistant/components/sensor/xiaomi_aqara.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/sensor/xiaomi_aqara.py b/homeassistant/components/sensor/xiaomi_aqara.py index 696858fb4c08a2..ca177ffba4568e 100644 --- a/homeassistant/components/sensor/xiaomi_aqara.py +++ b/homeassistant/components/sensor/xiaomi_aqara.py @@ -45,7 +45,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): devices.append(XiaomiSensor(device, 'Bed Activity', 'bed_activity', gateway)) devices.append(XiaomiSensor(device, 'Tilt Angle', - 'final_tilt_angle',gateway)) + 'final_tilt_angle', gateway)) devices.append(XiaomiSensor(device, 'Coordination', 'coordination', gateway)) else: From c4354006732558df29a223a7b2402188bb642499 Mon Sep 17 00:00:00 2001 From: Daniel Lashua Date: Tue, 4 Sep 2018 12:54:54 -0500 Subject: [PATCH 06/19] remove trailing whitespace --- homeassistant/components/sensor/xiaomi_aqara.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/sensor/xiaomi_aqara.py b/homeassistant/components/sensor/xiaomi_aqara.py index ca177ffba4568e..a5615cd1988ecf 100644 --- a/homeassistant/components/sensor/xiaomi_aqara.py +++ b/homeassistant/components/sensor/xiaomi_aqara.py @@ -47,7 +47,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): devices.append(XiaomiSensor(device, 'Tilt Angle', 'final_tilt_angle', gateway)) devices.append(XiaomiSensor(device, 'Coordination', - 'coordination', gateway)) + 'coordination', gateway)) else: _LOGGER.warn("Unmapped Device Model ") _LOGGER.warn(device) From 34c40eb1340a4962e91a7277e02983d166a36a33 Mon Sep 17 00:00:00 2001 From: Daniel Lashua Date: Tue, 4 Sep 2018 14:29:52 -0500 Subject: [PATCH 07/19] removed warning for unknown models --- homeassistant/components/sensor/xiaomi_aqara.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/homeassistant/components/sensor/xiaomi_aqara.py b/homeassistant/components/sensor/xiaomi_aqara.py index a5615cd1988ecf..b5af6ea3ad9c6e 100644 --- a/homeassistant/components/sensor/xiaomi_aqara.py +++ b/homeassistant/components/sensor/xiaomi_aqara.py @@ -48,9 +48,6 @@ def setup_platform(hass, config, add_entities, discovery_info=None): 'final_tilt_angle', gateway)) devices.append(XiaomiSensor(device, 'Coordination', 'coordination', gateway)) - else: - _LOGGER.warn("Unmapped Device Model ") - _LOGGER.warn(device) add_entities(devices) From 3b001510a5b77bd36f3d2173a108c5143cb9afc3 Mon Sep 17 00:00:00 2001 From: Daniel Lashua Date: Tue, 4 Sep 2018 14:32:43 -0500 Subject: [PATCH 08/19] readded warning so that only device output is removed --- homeassistant/components/binary_sensor/xiaomi_aqara.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/homeassistant/components/binary_sensor/xiaomi_aqara.py b/homeassistant/components/binary_sensor/xiaomi_aqara.py index 83363acd187cc7..485a4c0bceb38d 100644 --- a/homeassistant/components/binary_sensor/xiaomi_aqara.py +++ b/homeassistant/components/binary_sensor/xiaomi_aqara.py @@ -68,6 +68,8 @@ def setup_platform(hass, config, add_entities, discovery_info=None): elif model in ['vibration']: devices.append(XiaomiVibration(device, 'Vibration', 'status', hass, gateway)) + else: + _LOGGER.warning('Unmapped Device Model') add_entities(devices) From ad15cece2b98e4cf129609b65768d9590b963afe Mon Sep 17 00:00:00 2001 From: Daniel Lashua Date: Tue, 4 Sep 2018 14:34:26 -0500 Subject: [PATCH 09/19] readding warning for unmapped device model --- homeassistant/components/sensor/xiaomi_aqara.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/homeassistant/components/sensor/xiaomi_aqara.py b/homeassistant/components/sensor/xiaomi_aqara.py index b5af6ea3ad9c6e..83195547a62498 100644 --- a/homeassistant/components/sensor/xiaomi_aqara.py +++ b/homeassistant/components/sensor/xiaomi_aqara.py @@ -48,6 +48,8 @@ def setup_platform(hass, config, add_entities, discovery_info=None): 'final_tilt_angle', gateway)) devices.append(XiaomiSensor(device, 'Coordination', 'coordination', gateway)) + else: + _LOGGER.warn("Unmapped Device Model ") add_entities(devices) From 52b79068d7f559452c0655ad204e60bf1a6c675b Mon Sep 17 00:00:00 2001 From: Daniel Lashua Date: Tue, 4 Sep 2018 14:35:39 -0500 Subject: [PATCH 10/19] used warning instead of warn --- homeassistant/components/sensor/xiaomi_aqara.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/sensor/xiaomi_aqara.py b/homeassistant/components/sensor/xiaomi_aqara.py index 83195547a62498..cf200bb7f93ef9 100644 --- a/homeassistant/components/sensor/xiaomi_aqara.py +++ b/homeassistant/components/sensor/xiaomi_aqara.py @@ -49,7 +49,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): devices.append(XiaomiSensor(device, 'Coordination', 'coordination', gateway)) else: - _LOGGER.warn("Unmapped Device Model ") + _LOGGER.warning("Unmapped Device Model ") add_entities(devices) From b0bd32a3e3876a4561c200f7132f2dd6c0b7669e Mon Sep 17 00:00:00 2001 From: Daniel Lashua Date: Wed, 5 Sep 2018 06:50:54 -0500 Subject: [PATCH 11/19] double check that value doesn't match one of the expected values --- homeassistant/components/binary_sensor/xiaomi_aqara.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/binary_sensor/xiaomi_aqara.py b/homeassistant/components/binary_sensor/xiaomi_aqara.py index 485a4c0bceb38d..2418d336f62c5b 100644 --- a/homeassistant/components/binary_sensor/xiaomi_aqara.py +++ b/homeassistant/components/binary_sensor/xiaomi_aqara.py @@ -346,8 +346,9 @@ def parse_data(self, data, raw_data): elif value == "free_fall": movement_type = 'free_fall' else: - _LOGGER.warning("Unsupported movement_type detected: %s", value) - return False + if value not in ('vibrate', 'tilt', 'free_fall'): + _LOGGER.warning("Unsupported movement_type detected: %s", value) + return False self._hass.bus.fire('movement', { 'entity_id': self.entity_id, From e729548a21aee49a8548255047500a9551572d37 Mon Sep 17 00:00:00 2001 From: Daniel Lashua Date: Wed, 5 Sep 2018 06:54:30 -0500 Subject: [PATCH 12/19] Added unsupported model name to warning message --- homeassistant/components/binary_sensor/xiaomi_aqara.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/binary_sensor/xiaomi_aqara.py b/homeassistant/components/binary_sensor/xiaomi_aqara.py index 2418d336f62c5b..fde8f6bd7599e4 100644 --- a/homeassistant/components/binary_sensor/xiaomi_aqara.py +++ b/homeassistant/components/binary_sensor/xiaomi_aqara.py @@ -69,7 +69,8 @@ def setup_platform(hass, config, add_entities, discovery_info=None): devices.append(XiaomiVibration(device, 'Vibration', 'status', hass, gateway)) else: - _LOGGER.warning('Unmapped Device Model') + _LOGGER.warning('Unmapped Device Model %s', model) + add_entities(devices) From 4183648695440fc2b782fa26f5e39a57f78ac3aa Mon Sep 17 00:00:00 2001 From: Daniel Lashua Date: Wed, 5 Sep 2018 07:02:15 -0500 Subject: [PATCH 13/19] Don't pass in "hass" to XiaomiVibration. --- homeassistant/components/binary_sensor/xiaomi_aqara.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/binary_sensor/xiaomi_aqara.py b/homeassistant/components/binary_sensor/xiaomi_aqara.py index fde8f6bd7599e4..d81e8a37058f3d 100644 --- a/homeassistant/components/binary_sensor/xiaomi_aqara.py +++ b/homeassistant/components/binary_sensor/xiaomi_aqara.py @@ -67,7 +67,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): devices.append(XiaomiCube(device, hass, gateway)) elif model in ['vibration']: devices.append(XiaomiVibration(device, 'Vibration', - 'status', hass, gateway)) + 'status', gateway)) else: _LOGGER.warning('Unmapped Device Model %s', model) @@ -320,12 +320,10 @@ def parse_data(self, data, raw_data): class XiaomiVibration(XiaomiBinarySensor): """Representation of a Xiaomi Vibration Sensor.""" - def __init__(self, device, name, data_key, hass, xiaomi_hub): + def __init__(self, device, name, data_key, xiaomi_hub): """Initialize the XiaomiVibration.""" - self._hass = hass self._last_action = None - XiaomiBinarySensor.__init__(self, device, name, xiaomi_hub, - data_key, None) + super().__init__(device, name, xiaomi_hub, data_key, None) @property def device_state_attributes(self): @@ -351,7 +349,7 @@ def parse_data(self, data, raw_data): _LOGGER.warning("Unsupported movement_type detected: %s", value) return False - self._hass.bus.fire('movement', { + self.hass.bus.fire('xiaomi_aqara.movement', { 'entity_id': self.entity_id, 'movement_type': movement_type }) From f6933d08398959d02ef6cfc05cab9ddbc4160b05 Mon Sep 17 00:00:00 2001 From: Daniel Lashua Date: Wed, 5 Sep 2018 07:08:52 -0500 Subject: [PATCH 14/19] be consistent with tabs and spaces --- homeassistant/components/binary_sensor/xiaomi_aqara.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/binary_sensor/xiaomi_aqara.py b/homeassistant/components/binary_sensor/xiaomi_aqara.py index d81e8a37058f3d..3554abdd5de418 100644 --- a/homeassistant/components/binary_sensor/xiaomi_aqara.py +++ b/homeassistant/components/binary_sensor/xiaomi_aqara.py @@ -345,9 +345,9 @@ def parse_data(self, data, raw_data): elif value == "free_fall": movement_type = 'free_fall' else: - if value not in ('vibrate', 'tilt', 'free_fall'): - _LOGGER.warning("Unsupported movement_type detected: %s", value) - return False + if value not in ('vibrate', 'tilt', 'free_fall'): + _LOGGER.warning("Unsupported movement_type detected: %s", value) + return False self.hass.bus.fire('xiaomi_aqara.movement', { 'entity_id': self.entity_id, From 556bf3f282dab41de7b46b5367a5320047d6d956 Mon Sep 17 00:00:00 2001 From: Daniel Lashua Date: Wed, 5 Sep 2018 07:10:07 -0500 Subject: [PATCH 15/19] line too long for houndci-bot --- homeassistant/components/binary_sensor/xiaomi_aqara.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/binary_sensor/xiaomi_aqara.py b/homeassistant/components/binary_sensor/xiaomi_aqara.py index 3554abdd5de418..eed3b74e15bf98 100644 --- a/homeassistant/components/binary_sensor/xiaomi_aqara.py +++ b/homeassistant/components/binary_sensor/xiaomi_aqara.py @@ -346,7 +346,8 @@ def parse_data(self, data, raw_data): movement_type = 'free_fall' else: if value not in ('vibrate', 'tilt', 'free_fall'): - _LOGGER.warning("Unsupported movement_type detected: %s", value) + _LOGGER.warning("Unsupported movement_type detected: %s", + value) return False self.hass.bus.fire('xiaomi_aqara.movement', { From 9842eb231949ef8af3ef5640dc59b246f5811138 Mon Sep 17 00:00:00 2001 From: Daniel Lashua Date: Wed, 5 Sep 2018 07:12:45 -0500 Subject: [PATCH 16/19] clean up trailing whitespace --- homeassistant/components/binary_sensor/xiaomi_aqara.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/binary_sensor/xiaomi_aqara.py b/homeassistant/components/binary_sensor/xiaomi_aqara.py index eed3b74e15bf98..e9c2c1d10cff1d 100644 --- a/homeassistant/components/binary_sensor/xiaomi_aqara.py +++ b/homeassistant/components/binary_sensor/xiaomi_aqara.py @@ -346,7 +346,7 @@ def parse_data(self, data, raw_data): movement_type = 'free_fall' else: if value not in ('vibrate', 'tilt', 'free_fall'): - _LOGGER.warning("Unsupported movement_type detected: %s", + _LOGGER.warning("Unsupported movement_type detected: %s", value) return False From 9365357f9b91447c30c1498b43d4e23f147a6022 Mon Sep 17 00:00:00 2001 From: Daniel Lashua Date: Wed, 5 Sep 2018 09:33:51 -0500 Subject: [PATCH 17/19] making additional changes requested. --- .../components/binary_sensor/xiaomi_aqara.py | 20 +++++-------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/homeassistant/components/binary_sensor/xiaomi_aqara.py b/homeassistant/components/binary_sensor/xiaomi_aqara.py index e9c2c1d10cff1d..1bd5555c6500f2 100644 --- a/homeassistant/components/binary_sensor/xiaomi_aqara.py +++ b/homeassistant/components/binary_sensor/xiaomi_aqara.py @@ -335,26 +335,16 @@ def device_state_attributes(self): def parse_data(self, data, raw_data): """Parse data sent by gateway.""" value = data.get(self._data_key) - if value is None: + if value not in ('vibrate', 'tilt', 'free_fall'): + _LOGGER.warning("Unsupported movement_type detected: %s", + value) return False - if value == 'vibrate': - movement_type = 'vibrate' - elif value == 'tilt': - movement_type = 'tilt' - elif value == "free_fall": - movement_type = 'free_fall' - else: - if value not in ('vibrate', 'tilt', 'free_fall'): - _LOGGER.warning("Unsupported movement_type detected: %s", - value) - return False - self.hass.bus.fire('xiaomi_aqara.movement', { 'entity_id': self.entity_id, - 'movement_type': movement_type + 'movement_type': value }) - self._last_action = movement_type + self._last_action = value return True From e0d02a310dd47df24d19ce1c5e4c0247cdb84555 Mon Sep 17 00:00:00 2001 From: Daniel Lashua Date: Wed, 5 Sep 2018 09:35:43 -0500 Subject: [PATCH 18/19] add more spacing to make houndci-bot happy --- homeassistant/components/binary_sensor/xiaomi_aqara.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/binary_sensor/xiaomi_aqara.py b/homeassistant/components/binary_sensor/xiaomi_aqara.py index 1bd5555c6500f2..cc96baa39fc3d4 100644 --- a/homeassistant/components/binary_sensor/xiaomi_aqara.py +++ b/homeassistant/components/binary_sensor/xiaomi_aqara.py @@ -337,7 +337,7 @@ def parse_data(self, data, raw_data): value = data.get(self._data_key) if value not in ('vibrate', 'tilt', 'free_fall'): _LOGGER.warning("Unsupported movement_type detected: %s", - value) + value) return False self.hass.bus.fire('xiaomi_aqara.movement', { From cc71ce14e08170b33273f073ef8b1597a7d05205 Mon Sep 17 00:00:00 2001 From: Sebastian Muszynski Date: Mon, 8 Oct 2018 08:30:59 +0200 Subject: [PATCH 19/19] Add additional model name --- homeassistant/components/binary_sensor/xiaomi_aqara.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/binary_sensor/xiaomi_aqara.py b/homeassistant/components/binary_sensor/xiaomi_aqara.py index cc96baa39fc3d4..77e515a81e4538 100644 --- a/homeassistant/components/binary_sensor/xiaomi_aqara.py +++ b/homeassistant/components/binary_sensor/xiaomi_aqara.py @@ -65,7 +65,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): 'dual_channel', hass, gateway)) elif model in ['cube', 'sensor_cube', 'sensor_cube.aqgl01']: devices.append(XiaomiCube(device, hass, gateway)) - elif model in ['vibration']: + elif model in ['vibration', 'vibration.aq1']: devices.append(XiaomiVibration(device, 'Vibration', 'status', gateway)) else: