2016-12-12 05:39:37 +00:00
|
|
|
"""
|
|
|
|
Support for Tellstick covers using Tellstick Net.
|
|
|
|
|
|
|
|
This platform uses the Telldus Live online service.
|
|
|
|
|
|
|
|
For more details about this platform, please refer to the documentation at
|
|
|
|
https://home-assistant.io/components/cover.tellduslive/
|
|
|
|
"""
|
|
|
|
import logging
|
|
|
|
|
2018-12-04 09:08:40 +00:00
|
|
|
from homeassistant.components import tellduslive
|
2016-12-12 05:39:37 +00:00
|
|
|
from homeassistant.components.cover import CoverDevice
|
2018-12-04 09:08:40 +00:00
|
|
|
from homeassistant.components.tellduslive.entry import TelldusLiveEntity
|
2016-12-12 05:39:37 +00:00
|
|
|
|
|
|
|
_LOGGER = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
2018-08-24 14:37:30 +00:00
|
|
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
2017-04-30 05:04:49 +00:00
|
|
|
"""Set up the Telldus Live covers."""
|
2016-12-12 05:39:37 +00:00
|
|
|
if discovery_info is None:
|
|
|
|
return
|
2017-04-30 05:04:49 +00:00
|
|
|
|
2018-12-04 09:08:40 +00:00
|
|
|
client = hass.data[tellduslive.DOMAIN]
|
|
|
|
add_entities(TelldusLiveCover(client, cover) for cover in discovery_info)
|
2016-12-12 05:39:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
class TelldusLiveCover(TelldusLiveEntity, CoverDevice):
|
|
|
|
"""Representation of a cover."""
|
|
|
|
|
|
|
|
@property
|
|
|
|
def is_closed(self):
|
|
|
|
"""Return the current position of the cover."""
|
2018-08-26 19:25:39 +00:00
|
|
|
return self.device.is_down
|
2016-12-12 05:39:37 +00:00
|
|
|
|
|
|
|
def close_cover(self, **kwargs):
|
|
|
|
"""Close the cover."""
|
2018-08-26 19:25:39 +00:00
|
|
|
self.device.down()
|
2016-12-12 05:39:37 +00:00
|
|
|
|
|
|
|
def open_cover(self, **kwargs):
|
|
|
|
"""Open the cover."""
|
2018-08-26 19:25:39 +00:00
|
|
|
self.device.up()
|
2016-12-12 05:39:37 +00:00
|
|
|
|
|
|
|
def stop_cover(self, **kwargs):
|
|
|
|
"""Stop the cover."""
|
2018-08-26 19:25:39 +00:00
|
|
|
self.device.stop()
|