diff --git a/homeassistant/components/broadlink/device.py b/homeassistant/components/broadlink/device.py index 951be9b26bb..46582334e2d 100644 --- a/homeassistant/components/broadlink/device.py +++ b/homeassistant/components/broadlink/device.py @@ -12,8 +12,9 @@ from broadlink.exceptions import ( NetworkTimeoutError, ) -from homeassistant.config_entries import SOURCE_REAUTH +from homeassistant.config_entries import SOURCE_REAUTH, ConfigEntry from homeassistant.const import CONF_HOST, CONF_MAC, CONF_NAME, CONF_TIMEOUT, CONF_TYPE +from homeassistant.core import HomeAssistant from homeassistant.exceptions import ConfigEntryNotReady from homeassistant.helpers import device_registry as dr @@ -64,13 +65,15 @@ class BroadlinkDevice: return self.update_manager.available @staticmethod - async def async_update(hass, entry): + async def async_update(hass: HomeAssistant, entry: ConfigEntry) -> None: """Update the device and related entities. Triggered when the device is renamed on the frontend. """ device_registry = dr.async_get(hass) + assert entry.unique_id device_entry = device_registry.async_get_device({(DOMAIN, entry.unique_id)}) + assert device_entry device_registry.async_update_device(device_entry.id, name=entry.title) await hass.config_entries.async_reload(entry.entry_id)