Fix Error with HomematicIP Cloud Cover (#30667)
parent
030a399b09
commit
4c5ea54df9
|
@ -58,7 +58,9 @@ class HomematicipCoverShutter(HomematicipGenericDevice, CoverDevice):
|
|||
@property
|
||||
def current_cover_position(self) -> int:
|
||||
"""Return current position of cover."""
|
||||
return int((1 - self._device.shutterLevel) * 100)
|
||||
if self._device.shutterLevel is not None:
|
||||
return int((1 - self._device.shutterLevel) * 100)
|
||||
return None
|
||||
|
||||
async def async_set_cover_position(self, **kwargs) -> None:
|
||||
"""Move the cover to a specific position."""
|
||||
|
@ -93,7 +95,9 @@ class HomematicipCoverSlats(HomematicipCoverShutter, CoverDevice):
|
|||
@property
|
||||
def current_cover_tilt_position(self) -> int:
|
||||
"""Return current tilt position of cover."""
|
||||
return int((1 - self._device.slatsLevel) * 100)
|
||||
if self._device.slatsLevel is not None:
|
||||
return int((1 - self._device.slatsLevel) * 100)
|
||||
return None
|
||||
|
||||
async def async_set_cover_tilt_position(self, **kwargs) -> None:
|
||||
"""Move the cover to a specific tilt position."""
|
||||
|
|
|
@ -7,7 +7,7 @@ from homeassistant.components.cover import (
|
|||
DOMAIN as COVER_DOMAIN,
|
||||
)
|
||||
from homeassistant.components.homematicip_cloud import DOMAIN as HMIPC_DOMAIN
|
||||
from homeassistant.const import STATE_CLOSED, STATE_OPEN
|
||||
from homeassistant.const import STATE_CLOSED, STATE_OPEN, STATE_UNKNOWN
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from .helper import async_manipulate_test_data, get_and_check_entity_basics
|
||||
|
@ -87,7 +87,7 @@ async def test_hmip_cover_shutter(hass, default_mock_hap):
|
|||
|
||||
await async_manipulate_test_data(hass, hmip_device, "shutterLevel", None)
|
||||
ha_state = hass.states.get(entity_id)
|
||||
assert ha_state.state == STATE_CLOSED
|
||||
assert ha_state.state == STATE_UNKNOWN
|
||||
|
||||
|
||||
async def test_hmip_cover_slats(hass, default_mock_hap):
|
||||
|
@ -154,7 +154,7 @@ async def test_hmip_cover_slats(hass, default_mock_hap):
|
|||
|
||||
await async_manipulate_test_data(hass, hmip_device, "shutterLevel", None)
|
||||
ha_state = hass.states.get(entity_id)
|
||||
assert ha_state.state == STATE_OPEN
|
||||
assert ha_state.state == STATE_UNKNOWN
|
||||
|
||||
|
||||
async def test_hmip_garage_door_tormatic(hass, default_mock_hap):
|
||||
|
|
Loading…
Reference in New Issue