Skip to content

Commit

Permalink
Fixed Homematic cover (#3116)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielperna84 authored and robbiet480 committed Sep 2, 2016
1 parent 14ed7c0 commit 5222faa
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions homeassistant/components/cover/homematic.py
Expand Up @@ -11,7 +11,7 @@
import logging
from homeassistant.const import STATE_UNKNOWN
from homeassistant.components.cover import CoverDevice,\
ATTR_CURRENT_POSITION
ATTR_POSITION
import homeassistant.components.homematic as homematic

_LOGGER = logging.getLogger(__name__)
Expand Down Expand Up @@ -41,16 +41,16 @@ def current_cover_position(self):
None is unknown, 0 is closed, 100 is fully open.
"""
if self.available:
return int((1 - self._hm_get_state()) * 100)
return int(self._hm_get_state() * 100)
return None

def set_cover_position(self, **kwargs):
"""Move the cover to a specific position."""
if self.available:
if ATTR_CURRENT_POSITION in kwargs:
position = float(kwargs[ATTR_CURRENT_POSITION])
if ATTR_POSITION in kwargs:
position = float(kwargs[ATTR_POSITION])
position = min(100, max(0, position))
level = (100 - position) / 100.0
level = position / 100.0
self._hmdevice.set_level(level, self._channel)

@property
Expand Down

0 comments on commit 5222faa

Please sign in to comment.