Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Homematic cover #3116

Merged
merged 1 commit into from Sep 2, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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