From b557157ea1f2322f3ad754d60cbcb4824b8edeb4 Mon Sep 17 00:00:00 2001 From: damarco Date: Thu, 17 Jan 2019 01:09:09 +0100 Subject: [PATCH] Add support for deconz radios to zha component (#20167) * Add support for deconz radios * Update check_zigpy_connection() --- homeassistant/components/zha/__init__.py | 8 +++++++- homeassistant/components/zha/const.py | 1 + homeassistant/components/zha/helpers.py | 4 ++++ requirements_all.txt | 3 +++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/zha/__init__.py b/homeassistant/components/zha/__init__.py index 8ff4c80e0ea..335295b2c2c 100644 --- a/homeassistant/components/zha/__init__.py +++ b/homeassistant/components/zha/__init__.py @@ -39,7 +39,8 @@ REQUIREMENTS = [ 'bellows==0.7.0', 'zigpy==0.2.0', 'zigpy-xbee==0.1.1', - 'zha-quirks==0.0.6' + 'zha-quirks==0.0.6', + 'zigpy-deconz==0.0.1' ] DEVICE_CONFIG_SCHEMA_ENTRY = vol.Schema({ @@ -120,6 +121,11 @@ async def async_setup_entry(hass, config_entry): from zigpy_xbee.zigbee.application import ControllerApplication radio = zigpy_xbee.api.XBee() radio_description = "XBee" + elif radio_type == RadioType.deconz.name: + import zigpy_deconz.api + from zigpy_deconz.zigbee.application import ControllerApplication + radio = zigpy_deconz.api.Deconz() + radio_description = "Deconz" await radio.connect(usb_path, baudrate) hass.data[DATA_ZHA][DATA_ZHA_RADIO] = radio diff --git a/homeassistant/components/zha/const.py b/homeassistant/components/zha/const.py index 91a06d666c0..47c3982c5d6 100644 --- a/homeassistant/components/zha/const.py +++ b/homeassistant/components/zha/const.py @@ -57,6 +57,7 @@ class RadioType(enum.Enum): ezsp = 'ezsp' xbee = 'xbee' + deconz = 'deconz' @classmethod def list(cls): diff --git a/homeassistant/components/zha/helpers.py b/homeassistant/components/zha/helpers.py index b6c09dd1fce..a182479d221 100644 --- a/homeassistant/components/zha/helpers.py +++ b/homeassistant/components/zha/helpers.py @@ -118,6 +118,10 @@ async def check_zigpy_connection(usb_path, radio_type, database_path): import zigpy_xbee.api from zigpy_xbee.zigbee.application import ControllerApplication radio = zigpy_xbee.api.XBee() + elif radio_type == RadioType.deconz.name: + import zigpy_deconz.api + from zigpy_deconz.zigbee.application import ControllerApplication + radio = zigpy_deconz.api.Deconz() try: await radio.connect(usb_path, DEFAULT_BAUDRATE) controller = ControllerApplication(radio, database_path) diff --git a/requirements_all.txt b/requirements_all.txt index b6d771900b9..b9e845c34fc 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1743,6 +1743,9 @@ zhong_hong_hvac==1.0.9 # homeassistant.components.media_player.ziggo_mediabox_xl ziggo-mediabox-xl==1.1.0 +# homeassistant.components.zha +zigpy-deconz==0.0.1 + # homeassistant.components.zha zigpy-xbee==0.1.1