Skip to content

Commit

Permalink
move outside try
Browse files Browse the repository at this point in the history
  • Loading branch information
dgomes committed May 9, 2024
1 parent 42035be commit 4162556
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions homeassistant/components/v2c/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ async def async_step_user(
try:
data = await evse.get_data()

if data.ID:
await self.async_set_unique_id(data.ID)
self._abort_if_unique_id_configured()

except TrydanError:
errors["base"] = "cannot_connect"
except AbortFlow:
Expand All @@ -56,6 +52,10 @@ async def async_step_user(
_LOGGER.exception("Unexpected exception")
errors["base"] = "unknown"
else:
if data.ID:
await self.async_set_unique_id(data.ID)
self._abort_if_unique_id_configured()

return self.async_create_entry(
title=f"EVSE {user_input[CONF_HOST]}", data=user_input
)
Expand Down

0 comments on commit 4162556

Please sign in to comment.