From b5872016548466ea81a9cf84ce4a29f638632d8b Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Thu, 3 Feb 2022 10:00:30 +0100 Subject: [PATCH] Add update listener type hints to broadlink (#65413) Co-authored-by: epenet --- homeassistant/components/broadlink/device.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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)