From 0c310c166a69dfd90c858d238185a2017c7f64f8 Mon Sep 17 00:00:00 2001 From: Daniel Perna Date: Fri, 2 Sep 2016 06:32:12 +0200 Subject: [PATCH] Fixed Homematic cover (#3116) --- homeassistant/components/cover/homematic.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/cover/homematic.py b/homeassistant/components/cover/homematic.py index cab6b51e645..fd68ac3d265 100644 --- a/homeassistant/components/cover/homematic.py +++ b/homeassistant/components/cover/homematic.py @@ -11,7 +11,7 @@ properly configured. 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__) @@ -41,16 +41,16 @@ class HMCover(homematic.HMDevice, CoverDevice): 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