mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 19:57:07 +00:00
HomematicIP fix cover direction (#20901)
* Fix cover direction * Update for better readability * Fix lint
This commit is contained in:
parent
a55c2514d1
commit
e538320901
@ -15,6 +15,9 @@ DEPENDENCIES = ['homematicip_cloud']
|
|||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
HMIP_COVER_OPEN = 0
|
||||||
|
HMIP_COVER_CLOSED = 1
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_platform(
|
async def async_setup_platform(
|
||||||
hass, config, async_add_entities, discovery_info=None):
|
hass, config, async_add_entities, discovery_info=None):
|
||||||
@ -47,23 +50,24 @@ class HomematicipCoverShutter(HomematicipGenericDevice, CoverDevice):
|
|||||||
async def async_set_cover_position(self, **kwargs):
|
async def async_set_cover_position(self, **kwargs):
|
||||||
"""Move the cover to a specific position."""
|
"""Move the cover to a specific position."""
|
||||||
position = kwargs[ATTR_POSITION]
|
position = kwargs[ATTR_POSITION]
|
||||||
level = position / 100.0
|
# HmIP cover is closed:1 -> open:0
|
||||||
|
level = 1 - position / 100.0
|
||||||
await self._device.set_shutter_level(level)
|
await self._device.set_shutter_level(level)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_closed(self):
|
def is_closed(self):
|
||||||
"""Return if the cover is closed."""
|
"""Return if the cover is closed."""
|
||||||
if self._device.shutterLevel is not None:
|
if self._device.shutterLevel is not None:
|
||||||
return self._device.shutterLevel == 0
|
return self._device.shutterLevel == HMIP_COVER_CLOSED
|
||||||
return None
|
return None
|
||||||
|
|
||||||
async def async_open_cover(self, **kwargs):
|
async def async_open_cover(self, **kwargs):
|
||||||
"""Open the cover."""
|
"""Open the cover."""
|
||||||
await self._device.set_shutter_level(1)
|
await self._device.set_shutter_level(HMIP_COVER_OPEN)
|
||||||
|
|
||||||
async def async_close_cover(self, **kwargs):
|
async def async_close_cover(self, **kwargs):
|
||||||
"""Close the cover."""
|
"""Close the cover."""
|
||||||
await self._device.set_shutter_level(0)
|
await self._device.set_shutter_level(HMIP_COVER_CLOSED)
|
||||||
|
|
||||||
async def async_stop_cover(self, **kwargs):
|
async def async_stop_cover(self, **kwargs):
|
||||||
"""Stop the device if in motion."""
|
"""Stop the device if in motion."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user