예제 #1
0
def _create_scene(knx_module: XKNX, config: ConfigType) -> XknxScene:
    """Return a KNX scene to be used within XKNX."""
    return XknxScene(
        knx_module,
        name=config[CONF_NAME],
        group_address=config[CONF_ADDRESS],
        scene_number=config[SceneSchema.CONF_SCENE_NUMBER],
    )
예제 #2
0
파일: scene.py 프로젝트: kanamu/hass_confs
def async_add_entities_config(hass, config, async_add_entities):
    """Set up scene for KNX platform configured within platform."""
    scene = XknxScene(
        hass.data[DATA_KNX].xknx,
        name=config[CONF_NAME],
        group_address=config[CONF_ADDRESS],
        scene_number=config[CONF_SCENE_NUMBER],
    )
    hass.data[DATA_KNX].xknx.devices.add(scene)
    async_add_entities([KNXScene(scene)])
예제 #3
0
 def __init__(self, xknx: XKNX, config: ConfigType) -> None:
     """Init KNX scene."""
     super().__init__(device=XknxScene(
         xknx,
         name=config[CONF_NAME],
         group_address=config[KNX_ADDRESS],
         scene_number=config[SceneSchema.CONF_SCENE_NUMBER],
     ))
     self._attr_unique_id = (
         f"{self._device.scene_value.group_address}_{self._device.scene_number}"
     )