mirror of
https://github.com/home-assistant/core.git
synced 2025-07-11 07:17:12 +00:00
Fix Error with HomematicIP Cloud Cover (#30667)
This commit is contained in:
parent
030a399b09
commit
4c5ea54df9
@ -58,7 +58,9 @@ class HomematicipCoverShutter(HomematicipGenericDevice, CoverDevice):
|
|||||||
@property
|
@property
|
||||||
def current_cover_position(self) -> int:
|
def current_cover_position(self) -> int:
|
||||||
"""Return current position of cover."""
|
"""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:
|
async def async_set_cover_position(self, **kwargs) -> None:
|
||||||
"""Move the cover to a specific position."""
|
"""Move the cover to a specific position."""
|
||||||
@ -93,7 +95,9 @@ class HomematicipCoverSlats(HomematicipCoverShutter, CoverDevice):
|
|||||||
@property
|
@property
|
||||||
def current_cover_tilt_position(self) -> int:
|
def current_cover_tilt_position(self) -> int:
|
||||||
"""Return current tilt position of cover."""
|
"""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:
|
async def async_set_cover_tilt_position(self, **kwargs) -> None:
|
||||||
"""Move the cover to a specific tilt position."""
|
"""Move the cover to a specific tilt position."""
|
||||||
|
@ -7,7 +7,7 @@ from homeassistant.components.cover import (
|
|||||||
DOMAIN as COVER_DOMAIN,
|
DOMAIN as COVER_DOMAIN,
|
||||||
)
|
)
|
||||||
from homeassistant.components.homematicip_cloud import DOMAIN as HMIPC_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 homeassistant.setup import async_setup_component
|
||||||
|
|
||||||
from .helper import async_manipulate_test_data, get_and_check_entity_basics
|
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)
|
await async_manipulate_test_data(hass, hmip_device, "shutterLevel", None)
|
||||||
ha_state = hass.states.get(entity_id)
|
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):
|
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)
|
await async_manipulate_test_data(hass, hmip_device, "shutterLevel", None)
|
||||||
ha_state = hass.states.get(entity_id)
|
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):
|
async def test_hmip_garage_door_tormatic(hass, default_mock_hap):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user