mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 13:47:35 +00:00
Guard withings accessing hass.data without it being set (#73454)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
parent
9b157f974d
commit
61e4b56e19
@ -72,11 +72,12 @@ CONFIG_SCHEMA = vol.Schema(
|
|||||||
|
|
||||||
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||||
"""Set up the Withings component."""
|
"""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
|
return True
|
||||||
|
|
||||||
# Make the config available to the oauth2 config flow.
|
|
||||||
hass.data[DOMAIN] = {const.CONFIG: conf}
|
hass.data[DOMAIN] = {const.CONFIG: conf}
|
||||||
|
|
||||||
# Setup the oauth2 config flow.
|
# Setup the oauth2 config flow.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user