From f58e5f442dfb3f4897275d94896e1e7f4fbf8e22 Mon Sep 17 00:00:00 2001 From: Russell Cloran Date: Mon, 5 Feb 2018 16:05:19 -0800 Subject: [PATCH] zha: Update to bellows 0.5.0+zigpy (#12187) --- homeassistant/components/binary_sensor/zha.py | 4 ++-- homeassistant/components/light/zha.py | 2 +- homeassistant/components/sensor/zha.py | 2 +- homeassistant/components/zha/__init__.py | 11 +++++++---- homeassistant/components/zha/const.py | 4 ++-- requirements_all.txt | 5 ++++- 6 files changed, 17 insertions(+), 11 deletions(-) diff --git a/homeassistant/components/binary_sensor/zha.py b/homeassistant/components/binary_sensor/zha.py index ad7c29badf9..80549037ee1 100644 --- a/homeassistant/components/binary_sensor/zha.py +++ b/homeassistant/components/binary_sensor/zha.py @@ -32,7 +32,7 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None): if discovery_info is None: return - from bellows.zigbee.zcl.clusters.security import IasZone + from zigpy.zcl.clusters.security import IasZone in_clusters = discovery_info['in_clusters'] @@ -63,7 +63,7 @@ class BinarySensor(zha.Entity, BinarySensorDevice): """Initialize the ZHA binary sensor.""" super().__init__(**kwargs) self._device_class = device_class - from bellows.zigbee.zcl.clusters.security import IasZone + from zigpy.zcl.clusters.security import IasZone self._ias_zone_cluster = self._in_clusters[IasZone.cluster_id] @property diff --git a/homeassistant/components/light/zha.py b/homeassistant/components/light/zha.py index c468d50ce6d..f50b3d7689b 100644 --- a/homeassistant/components/light/zha.py +++ b/homeassistant/components/light/zha.py @@ -61,7 +61,7 @@ class Light(zha.Entity, light.Light): self._xy_color = None self._brightness = None - import bellows.zigbee.zcl.clusters as zcl_clusters + import zigpy.zcl.clusters as zcl_clusters if zcl_clusters.general.LevelControl.cluster_id in self._in_clusters: self._supported_features |= light.SUPPORT_BRIGHTNESS self._supported_features |= light.SUPPORT_TRANSITION diff --git a/homeassistant/components/sensor/zha.py b/homeassistant/components/sensor/zha.py index cd2847c1fa6..a1820f7d7dd 100644 --- a/homeassistant/components/sensor/zha.py +++ b/homeassistant/components/sensor/zha.py @@ -31,7 +31,7 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None): @asyncio.coroutine def make_sensor(discovery_info): """Create ZHA sensors factory.""" - from bellows.zigbee.zcl.clusters.measurement import TemperatureMeasurement + from zigpy.zcl.clusters.measurement import TemperatureMeasurement in_clusters = discovery_info['in_clusters'] if TemperatureMeasurement.cluster_id in in_clusters: sensor = TemperatureSensor(**discovery_info) diff --git a/homeassistant/components/zha/__init__.py b/homeassistant/components/zha/__init__.py index f87537a1938..cf44dea8c1d 100644 --- a/homeassistant/components/zha/__init__.py +++ b/homeassistant/components/zha/__init__.py @@ -14,7 +14,10 @@ from homeassistant import const as ha_const from homeassistant.helpers import discovery, entity from homeassistant.util import slugify -REQUIREMENTS = ['bellows==0.4.0'] +REQUIREMENTS = [ + 'bellows==0.5.0', + 'zigpy==0.0.1', +] DOMAIN = 'zha' @@ -130,7 +133,7 @@ class ApplicationListener: @asyncio.coroutine def async_device_initialized(self, device, join): """Handle device joined and basic information discovered (async).""" - import bellows.zigbee.profiles + import zigpy.profiles import homeassistant.components.zha.const as zha_const zha_const.populate_data() @@ -146,8 +149,8 @@ class ApplicationListener: node_config = self._config[DOMAIN][CONF_DEVICE_CONFIG].get( device_key, {}) - if endpoint.profile_id in bellows.zigbee.profiles.PROFILES: - profile = bellows.zigbee.profiles.PROFILES[endpoint.profile_id] + if endpoint.profile_id in zigpy.profiles.PROFILES: + profile = zigpy.profiles.PROFILES[endpoint.profile_id] if zha_const.DEVICE_CLASS.get(endpoint.profile_id, {}).get(endpoint.device_type, None): diff --git a/homeassistant/components/zha/const.py b/homeassistant/components/zha/const.py index b1659536e32..a8d4671ebf7 100644 --- a/homeassistant/components/zha/const.py +++ b/homeassistant/components/zha/const.py @@ -11,8 +11,8 @@ def populate_data(): These cannot be module level, as importing bellows must be done in a in a function. """ - from bellows.zigbee import zcl - from bellows.zigbee.profiles import PROFILES, zha, zll + from zigpy import zcl + from zigpy.profiles import PROFILES, zha, zll DEVICE_CLASS[zha.PROFILE_ID] = { zha.DeviceType.ON_OFF_SWITCH: 'switch', diff --git a/requirements_all.txt b/requirements_all.txt index 935ba2c8fa3..cd718810f44 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -126,7 +126,7 @@ batinfo==0.4.2 beautifulsoup4==4.6.0 # homeassistant.components.zha -bellows==0.4.0 +bellows==0.5.0 # homeassistant.components.blink blinkpy==0.6.0 @@ -1271,3 +1271,6 @@ zeroconf==0.19.1 # homeassistant.components.media_player.ziggo_mediabox_xl ziggo-mediabox-xl==1.0.0 + +# homeassistant.components.zha +zigpy==0.0.1