Fix Shelly gen2 cover unavailable when not calibrated (#69671)

This commit is contained in:
Shay Levy 2022-04-09 08:54:42 +03:00 committed by GitHub
parent 06d2aeec6b
commit 06e4c2f351
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 5 deletions

View File

@ -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

View File

@ -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