Creates a new fan instance
Configuration settings for the fan
Array of state topic names to expose
Callback function to handle state changes
Array of command topic names to subscribe to
Callback function to handle command messages
ProtectedattributesMQTT topic for entity attributes
ProtectedavailabilityMQTT topic for entity availability status
ProtectedbaseBase MQTT topic name for this entity
ProtectedcommandList of MQTT topics for entity commands.
ProtectedcomponentThe component configuration containing entity-specific settings
ProtectedconfigMQTT topic for entity configuration
ProtectedidentifierUnique identifier for this entity
ProtectedloggerLogger instance for debugging and error reporting
ProtectedmqttThe MQTT client instance used for communication
ProtectedsettingsThe component settings including MQTT configuration
ProtectedstateCallback function to handle state changes
ProtectedstateList of MQTT topics for entity state
ProtectedwroteFlag indicating whether configuration has been written to MQTT
The rotation direction. Setting a defined value publishes it on the direction_state_topic.
Whether the fan is on. Setting a value publishes the configured on/off payload on the state_topic.
Whether the fan is oscillating. Setting a defined value publishes the configured oscillation on/off
payload on the oscillation_state_topic.
The fan speed as a percentage (0-100). Setting a defined value publishes it on the
percentage_state_topic; setting undefined publishes the configured payload_reset_percentage.
The active preset mode. Setting it publishes the value on the preset_mode_state_topic; setting
undefined publishes the configured payload_reset_preset_mode.
ProtectedgetGets the complete configuration for this entity including command topic
The resolved component configuration with all required MQTT topics
Clears the entity's retained discovery configuration, causing Home Assistant to remove the entity.
Use this when an entity that may have been published by a previous run should no longer exist. Because writeConfig retains its payload, simply not calling it leaves the entity in place indefinitely.
Sets additional attributes for the entity
Key-value pairs of attributes to set
Sets the availability state of the entity
True if the entity is available, false otherwise
Writes the entity's configuration to MQTT for Home Assistant discovery Also sets the entity's initial availability state if not manually managed
Represents a fan in Home Assistant.