Fan Entity
A fan entity is a device that controls the different vectors of your fan such as speed, direction and oscillation. Derive entity platforms from 'homeassistant.components.fan.FanDevice'.
#
Propertiestip
Properties should always only return information from memory and not do I/O (like network requests). Implement update()
or async_update()
to fetch data.
Name | Type | Default | Description |
---|---|---|---|
current_direction | str | None | Return the current direction of the fan |
is_on | boolean | None | Return true if the entity is on |
oscillating | boolean | None | Return true if the fan is oscillating |
percentage | int | None | Return the current speed percentage. Must be a value between 0 (off) and 100 |
speed_count | int | 100 | The number of speeds the fan supports |
supported_features | int | 0 | Flag supported features |
preset_mode | str | None | Return the current preset_mode. One of the values in preset_modes. |
preset_modes | list | None | Get the list of available preset_modes. This is an arbitrary list of str and should not contain any speeds. |
#
Preset ModesA fan may have preset modes that automatically control the percentage speed or other functionality. Common examples include auto
, smart
, whoosh
, eco
, and breeze
.
Manually setting a speed must disable a preset mode. If it is possible to set a percentage speed manually without disabling the preset mode, create a switch or service to represent the mode.
#
Deprecated PropertiesThe fan entity model has changed to use percentages in the range from 0 (off) to 100 instead
of the named speeds. The new model replaces speed
and speed_list
with percentage
, preset_mode
, and preset_modes
. This change allowed us to expand the number of supported speeds to accommodate additional fan models in Home Assistant.
To maintain backwards compatibility with integations that have not updated to the new model, the deprecated properties will remain until at least the end of 2021. Integrations must update their Turn on function to consume percentage
or preset_mode
instead of speed
.
Name | Type | Default | Description |
---|---|---|---|
speed | str | None | Return the current speed. One of the values in speed_list. |
speed_list | list | None | Get the list of available speeds. The allowed values are "off", "low", "medium" and "high". Use the corresponding constants SPEED_OFF, SPEED_LOW, SPEED_MEDIUM, SPEED_HIGH. |
#
Supported FeaturesConstant | Description |
---|---|
'SUPPORT_DIRECTION' | The fan supports changing the direction. |
'SUPPORT_SET_SPEED' | The fan supports setting the speed percentage and optional preset modes. |
'SUPPORT_OSCILLATE' | The fan supports oscillation. |
'SUPPORT_PRESET_MODE' | The fan supports preset modes. |
#
Methods#
Set directionOnly implement this method if the flag SUPPORT_DIRECTION
is set.
#
Set preset modeOnly implement this method if the flag SUPPORT_PRESET_MODE
is set.
#
Set speed percentageOnly implement this method if the flag SUPPORT_SET_SPEED
is set.
Converting speeds
Home Assistant includes a utility to convert speeds.
If the device has a list of named speeds:
If the device has a numeric range of speeds:
#
Turn onspeed
is deprecated.
For new intergrations, speed
should not be implemented and only percentage
and preset_mode
should be used.
#
Turn off#
ToggleOptional. If not implemented will default to checking what method to call using the is_on property.
#
OscillateOnly implement this method if the flag SUPPORT_OSCILLATE
is set.