1 """The base entity for the rest component."""
3 from __future__
import annotations
5 from abc
import abstractmethod
13 from .data
import RestData
17 """A class for entities using DataUpdateCoordinator or rest data directly."""
21 coordinator: DataUpdateCoordinator[Any] |
None,
23 resource_template: Template |
None,
26 """Create the entity that may have a coordinator."""
35 """Return the availability of this sensor."""
38 return self.
restrest.data
is not None
41 """When entity is added to hass."""
51 """Handle updated data from the coordinator."""
56 """Get the latest data from REST API and update the state."""
58 await self.
_coordinator_coordinator.async_request_refresh()
68 """Update state from the rest data."""
None _update_from_rest_data(self)
None _handle_coordinator_update(self)
None __init__(self, DataUpdateCoordinator[Any]|None coordinator, RestData rest, Template|None resource_template, bool force_update)
None async_added_to_hass(self)
None async_write_ha_state(self)
None async_on_remove(self, CALLBACK_TYPE func)
None async_add_listener(HomeAssistant hass, Callable[[], None] listener)