Z-Wave usb_path in configuration.yaml overrides config entry usb_path (#22038)

* usb_path in configuration.yaml overrides config entry

* Minor text update

* Update __init__.py
This commit is contained in:
Charles Garwood 2019-03-14 15:29:21 -04:00 committed by Paulus Schoutsen
parent b25e951dcc
commit 62f12d242a

View File

@ -169,8 +169,7 @@ CONFIG_SCHEMA = vol.Schema({
vol.Optional(CONF_DEBUG, default=DEFAULT_DEBUG): cv.boolean,
vol.Optional(CONF_POLLING_INTERVAL, default=DEFAULT_POLLING_INTERVAL):
cv.positive_int,
vol.Optional(CONF_USB_STICK_PATH, default=DEFAULT_CONF_USB_STICK_PATH):
cv.string,
vol.Optional(CONF_USB_STICK_PATH): cv.string,
}),
}, extra=vol.ALLOW_EXTRA)
@ -239,7 +238,8 @@ async def async_setup(hass, config):
hass.async_create_task(hass.config_entries.flow.async_init(
DOMAIN, context={'source': config_entries.SOURCE_IMPORT},
data={
CONF_USB_STICK_PATH: conf[CONF_USB_STICK_PATH],
CONF_USB_STICK_PATH: conf.get(
CONF_USB_STICK_PATH, DEFAULT_CONF_USB_STICK_PATH),
CONF_NETWORK_KEY: conf.get(CONF_NETWORK_KEY),
}
))
@ -271,9 +271,14 @@ async def async_setup_entry(hass, config_entry):
config.get(CONF_DEVICE_CONFIG_DOMAIN),
config.get(CONF_DEVICE_CONFIG_GLOB))
usb_path = config.get(
CONF_USB_STICK_PATH, config_entry.data[CONF_USB_STICK_PATH])
_LOGGER.info('Z-Wave USB path is %s', usb_path)
# Setup options
options = ZWaveOption(
config_entry.data[CONF_USB_STICK_PATH],
usb_path,
user_path=hass.config.config_dir,
config_path=config.get(CONF_CONFIG_PATH))
@ -374,7 +379,7 @@ async def async_setup_entry(hass, config_entry):
def network_ready():
"""Handle the query of all awake nodes."""
_LOGGER.info("Zwave network is ready for use. All awake nodes "
_LOGGER.info("Z-Wave network is ready for use. All awake nodes "
"have been queried. Sleeping nodes will be "
"queried when they awake.")
hass.bus.fire(const.EVENT_NETWORK_READY)