Fibaro finish separation of scenes (#100734)
This commit is contained in:
parent
14b39c3bcf
commit
a2730fb29d
3 changed files with 11 additions and 16 deletions
|
@ -7,7 +7,6 @@ from pyfibaro.fibaro_scene import SceneModel
|
|||
|
||||
from homeassistant.components.scene import Scene
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.device_registry import DeviceInfo
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
|
@ -25,7 +24,7 @@ async def async_setup_entry(
|
|||
"""Perform the setup for Fibaro scenes."""
|
||||
controller: FibaroController = hass.data[DOMAIN][entry.entry_id]
|
||||
async_add_entities(
|
||||
[FibaroScene(scene) for scene in controller.fibaro_devices[Platform.SCENE]],
|
||||
[FibaroScene(scene, controller) for scene in controller.read_scenes()],
|
||||
True,
|
||||
)
|
||||
|
||||
|
@ -33,11 +32,10 @@ async def async_setup_entry(
|
|||
class FibaroScene(Scene):
|
||||
"""Representation of a Fibaro scene entity."""
|
||||
|
||||
def __init__(self, fibaro_scene: SceneModel) -> None:
|
||||
def __init__(self, fibaro_scene: SceneModel, controller: FibaroController) -> None:
|
||||
"""Initialize the Fibaro scene."""
|
||||
self._fibaro_scene = fibaro_scene
|
||||
|
||||
controller: FibaroController = fibaro_scene.fibaro_controller
|
||||
room_name = controller.get_room_name(fibaro_scene.room_id)
|
||||
if not room_name:
|
||||
room_name = "Unknown"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue