Fan Component

With the fan domain you can create components that appear as fans in the Home Assistant frontend. A fan can be switched ON or OFF, optionally has a speed level between 1 and the maximum supported speed level of the fan, and can have an oscillate and direction output.

This component restores its state on reboot/reset.

../../_images/fan-ui.png

Base Fan Configuration

fan:
  - platform: ...
    name: ...

Configuration variables:

  • name (Required, string): The name of the fan.

  • internal (Optional, boolean): Mark this component as internal. Internal components will not be exposed to the frontend (like Home Assistant). Only specifying an id without a name will implicitly set this to true.

MQTT options:

  • oscillation_state_topic (Optional, string): The topic to publish fan oscillation state changes to.

  • oscillation_command_topic (Optional, string): The topic to receive oscillation commands on.

  • speed_state_topic (Optional, string): The topic to publish fan speed state changes to.

  • speed_command_topic (Optional, string): The topic to receive speed commands on.

  • All other options from MQTT Component.

Automation triggers:

fan.toggle Action

Toggles the ON/OFF state of the fan with the given ID when executed.

on_...:
  then:
    - fan.toggle: fan_1

fan.turn_off Action

Turns the fan with the given ID off when executed.

on_...:
  then:
    - fan.turn_off: fan_1

fan.turn_on Action

Turns the fan with the given ID on when executed.

on_...:
  then:
    - fan.turn_on:
        id: fan_1
    # Shorthand:
    - fan.turn_on: fan_1

Configuration options:

  • id (Required, ID): The ID of the fan.

  • oscillating (Optional, boolean, templatable): Set the oscillation state of the fan. Defaults to not affecting oscillation.

  • speed (Optional, int, templatable): Set the speed level of the fan. Can be a number between 1 and the maximum speed level of the fan.

fan.on_turn_on / fan.on_turn_off Trigger

This trigger is activated each time the fan is turned on or off. It does not fire if a command to turn the fan on or off already matches the current state.

fan:
  - platform: speed # or any other platform
    # ...
    on_turn_on:
    - logger.log: "Fan Turned On!"
    on_turn_off:
    - logger.log: "Fan Turned Off!"

Full Fan Index