Skip to content

Commit cc56ae0

Browse files
authored
Update the MQTT fan documentation to represent the component implementation (home-assistant#1400)
1 parent 405e150 commit cc56ae0

File tree

1 file changed

+51
-17
lines changed

1 file changed

+51
-17
lines changed

source/_components/fan.mqtt.markdown

Lines changed: 51 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,43 +17,77 @@ The `mqtt` fan platform let you control your MQTT enabled fans.
1717

1818
In an ideal scenario, the MQTT device will have a `state_topic` to publish state changes. If these messages are published with `RETAIN` flag, the MQTT fan will receive an instant state update after subscription and will start with correct state. Otherwise, the initial state of the fan will be `false`.
1919

20-
When a `state_topic` is not available, the fan will work in optimistic mode. In this mode, the fan will immediately change state after every command. Otherwise, the fan will wait for state confirmation from device (message from `state_topic`).
20+
When a `state_topic` is not available, the fan will work in optimistic mode. In this mode, the fan will immediately change state after every command. Otherwise, the fan will wait for state confirmation from the device (message from `state_topic`).
2121

22-
Optimistic mode can be forced, even if state topic is available. Try to enable it, if experiencing incorrect fan operation.
22+
Optimistic mode can be forced even if a `state_topic` is available. Try to enable it if you are experiencing incorrect fan operation.
2323

2424
To enable MQTT fans in your installation, add the following to your `configuration.yaml` file:
2525

2626
```yaml
2727
# Example configuration.yml entry
2828
fan:
29-
platform: mqtt
30-
command_topic: "home/living-room/fan/set"
29+
- platform: mqtt
30+
command_topic: "bedroom_fan/on/set"
3131
```
3232
3333
Configuration variables:
3434
3535
- **command_topic** (*Required*): The MQTT topic to publish commands to change the fan state.
3636
- **state_topic** (*Optional*): The MQTT topic subscribed to receive state updates.
3737
- **name** (*Optional*): The name of the fan. Default is 'MQTT Fan'.
38+
- **state_topic** (*Optional*): The MQTT topic subscribed to receive state updates.
3839
- **payload_on** (*Optional*): The payload that represents the running state. Default is "ON".
3940
- **payload_off** (*Optional*): The payload that represents the stop state. Default is "OFF".
40-
- **optimistic** (*Optional*): Flag that defines if lock works in optimistic mode. Default is `true` if no state topic defined, else `false`.
41+
- **state_value_template** (*Optional*): Defines a [template](/topics/templating/) to extract a value from the state.
4142
- **qos** (*Optional*): The maximum QoS level of the state topic. Default is 0 and will also be used to publishing messages.
43+
- **optimistic** (*Optional*): Flag that defines if lock works in optimistic mode. Default is `true` if no state topic defined, else `false`.
4244
- **retain** (*Optional*): If the published message should have the retain flag on or not.
43-
- **state_value_template** (*Optional*): Defines a [template](/topics/templating/) to extract a value from the state.
44-
- **speed_state_topic** (*Optional*): The MQTT topic subscribed to receive speed updates.
45-
- **speed_command_topic** (*Optional*): The MQTT topic to publish commands to change the fan speed.
46-
- **speed_value_template** (*Optional*): Defines a [template](/topics/templating/) to extract a value from the speed.
47-
- **oscillation_state_topic** (*Optional*): The MQTT topic subscribed to receive oscillation updates.
48-
- **oscillation_command_topic** (*Optional*): The MQTT topic to publish commands to change the fan oscillation.
45+
- **oscillation_state_topic** (*Optional*): The MQTT topic subscribed to receive oscillation state updates.
46+
- **oscillation_command_topic** (*Optional*): The MQTT topic to publish commands to change the oscillation state.
47+
- **payload_oscillation_on** (*Optional*): The payload that represents the oscillation on state. Default is "oscillate_on".
48+
- **payload_oscillation_off** (*Optional*): The payload that presents the oscillation off state. Default is "oscillate_off".
4949
- **oscillation_value_template** (*Optional*): Defines a [template](/topics/templating/) to extract a value from the oscillation.
50-
- **payload_oscillation_on** (*Optional*): The payload that represents the oscillation state. Default is "ON".
51-
- **payload_oscillation_off** (*Optional*): The payload that represents the oscillation state. Default is "OFF".
52-
- **payload_low_speed** (*Optional*): The payload that represents the low speed state. Default is "low".
53-
- **payload_medium_speed** (*Optional*): The payload that represents the low speed state. Default is "med".
54-
- **payload_high_speed** (*Optional*): The payload that represents the low speed state. Default is "high".
50+
- **speed_state_topic** (*Optional*): The MQTT topic subscribed to receive speed state updates.
51+
- **speed_command_topic** (*Optional*): The MQTT topic to publish commands to change speed state.
52+
- **payload_low_speed** (*Optional*): The payload that represents the fan's low speed.
53+
- **payload_medium_speed** (*Optional*): The payload that represents the fan's medium speed.
54+
- **payload_high_speed** (*Optional*): The payload that represents the fan's high speed.
55+
- **speed_value_template** (*Optional*): Defines a [template](/topics/templating/) to extract a value from the speed payload.
5556
- **speeds** array (*Optional*): Valid entries for the list are `off`, `low`, `med`, and `high`.
5657

5758
<p class='note warning'>
58-
Make sure that your topic match exact. `some-topic/` and `some-topic` are different topics.
59+
Make sure that your topic is an exact match. `some-topic/` and `some-topic` are different topics.
5960
</p>
61+
62+
## {% linkable_title Examples %}
63+
64+
In this section you find some real life examples of how to use this fan.
65+
66+
### {% linkable_title Full configuration %}
67+
68+
The example below shows a full configuration for a MQTT fan.
69+
70+
```yaml
71+
# Example configuration.yml entry
72+
fan:
73+
- platform: mqtt
74+
name: "Bedroom Fan"
75+
state_topic: "bedroom_fan/on/state"
76+
command_topic: "bedroom_fan/on/set"
77+
oscillation_state_topic: "bedroom_fan/oscillation/state"
78+
oscillation_command_topic: "bedroom_fan/oscillation/set"
79+
speed_state_topic: "bedroom_fan/speed/state"
80+
speed_command_topic: "bedroom_fan/speed/set"
81+
qos: 0
82+
payload_on: "true"
83+
payload_off: "false"
84+
payload_oscillation_on: "true"
85+
payload_oscillation_off: "false"
86+
payload_low_speed: "low"
87+
payload_medium_speed: "medium"
88+
payload_high_speed: "high"
89+
speeds:
90+
- low
91+
- medium
92+
- high
93+
```

0 commit comments

Comments
 (0)