Use SignalType to improve typing [esphome] (#114296)
This commit is contained in:
parent
45da6f8f2c
commit
09ebca9630
2 changed files with 6 additions and 3 deletions
|
@ -47,6 +47,7 @@ from homeassistant.core import CALLBACK_TYPE, HomeAssistant, callback
|
|||
from homeassistant.helpers import entity_registry as er
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
||||
from homeassistant.helpers.storage import Store
|
||||
from homeassistant.util.signal_type import SignalType
|
||||
|
||||
from .const import DOMAIN
|
||||
from .dashboard import async_get_dashboard
|
||||
|
@ -147,9 +148,9 @@ class RuntimeEntryData:
|
|||
)
|
||||
|
||||
@property
|
||||
def signal_static_info_updated(self) -> str:
|
||||
def signal_static_info_updated(self) -> SignalType[list[EntityInfo]]:
|
||||
"""Return the signal to listen to for updates on static info."""
|
||||
return f"esphome_{self.entry_id}_on_list"
|
||||
return SignalType(f"esphome_{self.entry_id}_on_list")
|
||||
|
||||
@callback
|
||||
def async_register_static_info_callback(
|
||||
|
|
|
@ -139,7 +139,9 @@ class ESPHomeUpdateEntity(CoordinatorEntity[ESPHomeDashboard], UpdateEntity):
|
|||
)
|
||||
|
||||
@callback
|
||||
def _handle_device_update(self, static_info: EntityInfo | None = None) -> None:
|
||||
def _handle_device_update(
|
||||
self, static_info: list[EntityInfo] | None = None
|
||||
) -> None:
|
||||
"""Handle updated data from the device."""
|
||||
self._update_attrs()
|
||||
self.async_write_ha_state()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue