diff --git a/homeassistant/components/cover/myq.py b/homeassistant/components/cover/myq.py index bedc041fcccfa479656fc3eb5456b8b528509be4..6a17345188a4ddc271c3d26bfb03d56e26305ced 100644 --- a/homeassistant/components/cover/myq.py +++ b/homeassistant/components/cover/myq.py @@ -8,17 +8,25 @@ import logging import voluptuous as vol -from homeassistant.components.cover import CoverDevice +from homeassistant.components.cover import ( + CoverDevice, SUPPORT_CLOSE, SUPPORT_OPEN) from homeassistant.const import ( - CONF_USERNAME, CONF_PASSWORD, CONF_TYPE, STATE_CLOSED) + CONF_PASSWORD, CONF_TYPE, CONF_USERNAME, STATE_CLOSED, STATE_CLOSING, + STATE_OPENING) import homeassistant.helpers.config_validation as cv -REQUIREMENTS = ['pymyq==0.0.11'] +REQUIREMENTS = ['pymyq==0.0.15'] _LOGGER = logging.getLogger(__name__) DEFAULT_NAME = 'myq' +MYQ_TO_HASS = { + 'closed': STATE_CLOSED, + 'closing': STATE_CLOSING, + 'opening': STATE_OPENING +} + NOTIFICATION_ID = 'myq_notification' NOTIFICATION_TITLE = 'MyQ Cover Setup' @@ -87,7 +95,17 @@ class MyQDevice(CoverDevice): @property def is_closed(self): """Return true if cover is closed, else False.""" - return self._status == STATE_CLOSED + return MYQ_TO_HASS[self._status] == STATE_CLOSED + + @property + def is_closing(self): + """Return if the cover is closing or not.""" + return MYQ_TO_HASS[self._status] == STATE_CLOSING + + @property + def is_opening(self): + """Return if the cover is opening or not.""" + return MYQ_TO_HASS[self._status] == STATE_OPENING def close_cover(self, **kwargs): """Issue close command to cover.""" @@ -97,6 +115,11 @@ class MyQDevice(CoverDevice): """Issue open command to cover.""" self.myq.open_device(self.device_id) + @property + def supported_features(self): + """Flag supported features.""" + return SUPPORT_OPEN | SUPPORT_CLOSE + def update(self): """Update status of cover.""" self._status = self.myq.get_status(self.device_id) diff --git a/requirements_all.txt b/requirements_all.txt index 16c670167809a0b89486cec06bdd2cf56271e8ec..e31a2349dcfd7fde66b1724b687fc510233bf43c 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -962,7 +962,7 @@ pymonoprice==0.3 pymusiccast==0.1.6 # homeassistant.components.cover.myq -pymyq==0.0.11 +pymyq==0.0.15 # homeassistant.components.mysensors pymysensors==0.17.0