Skip to content

Commit b65aed4

Browse files
committed
fix timeout issue and typehints
1 parent bbbab4d commit b65aed4

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

custom_components/pyscript/__init__.py

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

84-
# If data in config doesn't match config entry, trigger a config import
85-
# so that the config entry can get updated
86-
if DOMAIN in conf and conf[DOMAIN] != config_entry.data:
87-
await hass.config_entries.flow.async_init(
88-
DOMAIN, context={"source": SOURCE_IMPORT}, data=conf[DOMAIN]
89-
)
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+
)
9093

9194
State.set_pyscript_config(config_entry.data)
9295

custom_components/pyscript/config_flow.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class PyscriptConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
1919
VERSION = 1
2020
CONNECTION_CLASS = config_entries.CONN_CLASS_LOCAL_PUSH
2121

22-
async def async_step_user(self, user_input: Dict[str, Any] = None) -> None:
22+
async def async_step_user(self, user_input: Dict[str, Any] = None) -> Dict[str, Any]:
2323
"""Handle a flow initialized by the user."""
2424
if user_input is not None:
2525
if len(self.hass.config_entries.async_entries(DOMAIN)) > 0:
@@ -30,7 +30,7 @@ async def async_step_user(self, user_input: Dict[str, Any] = None) -> None:
3030

3131
return self.async_show_form(step_id="user", data_schema=PYSCRIPT_SCHEMA)
3232

33-
async def async_step_import(self, import_config: Dict[str, Any] = None) -> None:
33+
async def async_step_import(self, import_config: Dict[str, Any] = None) -> Dict[str, Any]:
3434
"""Import a config entry from configuration.yaml."""
3535
# Check if import config entry matches any existing config entries
3636
# so we can update it if necessary

0 commit comments

Comments
 (0)