diff --git a/homeassistant/components/homekit/__init__.py b/homeassistant/components/homekit/__init__.py index b00631c2249..294dc7f33a6 100644 --- a/homeassistant/components/homekit/__init__.py +++ b/homeassistant/components/homekit/__init__.py @@ -121,6 +121,7 @@ from .const import ( SERVICE_HOMEKIT_RESET_ACCESSORY, SERVICE_HOMEKIT_UNPAIR, SHUTDOWN_TIMEOUT, + SIGNAL_RELOAD_ENTITIES, ) from .iidmanager import AccessoryIIDStorage from .models import HomeKitEntryData @@ -846,7 +847,7 @@ class HomeKit: self.status = STATUS_WAIT self._cancel_reload_dispatcher = async_dispatcher_connect( self.hass, - f"homekit_reload_entities_{self._entry_id}", + SIGNAL_RELOAD_ENTITIES.format(self._entry_id), self.async_reload_accessories, ) async_zc_instance = await zeroconf.async_get_async_instance(self.hass) diff --git a/homeassistant/components/homekit/accessories.py b/homeassistant/components/homekit/accessories.py index 63575189946..39fa62e3445 100644 --- a/homeassistant/components/homekit/accessories.py +++ b/homeassistant/components/homekit/accessories.py @@ -84,6 +84,7 @@ from .const import ( MAX_VERSION_LENGTH, SERV_ACCESSORY_INFO, SERV_BATTERY_SERVICE, + SIGNAL_RELOAD_ENTITIES, TYPE_FAUCET, TYPE_OUTLET, TYPE_SHOWER, @@ -621,7 +622,7 @@ class HomeAccessory(Accessory): # type: ignore[misc] """Reload and recreate an accessory and update the c# value in the mDNS record.""" async_dispatcher_send( self.hass, - f"homekit_reload_entities_{self.driver.entry_id}", + SIGNAL_RELOAD_ENTITIES.format(self.driver.entry_id), (self.entity_id,), ) diff --git a/homeassistant/components/homekit/const.py b/homeassistant/components/homekit/const.py index 149d2aedd67..9f44e2ab616 100644 --- a/homeassistant/components/homekit/const.py +++ b/homeassistant/components/homekit/const.py @@ -1,6 +1,9 @@ """Constants used be the HomeKit component.""" +from __future__ import annotations + from homeassistant.const import CONF_DEVICES +from homeassistant.util.signal_type import SignalTypeFormat # #### Misc #### DEBOUNCE_TIMEOUT = 0.5 @@ -11,6 +14,9 @@ HOMEKIT_FILE = ".homekit.state" SHUTDOWN_TIMEOUT = 30 CONF_ENTRY_INDEX = "index" EMPTY_MAC = "00:00:00:00:00:00" +SIGNAL_RELOAD_ENTITIES: SignalTypeFormat[tuple[str, ...]] = SignalTypeFormat( + "homekit_reload_entities_{}" +) # ### Codecs #### VIDEO_CODEC_COPY = "copy"