Update MQTT platforms that now support availablity (#4293)

To accompany changes from:
https://github.com/home-assistant/home-assistant/pull/11336

Updated platforms:
- Switch (previously supported)
- Binary sensor (previously supported)
- Cover (previously supported)
- Light
- JSON light
- Template light
- Sensor
- Alarm control panel
- Lock
- HVAC
- Fan
- Vacuum
This commit is contained in:
Dan Nixon 2018-01-02 02:33:19 +00:00 committed by Paulus Schoutsen
parent 943b2e3119
commit 5d321e66f7
12 changed files with 1024 additions and 229 deletions

View file

@ -30,20 +30,64 @@ switch:
command_topic: "home/bedroom/switch1/set"
```
Configuration variables:
- **name** (*Optional*): The name of the switch. Default is 'MQTT Switch'.
- **state_topic** (*Optional*): The MQTT topic subscribed to receive state updates.
- **command_topic** (*Required*): The MQTT topic to publish commands to change the switch state.
- **availability_topic** (*Optional*): The MQTT topic subscribed to receive availability (online/offline) updates.
- **payload_on** (*Optional*): The payload that represents enabled state. Default is "ON".
- **payload_off** (*Optional*): The payload that represents disabled state. Default is "OFF".
- **payload_available** (*Optional*): The payload that represents the available state, e.g. 'online'. Default is "ON".
- **payload_not_available** (*Optional*): The payload that represents the unavailable state, e.g. 'offline'. Default is "OFF".
- **optimistic** (*Optional*): Flag that defines if switch works in optimistic mode. Default is `true` if no `state_topic` defined, else `false`.
- **qos** (*Optional*): The maximum QoS level of the state topic. Default is 0 and will also be used to publishing messages.
- **retain** (*Optional*): If the published message should have the retain flag on or not.
- **value_template** (*Optional*): Defines a [template](/docs/configuration/templating/#processing-incoming-data) to extract a value from the payload.
{% configuration %}
name:
description: The name to use when displaying this switch.
required: false
type: string
default: MQTT Switch
state_topic:
description: The MQTT topic subscribed to receive state updates.
required: false
type: string
command_topic:
description: The MQTT topic to publish commands to change the switch state.
required: false
type: string
availability_topic:
description: The MQTT topic subscribed to receive availability (online/offline) updates.
required: false
type: string
payload_on:
description: The payload that represents enabled state.
required: false
type: string
default: ON
payload_off:
description: The payload that represents disabled state.
required: false
type: string
default: OFF
payload_available:
description: The payload that represents the available state.
required: false
type: string
default: online
payload_not_available:
description: The payload that represents the unavailable state.
required: false
type: string
default: offline
optimistic:
description: Flag that defines if switch works in optimistic mode.
required: false
type: boolean
default: "`true` if no `state_topic` defined, else `false`."
qos:
description: The maximum QoS level of the state topic. Default is 0 and will also be used to publishing messages.
required: false
type: integer
default: 0
retain:
description: If the published message should have the retain flag on or not.
required: false
type: boolean
default: false
value_template:
description: "Defines a [template](/docs/configuration/templating/#processing-incoming-data) to extract a value from the payload."
required: false
type: string
{% endconfiguration %}
<p class='note warning'>
Make sure that your topic matches exactly. `some-topic/` and `some-topic` are different topics.