2019-02-13 20:21:14 +00:00
|
|
|
"""Support for Abode Security System covers."""
|
2019-10-12 20:02:12 +00:00
|
|
|
import abodepy.helpers.constants as CONST
|
|
|
|
|
2020-04-25 16:07:15 +00:00
|
|
|
from homeassistant.components.cover import CoverEntity
|
2017-08-29 15:34:19 +00:00
|
|
|
|
2019-10-13 18:01:04 +00:00
|
|
|
from . import AbodeDevice
|
|
|
|
from .const import DOMAIN
|
2019-03-21 05:56:46 +00:00
|
|
|
|
2017-08-29 15:34:19 +00:00
|
|
|
|
2019-10-13 18:01:04 +00:00
|
|
|
async def async_setup_entry(hass, config_entry, async_add_entities):
|
2017-08-29 15:34:19 +00:00
|
|
|
"""Set up Abode cover devices."""
|
2019-10-13 18:01:04 +00:00
|
|
|
data = hass.data[DOMAIN]
|
2017-08-29 15:34:19 +00:00
|
|
|
|
2019-11-09 06:35:45 +00:00
|
|
|
entities = []
|
|
|
|
|
2017-09-18 15:39:41 +00:00
|
|
|
for device in data.abode.get_devices(generic_type=CONST.TYPE_COVER):
|
2019-11-09 06:35:45 +00:00
|
|
|
entities.append(AbodeCover(data, device))
|
2017-09-18 15:39:41 +00:00
|
|
|
|
2019-11-09 06:35:45 +00:00
|
|
|
async_add_entities(entities)
|
2017-08-29 15:34:19 +00:00
|
|
|
|
|
|
|
|
2020-04-25 16:07:15 +00:00
|
|
|
class AbodeCover(AbodeDevice, CoverEntity):
|
2017-08-29 15:34:19 +00:00
|
|
|
"""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()
|