Fix callback and async (#31281)
* Fix callback and async * Fix a return * Fix test * Fix mqtt tests * Fix some more callbacks
This commit is contained in:
1 parent
ee602e40a6
commit
e9e44dbd97
90 files changed
+627
-883
No files matched your search
@@ -21,6 +21,7 @@ from aioesphomeapi import (
|
||||
import attr
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
||||
from homeassistant.helpers.storage import Store
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
@@ -71,6 +72,7 @@ class RuntimeEntryData:
|
||||
loaded_platforms = attr.ib(type=Set[str], factory=set)
|
||||
platform_load_lock = attr.ib(type=asyncio.Lock, factory=asyncio.Lock)
|
||||
|
||||
@callback
|
||||
def async_update_entity(
|
||||
self, hass: HomeAssistantType, component_key: str, key: int
|
||||
) -> None:
|
||||
@@ -80,6 +82,7 @@ class RuntimeEntryData:
|
||||
)
|
||||
async_dispatcher_send(hass, signal)
|
||||
|
||||
@callback
|
||||
def async_remove_entity(
|
||||
self, hass: HomeAssistantType, component_key: str, key: int
|
||||
) -> None:
|
||||
@@ -120,11 +123,13 @@ class RuntimeEntryData:
|
||||
signal = DISPATCHER_ON_LIST.format(entry_id=self.entry_id)
|
||||
async_dispatcher_send(hass, signal, infos)
|
||||
|
||||
@callback
|
||||
def async_update_state(self, hass: HomeAssistantType, state: EntityState) -> None:
|
||||
"""Distribute an update of state information to all platforms."""
|
||||
signal = DISPATCHER_ON_STATE.format(entry_id=self.entry_id)
|
||||
async_dispatcher_send(hass, signal, state)
|
||||
|
||||
@callback
|
||||
def async_update_device_state(self, hass: HomeAssistantType) -> None:
|
||||
"""Distribute an update of a core device state like availability."""
|
||||
signal = DISPATCHER_ON_DEVICE_UPDATE.format(entry_id=self.entry_id)
|
||||
|
||||
Reference in new issue
Block a user