Skip to content

Commit 651f4d6

Browse files
committed
v2026.4.0
implemented 'CoordinatorEntity'
1 parent f9b46c5 commit 651f4d6

3 files changed

Lines changed: 5 additions & 13 deletions

File tree

custom_components/tibber_local/__init__.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -352,12 +352,12 @@ async def entry_update_listener(hass: HomeAssistant, config_entry: ConfigEntry)
352352

353353

354354
class TibberLocalEntity(CustomFriendlyNameEntity):
355-
_attr_should_poll = False
356355
_attr_has_entity_name = True
357356

358357
def __init__(
359358
self, coordinator: TibberLocalDataUpdateCoordinator, description: EntityDescription
360359
) -> None:
360+
super().__init__(coordinator, description)
361361
self.coordinator = coordinator
362362
self.entity_description = description
363363
self._stitle = coordinator._config_entry.title
@@ -382,15 +382,7 @@ def unique_id(self):
382382
async def async_added_to_hass(self):
383383
"""Connect to dispatcher listening for entity data notifications."""
384384
self.async_on_remove(self.coordinator.async_add_listener(self.async_write_ha_state))
385-
386-
async def async_update(self):
387-
"""Update entity."""
388-
await self.coordinator.async_request_refresh()
389-
390-
@property
391-
def should_poll(self) -> bool:
392-
"""Entities do not individually poll."""
393-
return False
385+
await super().async_added_to_hass()
394386

395387
def _friendly_name_internal(self) -> str | None:
396388
"""Return the friendly name.

custom_components/tibber_local/entity.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
from awesomeversion import AwesomeVersion
44
from homeassistant.const import ATTR_FRIENDLY_NAME, __version__ as HA_VERSION
5-
from homeassistant.helpers.entity import Entity
5+
from homeassistant.helpers.update_coordinator import CoordinatorEntity
66

77
USE_NEW_FRIENDLY_NAME = AwesomeVersion(HA_VERSION) >= AwesomeVersion("2026.2.0")
88

99
_LOGGER = logging.getLogger(__name__)
1010
#_LOGGER.debug(f"HA Version: {HA_VERSION}, USE_NEW_FRIENDLY_NAME: {USE_NEW_FRIENDLY_NAME}")
1111

1212

13-
class CustomFriendlyNameEntity(Entity):
13+
class CustomFriendlyNameEntity(CoordinatorEntity):
1414

1515
def __init__(self, *args, **kwargs):
1616
"""Initialize and check if method exists."""

custom_components/tibber_local/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
"iot_class": "local_push",
1212
"issue_tracker": "https://github.com/marq24/ha-tibber-pulse-local/issues",
1313
"requirements": ["smllib>=1.7"],
14-
"version": "2026.3.5"
14+
"version": "2026.4.0"
1515
}

0 commit comments

Comments
 (0)