mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 04:37:06 +00:00
check config instead of config_entry for quirks flag (#19730)
This commit is contained in:
parent
27a9f5a05c
commit
ef180c489a
@ -95,8 +95,7 @@ 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
|
||||||
@ -107,17 +106,17 @@ 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
|
|
||||||
|
|
||||||
hass.data[DATA_ZHA] = hass.data.get(DATA_ZHA, {})
|
hass.data[DATA_ZHA] = hass.data.get(DATA_ZHA, {})
|
||||||
hass.data[DATA_ZHA][DATA_ZHA_DISPATCHERS] = []
|
hass.data[DATA_ZHA][DATA_ZHA_DISPATCHERS] = []
|
||||||
|
|
||||||
config = hass.data[DATA_ZHA].get(DATA_ZHA_CONFIG, {})
|
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)
|
usb_path = config_entry.data.get(CONF_USB_PATH)
|
||||||
baudrate = config.get(CONF_BAUDRATE, DEFAULT_BAUDRATE)
|
baudrate = config.get(CONF_BAUDRATE, DEFAULT_BAUDRATE)
|
||||||
radio_type = config_entry.data.get(CONF_RADIO_TYPE)
|
radio_type = config_entry.data.get(CONF_RADIO_TYPE)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user