hass-core/homeassistant/components/fibaro/scene.py
epenet 5ddab5a7f2
Add setup type hints to number, remote and scene (#63299)
* Add number setup type hints

* Add remote setup type hints

* Add scene setup type hints

Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-01-03 17:17:44 +01:00

34 lines
981 B
Python

"""Support for Fibaro scenes."""
from __future__ import annotations
from typing import Any
from homeassistant.components.scene import Scene
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
from . import FIBARO_DEVICES, FibaroDevice
async def async_setup_platform(
hass: HomeAssistant,
config: ConfigType,
async_add_entities: AddEntitiesCallback,
discovery_info: DiscoveryInfoType | None = None,
) -> None:
"""Perform the setup for Fibaro scenes."""
if discovery_info is None:
return
async_add_entities(
[FibaroScene(scene) for scene in hass.data[FIBARO_DEVICES]["scene"]], True
)
class FibaroScene(FibaroDevice, Scene):
"""Representation of a Fibaro scene entity."""
def activate(self, **kwargs: Any) -> None:
"""Activate the scene."""
self.fibaro_device.start()