Add title placeholders to overkiz discovery (#65506)

* add gateway_id to the config flow context name.

* obfuscate gateway_id.

* replace const with homeassistant.const.

* Remove obfuscation of gateway_id.

* fix style.

* Add translatable title according to comments

* Update homeassistant/components/overkiz/strings.json

Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
Vincent Le Bourlot 2022-02-07 16:53:05 +01:00 committed by GitHub
parent ebbe1ff1a2
commit d82899ed2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 5 deletions

View File

@ -128,11 +128,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
gateway_id = hostname[8:22]
LOGGER.debug("DHCP discovery detected gateway %s", obfuscate_id(gateway_id))
await self.async_set_unique_id(gateway_id)
self._abort_if_unique_id_configured()
return await self.async_step_user()
return await self._process_discovery(gateway_id)
async def async_step_zeroconf(
self, discovery_info: zeroconf.ZeroconfServiceInfo
@ -144,9 +140,13 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
gateway_id = properties["gateway_pin"]
LOGGER.debug("ZeroConf discovery detected gateway %s", obfuscate_id(gateway_id))
return await self._process_discovery(gateway_id)
async def _process_discovery(self, gateway_id: str) -> FlowResult:
"""Handle discovery of a gateway."""
await self.async_set_unique_id(gateway_id)
self._abort_if_unique_id_configured()
self.context["title_placeholders"] = {"gateway_id": gateway_id}
return await self.async_step_user()

View File

@ -1,5 +1,6 @@
{
"config": {
"flow_title": "Gateway: {gateway_id}",
"step": {
"user": {
"description": "The Overkiz platform is used by various vendors like Somfy (Connexoon / TaHoma), Hitachi (Hi Kumo), Rexel (Energeasy Connect) and Atlantic (Cozytouch). Enter your application credentials and select your hub.",

View File

@ -12,6 +12,7 @@
"too_many_requests": "Too many requests, try again later",
"unknown": "Unexpected error"
},
"flow_title": "Gateway: {gateway_id}",
"step": {
"user": {
"data": {