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