1
mirror of https://github.com/home-assistant/core synced 2024-09-15 17:29:45 +02:00
ha-core/homeassistant/components/velux/scene.py
Paulus Schoutsen e2d3c27e85
Embed all platforms into components (#20677)
* Consolidate all components with platforms

* Organize tests

* Fix more tests

* Fix Verisure tests

* one final test fix

* Add change

* Fix coverage
2019-02-02 07:13:16 -08:00

40 lines
1.0 KiB
Python

"""
Support for VELUX scenes.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/scene.velux/
"""
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()