Add update listener type hints to broadlink (#65413)
Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
parent
23ee8adf59
commit
b587201654
1 changed files with 5 additions and 2 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue