1 """Base class Harmony entities."""
3 from __future__
import annotations
5 from collections.abc
import Callable
6 from datetime
import datetime
13 from .data
import HarmonyData
15 _LOGGER = logging.getLogger(__name__)
17 TIME_MARK_DISCONNECTED = 10
21 """Base entity for Harmony with connection state handling."""
23 _attr_has_entity_name =
True
26 """Initialize the Harmony base entity."""
34 """Return True if we're connected to the Hub, otherwise False."""
35 return self.
_data_data.available
38 """Notification that we're connected to the HUB."""
39 _LOGGER.debug(
"%s: connected to the HUB", self.
_data_data.name)
45 """Notification that we're disconnected from the HUB."""
46 _LOGGER.debug(
"%s: disconnected from the HUB", self.
_data_data.name)
51 TIME_MARK_DISCONNECTED,
None _async_clear_disconnection_delay(self)
None async_got_connected(self, str|None _=None)
None _async_mark_disconnected_if_unavailable(self, datetime _)
None async_got_disconnected(self, str|None _=None)
None __init__(self, HarmonyData data)
None async_write_ha_state(self)
CALLBACK_TYPE async_call_later(HomeAssistant hass, float|timedelta delay, HassJob[[datetime], Coroutine[Any, Any, None]|None]|Callable[[datetime], Coroutine[Any, Any, None]|None] action)