mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 10:47:10 +00:00
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
@ -12,8 +12,9 @@ from broadlink.exceptions import (
|
|||||||
NetworkTimeoutError,
|
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.const import CONF_HOST, CONF_MAC, CONF_NAME, CONF_TIMEOUT, CONF_TYPE
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.exceptions import ConfigEntryNotReady
|
from homeassistant.exceptions import ConfigEntryNotReady
|
||||||
from homeassistant.helpers import device_registry as dr
|
from homeassistant.helpers import device_registry as dr
|
||||||
|
|
||||||
@ -64,13 +65,15 @@ class BroadlinkDevice:
|
|||||||
return self.update_manager.available
|
return self.update_manager.available
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
async def async_update(hass, entry):
|
async def async_update(hass: HomeAssistant, entry: ConfigEntry) -> None:
|
||||||
"""Update the device and related entities.
|
"""Update the device and related entities.
|
||||||
|
|
||||||
Triggered when the device is renamed on the frontend.
|
Triggered when the device is renamed on the frontend.
|
||||||
"""
|
"""
|
||||||
device_registry = dr.async_get(hass)
|
device_registry = dr.async_get(hass)
|
||||||
|
assert entry.unique_id
|
||||||
device_entry = device_registry.async_get_device({(DOMAIN, 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)
|
device_registry.async_update_device(device_entry.id, name=entry.title)
|
||||||
await hass.config_entries.async_reload(entry.entry_id)
|
await hass.config_entries.async_reload(entry.entry_id)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user