2019-02-13 20:21:14 +00:00
|
|
|
"""Support for Abode Security System covers."""
|
2017-08-29 15:34:19 +00:00
|
|
|
import logging
|
|
|
|
|
2017-09-18 15:39:41 +00:00
|
|
|
from homeassistant.components.abode import AbodeDevice, DOMAIN as ABODE_DOMAIN
|
2017-08-29 15:34:19 +00:00
|
|
|
from homeassistant.components.cover import CoverDevice
|
|
|
|
|
|
|
|
DEPENDENCIES = ['abode']
|
|
|
|
|
|
|
|
_LOGGER = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
2018-08-24 14:37:30 +00:00
|
|
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
2017-08-29 15:34:19 +00:00
|
|
|
"""Set up Abode cover devices."""
|
|
|
|
import abodepy.helpers.constants as CONST
|
|
|
|
|
2017-09-18 15:39:41 +00:00
|
|
|
data = hass.data[ABODE_DOMAIN]
|
2017-08-29 15:34:19 +00:00
|
|
|
|
2017-09-18 15:39:41 +00:00
|
|
|
devices = []
|
|
|
|
for device in data.abode.get_devices(generic_type=CONST.TYPE_COVER):
|
|
|
|
if data.is_excluded(device):
|
|
|
|
continue
|
2017-08-29 15:34:19 +00:00
|
|
|
|
2017-09-18 15:39:41 +00:00
|
|
|
devices.append(AbodeCover(data, device))
|
|
|
|
|
|
|
|
data.devices.extend(devices)
|
|
|
|
|
2018-08-24 14:37:30 +00:00
|
|
|
add_entities(devices)
|
2017-08-29 15:34:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
class AbodeCover(AbodeDevice, CoverDevice):
|
|
|
|
"""Representation of an Abode cover."""
|
|
|
|
|
|
|
|
@property
|
|
|
|
def is_closed(self):
|
|
|
|
"""Return true if cover is closed, else False."""
|
2017-09-18 15:39:41 +00:00
|
|
|
return not self._device.is_open
|
2017-08-29 15:34:19 +00:00
|
|
|
|
2017-09-18 15:39:41 +00:00
|
|
|
def close_cover(self, **kwargs):
|
2017-08-29 15:34:19 +00:00
|
|
|
"""Issue close command to cover."""
|
|
|
|
self._device.close_cover()
|
|
|
|
|
2017-09-18 15:39:41 +00:00
|
|
|
def open_cover(self, **kwargs):
|
2017-08-29 15:34:19 +00:00
|
|
|
"""Issue open command to cover."""
|
|
|
|
self._device.open_cover()
|