check config instead of config_entry for quirks flag (#19730)

This commit is contained in:
David F. Mulcahey 2019-01-04 14:00:26 -05:00 committed by Charles Garwood
parent 27a9f5a05c
commit ef180c489a

View File

@ -95,8 +95,7 @@ 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,
ENABLE_QUIRKS: conf[ENABLE_QUIRKS]
CONF_RADIO_TYPE: conf.get(CONF_RADIO_TYPE).value
}
))
return True
@ -107,17 +106,17 @@ 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
hass.data[DATA_ZHA] = hass.data.get(DATA_ZHA, {})
hass.data[DATA_ZHA][DATA_ZHA_DISPATCHERS] = []
config = hass.data[DATA_ZHA].get(DATA_ZHA_CONFIG, {})
if config.get(ENABLE_QUIRKS, True):
# needs to be done here so that the ZHA module is finished loading
# before zhaquirks is imported
# pylint: disable=W0611, W0612
import zhaquirks # noqa
usb_path = config_entry.data.get(CONF_USB_PATH)
baudrate = config.get(CONF_BAUDRATE, DEFAULT_BAUDRATE)
radio_type = config_entry.data.get(CONF_RADIO_TYPE)