From b9fe4925064f451a58e78ae8872894a146b38818 Mon Sep 17 00:00:00 2001 From: Tomaae <23486452+tomaae@users.noreply.github.com> Date: Wed, 10 May 2023 13:42:10 +0200 Subject: [PATCH] fixed entity update --- custom_components/portainer/entity.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/custom_components/portainer/entity.py b/custom_components/portainer/entity.py index 1cc5fc7..c41dcdf 100644 --- a/custom_components/portainer/entity.py +++ b/custom_components/portainer/entity.py @@ -105,7 +105,14 @@ def __init__( self._uid = uid self._data = coordinator.data[self.description.data_path] if self._uid: - self._data = self._data[self._uid] + self._data = coordinator.data[self.description.data_path][self._uid] + + @callback + def _handle_coordinator_update(self) -> None: + self._data = self.coordinator.data[self.description.data_path] + if self._uid: + self._data = self.coordinator.data[self.description.data_path][self._uid] + super()._handle_coordinator_update() @property def name(self) -> str: