From 3b0ac469d4af621e6a2765f8b8be5639894d52e8 Mon Sep 17 00:00:00 2001 From: Matrix Date: Wed, 20 Mar 2024 23:45:21 +0800 Subject: [PATCH] YoLink fix cover incorrect state (#104975) * Fix cover incorrect state * Change entity to unavailable --- homeassistant/components/yolink/cover.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/yolink/cover.py b/homeassistant/components/yolink/cover.py index 03e36a2ba29..b2454bd0d4a 100644 --- a/homeassistant/components/yolink/cover.py +++ b/homeassistant/components/yolink/cover.py @@ -60,11 +60,13 @@ class YoLinkCoverEntity(YoLinkEntity, CoverEntity): """Update HA Entity State.""" if (state_val := state.get("state")) is None: return - if self.coordinator.paired_device is None: + if self.coordinator.paired_device is None or state_val == "error": self._attr_is_closed = None + self._attr_available = False self.async_write_ha_state() elif state_val in ["open", "closed"]: self._attr_is_closed = state_val == "closed" + self._attr_available = True self.async_write_ha_state() async def toggle_garage_state(self) -> None: