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

@ -27,39 +27,153 @@ light:
command_topic: "office/rgb1/light/switch"
```
Configuration variables:
- **command_topic** (*Required*): The MQTT topic to publish commands to change the switch state.
- **brightness_command_topic** (*Optional*): The MQTT topic to publish commands to change the light's brightness.
- **brightness_scale** (*Optional*): Defines the maximum brightness value (i.e. 100%) of the MQTT device (defaults to 255).
- **brightness_state_topic** (*Optional*): The MQTT topic subscribed to receive brightness state updates.
- **brightness_value_template** (*Optional*): Defines a [template](/docs/configuration/templating/#processing-incoming-data) to extract the brightness value.
- **color_temp_command_topic** (*Optional*): The MQTT topic to publish commands to change the light's color temperature state. The color temperature command slider has a range of 157 to 500 mireds (micro reciprocal degrees).
- **color_temp_state_topic** (*Optional*): The MQTT topic subscribed to receive color temperature state updates.
- **color_temp_value_template** (*Optional*): Defines a [template](/topics/templating/) to extract the color temperature value.
- **effect_command_topic** (*Optional*): The MQTT topic to publish commands to change the light's effect state.
- **effect_state_topic** (*Optional*): The MQTT topic subscribed to receive effect state updates.
- **effect_value_template** (*Optional*): Defines a [template](/docs/configuration/templating/#processing-incoming-data) to extract the effect value.
- **effect_list** (*Optional*): The list of effects the light supports.
- **name** (*Optional*): The name of the switch. Default is 'MQTT Switch'.
- **on_command_type** (*Optional*): Defines when on the payload_on is sent. Using `last` (the default) will send any style (brightness, color, etc) topics first and then a `payload_on` to the `command_topic`. Using `first` will send the `payload_on` and then any style topics. Using `brightness` will only send brightness commands instead of the `payload_on` to turn the light on.
- **optimistic** (*Optional*): Flag that defines if switch works in optimistic mode. Default is true if no state topic defined, else false.
- **payload_off** (*Optional*): The payload that represents disabled state. Default is "OFF".
- **payload_on** (*Optional*): The payload that represents enabled state. Default is "ON".
- **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.
- **rgb_command_template** (*Optional*): Defines a [template](/docs/configuration/templating/#processing-incoming-data) to compose message which will be sent to `rgb_command_topic`. Available variables: `red`, `green` and `blue`.
- **rgb_command_topic** (*Optional*): The MQTT topic to publish commands to change the light's RGB state.
- **rgb_state_topic** (*Optional*): The MQTT topic subscribed to receive RGB state updates.
- **rgb_value_template** (*Optional*): Defines a [template](/docs/configuration/templating/#processing-incoming-data) to extract the RGB value.
- **state_topic** (*Optional*): The MQTT topic subscribed to receive state updates.
- **state_value_template** (*Optional*): Defines a [template](/docs/configuration/templating/#processing-incoming-data) to extract the state value. The template should match the payload "on" and "off" values, so if your light uses "power on" to turn on, your `state_value_template` string should return "power on" when the switch is on. For example if the message is just "on", your `state_value_template` should be `power {{ value }}`.
- **white_value_command_topic** (*Optional*): The MQTT topic to publish commands to change the light's white value.
- **white_value_state_topic** (*Optional*): The MQTT topic subscribed to receive white value updates.
- **white_value_value_template** (*Optional*): Defines a [template](/docs/configuration/templating/#processing-incoming-data) to extract the white value.
- **xy_command_topic** (*Optional*): The MQTT topic to publish commands to change the light's XY state.
- **xy_state_topic** (*Optional*): The MQTT topic subscribed to receive XY state updates.
- **xy_value_template** (*Optional*): Defines a [template](/docs/configuration/templating/#processing-incoming-data) to extract the XY value.
{% configuration %}
name:
description: The name of the light.
required: false
type: string
default: MQTT Light
command_topic:
description: The MQTT topic to publish commands to change the switch state.
required: true
type: string
brightness_command_topic:
description: The MQTT topic to publish commands to change the lights brightness.
required: false
type: string
brightness_scale:
description: "Defines the maximum brightness value (i.e. 100%) of the MQTT device."
required: false
type: integer
default: 255
brightness_state_topic:
description: The MQTT topic subscribed to receive brightness state updates.
required: false
type: string
brightness_value_template:
description: "Defines a [template](/docs/configuration/templating/#processing-incoming-data) to extract the brightness value."
required: false
type: string
color_temp_command_topic:
description: The MQTT topic to publish commands to change the lights color temperature state. The color temperature command slider has a range of 157 to 500 mireds (micro reciprocal degrees).
required: false
type: string
color_temp_state_topic:
description: The MQTT topic subscribed to receive color temperature state updates.
required: false
type: string
color_temp_value_template:
description: "Defines a [template](/topics/templating/) to extract the color temperature value."
required: false
type: string
effect_command_topic:
description: "The MQTT topic to publish commands to change the light's effect state."
required: false
type: string
effect_state_topic:
description: The MQTT topic subscribed to receive effect state updates.
required: false
type: string
effect_value_template:
description: "Defines a [template](/docs/configuration/templating/#processing-incoming-data) to extract the effect value."
required: false
type: string
effect_list:
description: The list of effects the light supports.
required: false
type: string list
on_command_type:
description: "Defines when on the payload_on is sent. Using `last` (the default) will send any style (brightness, color, etc) topics first and then a `payload_on` to the `command_topic`. Using `first` will send the `payload_on` and then any style topics. Using `brightness` will only send brightness commands instead of the `payload_on` to turn the light on."
required: false
type: string
optimistic:
description: Flag that defines if switch works in optimistic mode.
required: false
type: boolean
default: "`true` if no state topic defined, else `false`."
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
qos:
description: The maximum QoS level of the state topic.
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
rgb_command_template:
description: "Defines a [template](/docs/configuration/templating/#processing-incoming-data) to compose message which will be sent to `rgb_command_topic`. Available variables: `red`, `green` and `blue`."
required: false
type: string
rgb_command_topic:
description: "The MQTT topic to publish commands to change the light's RGB state."
required: false
type: string
rgb_state_topic:
description: The MQTT topic subscribed to receive RGB state updates.
required: false
type: string
rgb_value_template:
description: "Defines a [template](/docs/configuration/templating/#processing-incoming-data) to extract the RGB value."
required: false
type: string
state_topic:
description: The MQTT topic subscribed to receive state updates.
required: false
type: string
state_value_template:
description: "Defines a [template](/docs/configuration/templating/#processing-incoming-data) to extract the state value. The template should match the payload `on` and `off` values, so if your light uses `power on` to turn on, your `state_value_template` string should return `power on` when the switch is on. For example if the message is just `on`, your `state_value_template` should be `power {{ value }}`."
required: false
type: string
white_value_command_topic:
description: "The MQTT topic to publish commands to change the light's white value."
required: false
type: string
white_value_state_topic:
description: The MQTT topic subscribed to receive white value updates.
required: false
type: string
white_value_value_template:
description: "Defines a [template](/docs/configuration/templating/#processing-incoming-data) to extract the white value."
required: false
type: string
xy_command_topic:
description: "The MQTT topic to publish commands to change the light's XY state."
required: false
type: string
xy_state_topic:
description: The MQTT topic subscribed to receive XY state updates.
required: false
type: string
xy_value_template:
description: "Defines a [template](/docs/configuration/templating/#processing-incoming-data) to extract the XY value."
required: false
type: string
availability_topic:
description: The MQTT topic subscribed to receive availability (online/offline) updates.
required: false
type: string
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
{% endconfiguration %}
<p class='note warning'>
Make sure that your topics match exactly. `some-topic/` and `some-topic` are different topics.