Skip to content

Commit d4ddf31

Browse files
committed
always update entry during reload
1 parent 0769efe commit d4ddf31

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

custom_components/pyscript/__init__.py

+6-9
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,12 @@ async def reload_scripts_handler(call):
8181
_LOGGER.error(err)
8282
return
8383

84-
if DOMAIN in conf:
85-
config = PYSCRIPT_SCHEMA(conf[DOMAIN])
86-
87-
# If data in config doesn't match config entry, trigger a config import
88-
# so that the config entry can get updated
89-
if config != config_entry.data:
90-
await hass.config_entries.flow.async_init(
91-
DOMAIN, context={"source": SOURCE_IMPORT}, data=config
92-
)
84+
config = PYSCRIPT_SCHEMA(conf.get(DOMAIN, {}))
85+
86+
# If data in config doesn't match config entry, trigger a config import
87+
# so that the config entry can get updated
88+
if config != config_entry.data:
89+
await hass.config_entries.flow.async_init(DOMAIN, context={"source": SOURCE_IMPORT}, data=config)
9390

9491
State.set_pyscript_config(config_entry.data)
9592

0 commit comments

Comments
 (0)