Abort bond hub config flow if hub is already registered (#38416)

Co-authored-by: Chris Talkington <chris@talkingtontech.com>
This commit is contained in:
Eugene PrystupaandChris Talkington authored and GitHub committed 2020-07-31 14:08:25 +02:00
1 parent 0136c565eb
commit 89cbcdb9dc
5 files changed
+48 -3

No files matched your search

@@ -57,6 +57,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
errors["base"] = "unknown"
else:
await self.async_set_unique_id(bond_id)
self._abort_if_unique_id_configured()
return self.async_create_entry(title=bond_id, data=user_input)
return self.async_show_form(
+2 -1
View File
@@ -4,5 +4,6 @@
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/bond",
"requirements": ["bond-api==0.1.7"],
"codeowners": ["@prystupa"]
"codeowners": ["@prystupa"],
"quality_scale": "platinum"
}
@@ -12,6 +12,9 @@
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
"invalid_auth": "[%key:common::config_flow::error::invalid_auth%]",
"unknown": "[%key:common::config_flow::error::unknown%]"
},
"abort": {
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]"
}
}
}
@@ -1,5 +1,8 @@
{
"config": {
"abort": {
"already_configured": "Device is already configured"
},
"error": {
"cannot_connect": "Failed to connect",
"invalid_auth": "Invalid authentication",
@@ -14,4 +17,4 @@
}
}
}
}
}