Guard withings accessing hass.data without it being set (#73454)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>pull/73504/head
parent
d6bfb86da2
commit
d8f2afb772
|
@ -72,11 +72,12 @@ CONFIG_SCHEMA = vol.Schema(
|
|||
|
||||
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Set up the Withings component."""
|
||||
conf = config.get(DOMAIN, {})
|
||||
if not (conf := config.get(DOMAIN, {})):
|
||||
if not (conf := config.get(DOMAIN)):
|
||||
# Apply the defaults.
|
||||
conf = CONFIG_SCHEMA({DOMAIN: {}})[DOMAIN]
|
||||
hass.data[DOMAIN] = {const.CONFIG: conf}
|
||||
return True
|
||||
|
||||
# Make the config available to the oauth2 config flow.
|
||||
hass.data[DOMAIN] = {const.CONFIG: conf}
|
||||
|
||||
# Setup the oauth2 config flow.
|
||||
|
|
Loading…
Reference in New Issue