From 06e4c2f3518aa89ac30a7b6cfd0a8b4d64678fed 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 2dbff3989ca..9bc61f9415f 100644 --- a/homeassistant/components/shelly/cover.py +++ b/homeassistant/components/shelly/cover.py @@ -158,9 +158,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 8813de200da..ab8c9a9a876 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