From 87ba8a56ee4d8e05e72ec5f39ffa13faea4f5e02 Mon Sep 17 00:00:00 2001 From: Shay Levy Date: Sat, 9 Apr 2022 08:54:42 +0300 Subject: [PATCH] Fix Shelly gen2 cover unavailable when not calibrated (#69671) --- homeassistant/components/shelly/cover.py | 3 --- tests/components/shelly/test_cover.py | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/shelly/cover.py b/homeassistant/components/shelly/cover.py index 4885a2a0d2..79ee15ee5c 100644 --- a/homeassistant/components/shelly/cover.py +++ b/homeassistant/components/shelly/cover.py @@ -157,9 +157,6 @@ class RpcShellyCover(ShellyRpcEntity, CoverEntity): @property def is_closed(self) -> bool | None: """If cover is closed.""" - if not self.status["pos_control"]: - return None - return cast(bool, self.status["state"] == "closed") @property diff --git a/tests/components/shelly/test_cover.py b/tests/components/shelly/test_cover.py index 8813de200d..ab8c9a9a87 100644 --- a/tests/components/shelly/test_cover.py +++ b/tests/components/shelly/test_cover.py @@ -12,7 +12,7 @@ from homeassistant.components.cover import ( STATE_OPEN, STATE_OPENING, ) -from homeassistant.const import ATTR_ENTITY_ID, STATE_UNKNOWN +from homeassistant.const import ATTR_ENTITY_ID from homeassistant.helpers.entity_component import async_update_entity ROLLER_BLOCK_ID = 1 @@ -189,4 +189,4 @@ async def test_rpc_device_no_position_control(hass, rpc_wrapper, monkeypatch): await async_update_entity(hass, "cover.test_cover_0") await hass.async_block_till_done() - assert hass.states.get("cover.test_cover_0").state == STATE_UNKNOWN + assert hass.states.get("cover.test_cover_0").state == STATE_OPEN