hass-core/homeassistant/components/velux/scene.py
Julius Mittenzwei 6f77d9bc34 Don't wait until final position of Velux cover is reached (#21558)
## Description:

* Bump version to latest version of pyvlx: 0.2.10. Library more failure tolerant, when detecting an unsupported device.
* When calling API (e.g. run scene, change position) don't wait until device has reached target position (This caused  HASS to be flaky while the device was moving)
* Support for vertical and horizontal awnings.
2019-03-10 03:47:22 -07:00

32 lines
915 B
Python

"""Support for VELUX scenes."""
from homeassistant.components.scene import Scene
from homeassistant.components.velux import _LOGGER, DATA_VELUX
DEPENDENCIES = ['velux']
async def async_setup_platform(
hass, config, async_add_entities, discovery_info=None):
"""Set up the scenes for Velux platform."""
entities = []
for scene in hass.data[DATA_VELUX].pyvlx.scenes:
entities.append(VeluxScene(scene))
async_add_entities(entities)
class VeluxScene(Scene):
"""Representation of a Velux scene."""
def __init__(self, scene):
"""Init velux scene."""
_LOGGER.info("Adding Velux scene: %s", scene)
self.scene = scene
@property
def name(self):
"""Return the name of the scene."""
return self.scene.name
async def async_activate(self):
"""Activate the scene."""
await self.scene.run(wait_for_completion=False)