mirror of
https://github.com/home-assistant/core.git
synced 2025-07-26 22:57:17 +00:00
Improve type hints in motionblinds_ble config flow (#130439)
This commit is contained in:
parent
2788ddec3a
commit
5ba5ffdacd
@ -48,11 +48,12 @@ CONFIG_SCHEMA = vol.Schema({vol.Required(CONF_MAC_CODE): str})
|
|||||||
class FlowHandler(ConfigFlow, domain=DOMAIN):
|
class FlowHandler(ConfigFlow, domain=DOMAIN):
|
||||||
"""Handle a config flow for Motionblinds Bluetooth."""
|
"""Handle a config flow for Motionblinds Bluetooth."""
|
||||||
|
|
||||||
|
_display_name: str
|
||||||
|
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
"""Initialize a ConfigFlow."""
|
"""Initialize a ConfigFlow."""
|
||||||
self._discovery_info: BluetoothServiceInfoBleak | BLEDevice | None = None
|
self._discovery_info: BluetoothServiceInfoBleak | BLEDevice | None = None
|
||||||
self._mac_code: str | None = None
|
self._mac_code: str | None = None
|
||||||
self._display_name: str | None = None
|
|
||||||
self._blind_type: MotionBlindType | None = None
|
self._blind_type: MotionBlindType | None = None
|
||||||
|
|
||||||
async def async_step_bluetooth(
|
async def async_step_bluetooth(
|
||||||
@ -67,8 +68,8 @@ class FlowHandler(ConfigFlow, domain=DOMAIN):
|
|||||||
|
|
||||||
self._discovery_info = discovery_info
|
self._discovery_info = discovery_info
|
||||||
self._mac_code = get_mac_from_local_name(discovery_info.name)
|
self._mac_code = get_mac_from_local_name(discovery_info.name)
|
||||||
self._display_name = display_name = DISPLAY_NAME.format(mac_code=self._mac_code)
|
self._display_name = DISPLAY_NAME.format(mac_code=self._mac_code)
|
||||||
self.context["title_placeholders"] = {"name": display_name}
|
self.context["title_placeholders"] = {"name": self._display_name}
|
||||||
|
|
||||||
return await self.async_step_confirm()
|
return await self.async_step_confirm()
|
||||||
|
|
||||||
@ -113,7 +114,7 @@ class FlowHandler(ConfigFlow, domain=DOMAIN):
|
|||||||
assert self._discovery_info is not None
|
assert self._discovery_info is not None
|
||||||
|
|
||||||
return self.async_create_entry(
|
return self.async_create_entry(
|
||||||
title=str(self._display_name),
|
title=self._display_name,
|
||||||
data={
|
data={
|
||||||
CONF_ADDRESS: self._discovery_info.address,
|
CONF_ADDRESS: self._discovery_info.address,
|
||||||
CONF_LOCAL_NAME: self._discovery_info.name,
|
CONF_LOCAL_NAME: self._discovery_info.name,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user