2019-02-13 20:21:14 +00:00
|
|
|
"""Support for Fibaro scenes."""
|
2020-04-21 01:07:50 +00:00
|
|
|
from typing import Any
|
2018-12-03 13:57:55 +00:00
|
|
|
|
2019-03-21 05:56:46 +00:00
|
|
|
from homeassistant.components.scene import Scene
|
|
|
|
|
|
|
|
from . import FIBARO_DEVICES, FibaroDevice
|
2018-12-03 13:57:55 +00:00
|
|
|
|
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
|
2018-12-03 13:57:55 +00:00
|
|
|
"""Perform the setup for Fibaro scenes."""
|
|
|
|
if discovery_info is None:
|
|
|
|
return
|
|
|
|
|
|
|
|
async_add_entities(
|
2019-07-31 19:25:30 +00:00
|
|
|
[FibaroScene(scene) for scene in hass.data[FIBARO_DEVICES]["scene"]], True
|
|
|
|
)
|
2018-12-03 13:57:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
class FibaroScene(FibaroDevice, Scene):
|
|
|
|
"""Representation of a Fibaro scene entity."""
|
|
|
|
|
2020-04-21 01:07:50 +00:00
|
|
|
def activate(self, **kwargs: Any) -> None:
|
2018-12-03 13:57:55 +00:00
|
|
|
"""Activate the scene."""
|
|
|
|
self.fibaro_device.start()
|