diff --git a/homeassistant/components/tile/__init__.py b/homeassistant/components/tile/__init__.py index 58295c98befa..ad4a8886873e 100644 --- a/homeassistant/components/tile/__init__.py +++ b/homeassistant/components/tile/__init__.py @@ -8,8 +8,11 @@ from pytile.errors import SessionExpiredError, TileError from homeassistant.const import ATTR_ATTRIBUTION, CONF_PASSWORD, CONF_USERNAME from homeassistant.core import callback from homeassistant.helpers import aiohttp_client -from homeassistant.helpers.entity import Entity -from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed +from homeassistant.helpers.update_coordinator import ( + CoordinatorEntity, + DataUpdateCoordinator, + UpdateFailed, +) from .const import DATA_COORDINATOR, DOMAIN, LOGGER @@ -85,15 +88,15 @@ async def async_unload_entry(hass, config_entry): return unload_ok -class TileEntity(Entity): +class TileEntity(CoordinatorEntity): """Define a generic Tile entity.""" def __init__(self, coordinator): """Initialize.""" + super().__init__(coordinator) self._attrs = {ATTR_ATTRIBUTION: DEFAULT_ATTRIBUTION} self._name = None self._unique_id = None - self.coordinator = coordinator @property def device_state_attributes(self): @@ -110,11 +113,6 @@ class TileEntity(Entity): """Return the name.""" return self._name - @property - def should_poll(self): - """Disable polling.""" - return False - @property def unique_id(self): """Return the unique ID of the entity.""" @@ -137,10 +135,3 @@ class TileEntity(Entity): self.async_on_remove(self.coordinator.async_add_listener(update)) self._update_from_latest_data() - - async def async_update(self): - """Update the entity. - - Only used by the generic entity update service. - """ - await self.coordinator.async_request_refresh()