예제 #1
0
def _create_fan(knx_module: XKNX, config: ConfigType) -> XknxFan:
    """Return a KNX Fan device to be used within XKNX."""

    fan = XknxFan(
        knx_module,
        name=config[CONF_NAME],
        group_address_speed=config.get(KNX_ADDRESS),
        group_address_speed_state=config.get(FanSchema.CONF_STATE_ADDRESS),
        group_address_oscillation=config.get(
            FanSchema.CONF_OSCILLATION_ADDRESS),
        group_address_oscillation_state=config.get(
            FanSchema.CONF_OSCILLATION_STATE_ADDRESS),
        max_step=config.get(FanSchema.CONF_MAX_STEP),
    )
    return fan
예제 #2
0
 def __init__(self, xknx: XKNX, config: ConfigType) -> None:
     """Initialize of KNX fan."""
     self._device: XknxFan
     max_step = config.get(FanSchema.CONF_MAX_STEP)
     super().__init__(device=XknxFan(
         xknx,
         name=config[CONF_NAME],
         group_address_speed=config.get(KNX_ADDRESS),
         group_address_speed_state=config.get(FanSchema.CONF_STATE_ADDRESS),
         group_address_oscillation=config.get(
             FanSchema.CONF_OSCILLATION_ADDRESS),
         group_address_oscillation_state=config.get(
             FanSchema.CONF_OSCILLATION_STATE_ADDRESS),
         max_step=max_step,
     ))
     self._unique_id = f"{self._device.speed.group_address}"
     # FanSpeedMode.STEP if max_step is set
     self._step_range: tuple[int, int] | None = (
         1, max_step) if max_step else None
예제 #3
0
파일: fan.py 프로젝트: stefano055415/core
    def __init__(self, xknx: XKNX, config: ConfigType) -> None:
        """Initialize of KNX fan."""
        max_step = config.get(FanSchema.CONF_MAX_STEP)
        super().__init__(device=XknxFan(
            xknx,
            name=config[CONF_NAME],
            group_address_speed=config.get(KNX_ADDRESS),
            group_address_speed_state=config.get(FanSchema.CONF_STATE_ADDRESS),
            group_address_oscillation=config.get(
                FanSchema.CONF_OSCILLATION_ADDRESS),
            group_address_oscillation_state=config.get(
                FanSchema.CONF_OSCILLATION_STATE_ADDRESS),
            max_step=max_step,
        ))
        # FanSpeedMode.STEP if max_step is set
        self._step_range: tuple[int, int] | None = (
            1, max_step) if max_step else None

        self._attr_supported_features = SUPPORT_SET_SPEED
        if self._device.supports_oscillation:
            self._attr_supported_features |= SUPPORT_OSCILLATE
        self._attr_unique_id = str(self._device.speed.group_address)