From 62f12d242ab00a799d27d156aa6422e1c6d1b194 Mon Sep 17 00:00:00 2001 From: Charles Garwood Date: Thu, 14 Mar 2019 15:29:21 -0400 Subject: [PATCH] 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 --- homeassistant/components/zwave/__init__.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/zwave/__init__.py b/homeassistant/components/zwave/__init__.py index be76eca4efd..604f03387bd 100644 --- a/homeassistant/components/zwave/__init__.py +++ b/homeassistant/components/zwave/__init__.py @@ -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)