From 66684dfab78f92db1b7d6d75d38a8b22f6e7bb3e Mon Sep 17 00:00:00 2001 From: Alone Date: Fri, 2 Dec 2022 13:53:01 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=95=B9=EF=B8=8F=20fix=20sub-entities=20fo?= =?UTF-8?q?r=20miir=20(#879)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/xiaomi_miot/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/custom_components/xiaomi_miot/__init__.py b/custom_components/xiaomi_miot/__init__.py index d8f67caa1..cd8d5536e 100644 --- a/custom_components/xiaomi_miot/__init__.py +++ b/custom_components/xiaomi_miot/__init__.py @@ -2186,6 +2186,11 @@ def __init__(self, miot_service=None, device=None, **kwargs): self._act_turn_off = miot_service.get_action('turn_off') self._attr_should_poll = False + async def async_added_to_hass(self): + await super().async_added_to_hass() + if self.is_main_entity: + await self.async_update_for_main_entity() + @property def is_on(self): """Return True if entity is on."""