diff --git a/homeassistant/helpers/entity.py b/homeassistant/helpers/entity.py
index 988ce29ade2..5c8cff2f60b 100644
--- a/homeassistant/helpers/entity.py
+++ b/homeassistant/helpers/entity.py
@@ -1131,7 +1131,16 @@ class Entity(
):
if not self.__capabilities_updated_at_reported:
time_now = hass.loop.time()
- capabilities_updated_at = self.__capabilities_updated_at
+ # _Entity__capabilities_updated_at is because of name mangling
+ if not (
+ capabilities_updated_at := getattr(
+ self, "_Entity__capabilities_updated_at", None
+ )
+ ):
+ self.__capabilities_updated_at = deque(
+ maxlen=CAPABILITIES_UPDATE_LIMIT + 1
+ )
+ capabilities_updated_at = self.__capabilities_updated_at
capabilities_updated_at.append(time_now)
while time_now - capabilities_updated_at[0] > 3600:
capabilities_updated_at.popleft()
@@ -1444,8 +1453,6 @@ class Entity(
)
self._async_subscribe_device_updates()
- self.__capabilities_updated_at = deque(maxlen=CAPABILITIES_UPDATE_LIMIT + 1)
-
async def async_internal_will_remove_from_hass(self) -> None:
"""Run when entity will be removed from hass.