Ensure tesla_wall_connector config flow title_placeholders items are [str, str] (#127208)

This commit is contained in:
Erik Montnemery 2024-10-01 14:32:18 +02:00 committed by GitHub
parent 1efe418e05
commit 028d1c6148
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -46,7 +46,6 @@ class TeslaWallConnectorConfigFlow(ConfigFlow, domain=DOMAIN):
"""Initialize config flow.""" """Initialize config flow."""
super().__init__() super().__init__()
self.ip_address: str | None = None self.ip_address: str | None = None
self.serial_number = None
async def async_step_dhcp( async def async_step_dhcp(
self, discovery_info: dhcp.DhcpServiceInfo self, discovery_info: dhcp.DhcpServiceInfo
@ -70,23 +69,21 @@ class TeslaWallConnectorConfigFlow(ConfigFlow, domain=DOMAIN):
) )
return self.async_abort(reason="cannot_connect") return self.async_abort(reason="cannot_connect")
self.serial_number = version.serial_number serial_number: str = version.serial_number
await self.async_set_unique_id(self.serial_number) await self.async_set_unique_id(serial_number)
self._abort_if_unique_id_configured(updates={CONF_HOST: self.ip_address}) self._abort_if_unique_id_configured(updates={CONF_HOST: self.ip_address})
_LOGGER.debug( _LOGGER.debug(
"No entry found for wall connector with IP %s. Serial nr: %s", "No entry found for wall connector with IP %s. Serial nr: %s",
self.ip_address, self.ip_address,
self.serial_number, serial_number,
) )
placeholders = { self.context["title_placeholders"] = {
CONF_HOST: self.ip_address, CONF_HOST: self.ip_address,
WALLCONNECTOR_SERIAL_NUMBER: self.serial_number, WALLCONNECTOR_SERIAL_NUMBER: serial_number,
} }
self.context["title_placeholders"] = placeholders
return await self.async_step_user() return await self.async_step_user()
async def async_step_user( async def async_step_user(