Skip to content

Commit

Permalink
define unique id based on unique config
Browse files Browse the repository at this point in the history
- fix #107073
  • Loading branch information
miaucl authored and Cyrill Raccaud committed Jan 4, 2024
1 parent 45fde2d commit 16a7fb5
Showing 1 changed file with 6 additions and 0 deletions.
Expand Up @@ -59,6 +59,9 @@ async def async_step_user(
_LOGGER.exception("Unknown error")
errors["base"] = "unknown"
else:
await self.async_set_unique_id(
f"{user_input[CONF_START]} {user_input[CONF_DESTINATION]}"
)
return self.async_create_entry(
title=f"{user_input[CONF_START]} {user_input[CONF_DESTINATION]}",
data=user_input,
Expand Down Expand Up @@ -98,6 +101,9 @@ async def async_step_import(self, import_input: dict[str, Any]) -> FlowResult:
)
return self.async_abort(reason="unknown")

await self.async_set_unique_id(
f"{import_input[CONF_START]} {import_input[CONF_DESTINATION]}"
)
return self.async_create_entry(
title=import_input[CONF_NAME],
data=import_input,
Expand Down

0 comments on commit 16a7fb5

Please sign in to comment.