Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ZHA device handler library #19099

Merged
merged 10 commits into from Dec 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .coveragerc
Expand Up @@ -407,6 +407,7 @@ omit =

homeassistant/components/zha/__init__.py
homeassistant/components/zha/const.py
homeassistant/components/zha/event.py
homeassistant/components/zha/entities/*
homeassistant/components/zha/helpers.py
homeassistant/components/*/zha.py
Expand Down
13 changes: 11 additions & 2 deletions homeassistant/components/zha/__init__.py
Expand Up @@ -28,12 +28,13 @@
DATA_ZHA_CONFIG, DATA_ZHA_CORE_COMPONENT, DATA_ZHA_DISPATCHERS,
DATA_ZHA_RADIO, DEFAULT_BAUDRATE, DEFAULT_DATABASE_NAME,
DEFAULT_RADIO_TYPE, DOMAIN, ZHA_DISCOVERY_NEW, RadioType,
EVENTABLE_CLUSTERS, DATA_ZHA_CORE_EVENTS)
EVENTABLE_CLUSTERS, DATA_ZHA_CORE_EVENTS, ENABLE_QUIRKS)

REQUIREMENTS = [
'bellows==0.7.0',
'zigpy==0.2.0',
'zigpy-xbee==0.1.1',
'zha-quirks==0.0.5'
]

DEVICE_CONFIG_SCHEMA_ENTRY = vol.Schema({
Expand All @@ -51,6 +52,7 @@
vol.Optional(CONF_DATABASE): cv.string,
vol.Optional(CONF_DEVICE_CONFIG, default={}):
vol.Schema({cv.string: DEVICE_CONFIG_SCHEMA_ENTRY}),
vol.Optional(ENABLE_QUIRKS, default=True): cv.boolean,
})
}, extra=vol.ALLOW_EXTRA)

Expand Down Expand Up @@ -94,7 +96,8 @@ async def async_setup(hass, config):
context={'source': config_entries.SOURCE_IMPORT},
data={
CONF_USB_PATH: conf[CONF_USB_PATH],
CONF_RADIO_TYPE: conf.get(CONF_RADIO_TYPE).value
CONF_RADIO_TYPE: conf.get(CONF_RADIO_TYPE).value,
ENABLE_QUIRKS: conf[ENABLE_QUIRKS]
}
))
return True
Expand All @@ -105,6 +108,12 @@ async def async_setup_entry(hass, config_entry):

Will automatically load components to support devices found on the network.
"""
if config_entry.data.get(ENABLE_QUIRKS):
# needs to be done here so that the ZHA module is finished loading
# before zhaquirks is imported
# pylint: disable=W0611, W0612
import zhaquirks # noqa
dmulcahey marked this conversation as resolved.
Show resolved Hide resolved

global APPLICATION_CONTROLLER

hass.data[DATA_ZHA] = hass.data.get(DATA_ZHA, {})
Expand Down
1 change: 1 addition & 0 deletions homeassistant/components/zha/const.py
Expand Up @@ -30,6 +30,7 @@
CONF_RADIO_TYPE = 'radio_type'
CONF_USB_PATH = 'usb_path'
DATA_DEVICE_CONFIG = 'zha_device_config'
ENABLE_QUIRKS = 'enable_quirks'

DEFAULT_RADIO_TYPE = 'ezsp'
DEFAULT_BAUDRATE = 57600
Expand Down
3 changes: 3 additions & 0 deletions requirements_all.txt
Expand Up @@ -1670,6 +1670,9 @@ zengge==0.2
# homeassistant.components.zeroconf
zeroconf==0.21.3

# homeassistant.components.zha
zha-quirks==0.0.5

# homeassistant.components.climate.zhong_hong
zhong_hong_hvac==1.0.9

Expand Down