Add ZHA device handler library (#19099)
* event foundation * implement quirks * lock zha-quirks version * allow quirks handling to be toggled on and off * revert event commit * disable warning * update requirements_all * Remove fix in favor of #19141 #19141 should be what ultimately corrects this issue. * review comment
This commit is contained in:
parent
4984030871
commit
031ee71adf
4 changed files with 16 additions and 2 deletions
|
@ -407,6 +407,7 @@ omit =
|
||||||
|
|
||||||
homeassistant/components/zha/__init__.py
|
homeassistant/components/zha/__init__.py
|
||||||
homeassistant/components/zha/const.py
|
homeassistant/components/zha/const.py
|
||||||
|
homeassistant/components/zha/event.py
|
||||||
homeassistant/components/zha/entities/*
|
homeassistant/components/zha/entities/*
|
||||||
homeassistant/components/zha/helpers.py
|
homeassistant/components/zha/helpers.py
|
||||||
homeassistant/components/*/zha.py
|
homeassistant/components/*/zha.py
|
||||||
|
|
|
@ -28,12 +28,13 @@ from .const import (
|
||||||
DATA_ZHA_CONFIG, DATA_ZHA_CORE_COMPONENT, DATA_ZHA_DISPATCHERS,
|
DATA_ZHA_CONFIG, DATA_ZHA_CORE_COMPONENT, DATA_ZHA_DISPATCHERS,
|
||||||
DATA_ZHA_RADIO, DEFAULT_BAUDRATE, DEFAULT_DATABASE_NAME,
|
DATA_ZHA_RADIO, DEFAULT_BAUDRATE, DEFAULT_DATABASE_NAME,
|
||||||
DEFAULT_RADIO_TYPE, DOMAIN, ZHA_DISCOVERY_NEW, RadioType,
|
DEFAULT_RADIO_TYPE, DOMAIN, ZHA_DISCOVERY_NEW, RadioType,
|
||||||
EVENTABLE_CLUSTERS, DATA_ZHA_CORE_EVENTS)
|
EVENTABLE_CLUSTERS, DATA_ZHA_CORE_EVENTS, ENABLE_QUIRKS)
|
||||||
|
|
||||||
REQUIREMENTS = [
|
REQUIREMENTS = [
|
||||||
'bellows==0.7.0',
|
'bellows==0.7.0',
|
||||||
'zigpy==0.2.0',
|
'zigpy==0.2.0',
|
||||||
'zigpy-xbee==0.1.1',
|
'zigpy-xbee==0.1.1',
|
||||||
|
'zha-quirks==0.0.5'
|
||||||
]
|
]
|
||||||
|
|
||||||
DEVICE_CONFIG_SCHEMA_ENTRY = vol.Schema({
|
DEVICE_CONFIG_SCHEMA_ENTRY = vol.Schema({
|
||||||
|
@ -51,6 +52,7 @@ CONFIG_SCHEMA = vol.Schema({
|
||||||
vol.Optional(CONF_DATABASE): cv.string,
|
vol.Optional(CONF_DATABASE): cv.string,
|
||||||
vol.Optional(CONF_DEVICE_CONFIG, default={}):
|
vol.Optional(CONF_DEVICE_CONFIG, default={}):
|
||||||
vol.Schema({cv.string: DEVICE_CONFIG_SCHEMA_ENTRY}),
|
vol.Schema({cv.string: DEVICE_CONFIG_SCHEMA_ENTRY}),
|
||||||
|
vol.Optional(ENABLE_QUIRKS, default=True): cv.boolean,
|
||||||
})
|
})
|
||||||
}, extra=vol.ALLOW_EXTRA)
|
}, extra=vol.ALLOW_EXTRA)
|
||||||
|
|
||||||
|
@ -94,7 +96,8 @@ async def async_setup(hass, config):
|
||||||
context={'source': config_entries.SOURCE_IMPORT},
|
context={'source': config_entries.SOURCE_IMPORT},
|
||||||
data={
|
data={
|
||||||
CONF_USB_PATH: conf[CONF_USB_PATH],
|
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
|
return True
|
||||||
|
@ -105,6 +108,12 @@ async def async_setup_entry(hass, config_entry):
|
||||||
|
|
||||||
Will automatically load components to support devices found on the network.
|
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
|
||||||
|
|
||||||
global APPLICATION_CONTROLLER
|
global APPLICATION_CONTROLLER
|
||||||
|
|
||||||
hass.data[DATA_ZHA] = hass.data.get(DATA_ZHA, {})
|
hass.data[DATA_ZHA] = hass.data.get(DATA_ZHA, {})
|
||||||
|
|
|
@ -30,6 +30,7 @@ CONF_DEVICE_CONFIG = 'device_config'
|
||||||
CONF_RADIO_TYPE = 'radio_type'
|
CONF_RADIO_TYPE = 'radio_type'
|
||||||
CONF_USB_PATH = 'usb_path'
|
CONF_USB_PATH = 'usb_path'
|
||||||
DATA_DEVICE_CONFIG = 'zha_device_config'
|
DATA_DEVICE_CONFIG = 'zha_device_config'
|
||||||
|
ENABLE_QUIRKS = 'enable_quirks'
|
||||||
|
|
||||||
DEFAULT_RADIO_TYPE = 'ezsp'
|
DEFAULT_RADIO_TYPE = 'ezsp'
|
||||||
DEFAULT_BAUDRATE = 57600
|
DEFAULT_BAUDRATE = 57600
|
||||||
|
|
|
@ -1670,6 +1670,9 @@ zengge==0.2
|
||||||
# homeassistant.components.zeroconf
|
# homeassistant.components.zeroconf
|
||||||
zeroconf==0.21.3
|
zeroconf==0.21.3
|
||||||
|
|
||||||
|
# homeassistant.components.zha
|
||||||
|
zha-quirks==0.0.5
|
||||||
|
|
||||||
# homeassistant.components.climate.zhong_hong
|
# homeassistant.components.climate.zhong_hong
|
||||||
zhong_hong_hvac==1.0.9
|
zhong_hong_hvac==1.0.9
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue