mirror of
https://github.com/home-assistant/core.git
synced 2025-08-06 06:05:10 +02:00
Use SignalType to improve typing [esphome] (#114296)
This commit is contained in:
@@ -47,6 +47,7 @@ from homeassistant.core import CALLBACK_TYPE, HomeAssistant, callback
|
|||||||
from homeassistant.helpers import entity_registry as er
|
from homeassistant.helpers import entity_registry as er
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
||||||
from homeassistant.helpers.storage import Store
|
from homeassistant.helpers.storage import Store
|
||||||
|
from homeassistant.util.signal_type import SignalType
|
||||||
|
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
from .dashboard import async_get_dashboard
|
from .dashboard import async_get_dashboard
|
||||||
@@ -147,9 +148,9 @@ class RuntimeEntryData:
|
|||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@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 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
|
@callback
|
||||||
def async_register_static_info_callback(
|
def async_register_static_info_callback(
|
||||||
|
@@ -139,7 +139,9 @@ class ESPHomeUpdateEntity(CoordinatorEntity[ESPHomeDashboard], UpdateEntity):
|
|||||||
)
|
)
|
||||||
|
|
||||||
@callback
|
@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."""
|
"""Handle updated data from the device."""
|
||||||
self._update_attrs()
|
self._update_attrs()
|
||||||
self.async_write_ha_state()
|
self.async_write_ha_state()
|
||||||
|
Reference in New Issue
Block a user