mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-19 15:26:59 +00:00
Cover get position topic (#7279)
* Support for position_topic. * titles fixed * added Configuration description. * set_position_topic description updated.
This commit is contained in:
parent
610fbe4050
commit
e423ac382c
@ -18,12 +18,17 @@ The `mqtt` cover platform allows you to control an MQTT cover (such as blinds, a
|
||||
## {% linkable_title Configuration %}
|
||||
|
||||
The device state (`open` or `closed`) will be updated only after a new message is published on `state_topic` matching `state_open` or `state_closed`. If these messages are published with the `retain` flag set, the cover will receive an instant state update after subscription and Home Assistant will display the correct state on startup. Otherwise, the initial state displayed in Home Assistant will be `unknown`.
|
||||
`state_topic` can only manage `state_open` and `state_closed`. No percentage positons etc.
|
||||
|
||||
There is an attribute that stores the relative position of the device, where 0 means the device is `closed` and all other intermediate positions means the device is `open`.
|
||||
For this purpose is `position_topic` which can set state of the cover and positon.
|
||||
Default setting are 0 means the device is `closed` and all other intermediate positions means the device is `open`.
|
||||
`position_topic` is managed by `position_open` and `position_closed`
|
||||
You can set it up in opossite way as well.
|
||||
If position topic is defined than state topic is ignored.
|
||||
|
||||
If a state topic is not defined, the cover will work in optimistic mode. In this mode, the cover will immediately change state (`open` or `closed`) after every command sent by Home Assistant. If a state topic is defined, the cover will wait for a message on `state_topic` matching `state_open` or `state_closed` before changing state in Home Assistant.
|
||||
If a state topic and position topic are not defined, the cover will work in optimistic mode. In this mode, the cover will immediately change state (`open` or `closed`) after every command sent by Home Assistant. If a state topic/position topic is defined, the cover will wait for a message on `state_topic` or `position_topic`.
|
||||
|
||||
Optimistic mode can be forced, even if a `state_topic` is defined. Try to enable it if experiencing incorrect cover operation.
|
||||
Optimistic mode can be forced, even if a `state_topic` / `position_topic` is defined. Try to enable it if experiencing incorrect cover operation (Google Assistant gauge may need optimistic mode as it often send request to your Home Assistant immediately after send set_cover_position in which case MQTT could be too slow).
|
||||
|
||||
The `mqtt` cover platform optionally supports an `availability_topic` to receive online and offline messages (birth and LWT messages) from the MQTT cover device. During normal operation, if the MQTT cover device goes offline (i.e. publishes `payload_not_available` to `availability_topic`), Home Assistant will display the cover as "unavailable". If these messages are published with the `retain` flag set, the cover will receive an instant update after subscription and Home Assistant will display correct availability state of the cover when Home Assistant starts up. If the `retain` flag is not set, Home Assistant will display the cover as "unavailable" when Home Assistant starts up.
|
||||
|
||||
@ -63,7 +68,7 @@ payload_stop:
|
||||
type: string
|
||||
default: STOP
|
||||
state_topic:
|
||||
description: The MQTT topic subscribed to receive cover state messages.
|
||||
description: The MQTT topic subscribed to receive cover state messages. Use only if not using get_position_topic. State topic can only read open/close state. Cannot read position state.
|
||||
required: false
|
||||
type: string
|
||||
state_open:
|
||||
@ -76,6 +81,20 @@ state_closed:
|
||||
required: false
|
||||
type: string
|
||||
default: closed
|
||||
position_topic:
|
||||
description: The MQTT topic subscribed to receive cover position messages. Always in favor if used together with state_topic.
|
||||
required: false
|
||||
type: integer
|
||||
position_open:
|
||||
description: Number which represents open position.
|
||||
required: false
|
||||
type: integer
|
||||
default: 100
|
||||
position_closed:
|
||||
description: Number which represents closed position.
|
||||
required: false
|
||||
type: integer
|
||||
default: 0
|
||||
availability_topic:
|
||||
description: "The MQTT topic subscribed to to receive birth and LWT messages from the MQTT cover device. If `availability_topic` is not defined, the cover availability state will always be `available`. If `availability_topic` is defined, the cover availability state will be `unavailable` by default."
|
||||
required: false
|
||||
@ -110,11 +129,11 @@ value_template:
|
||||
required: false
|
||||
type: string
|
||||
set_position_topic:
|
||||
description: The MQTT topic to publish position commands to.
|
||||
description: The MQTT topic to publish position commands to. You need to set position_topic as well if you want to use position topic. Use template if position topic wants different values than within range `position_closed` - `position_open`. If template is not defined and `position_closed != 100` and `position_open != 0` then proper position value is calculated from percentage position.
|
||||
required: false
|
||||
type: string
|
||||
set_position_template:
|
||||
description: " Defines a [template](/topics/templating/) to define the position to be sent to the `set_position_topic` topic. Incoming position value is available for use in the template `{{position}}`. If no template is defined, the numeric position (0-100) will be written directly to the topic."
|
||||
description: " Defines a [template](/topics/templating/) to define the position to be sent to the `set_position_topic` topic. Incoming position value is available for use in the template `{{position}}`. If no template is defined, the position (0-100) will be calculated according to `position_open` and `position_closed` values."
|
||||
required: false
|
||||
type: string
|
||||
tilt_command_topic:
|
||||
@ -194,9 +213,9 @@ device:
|
||||
|
||||
In this section you will find some real-life examples of how to use this platform.
|
||||
|
||||
### {% linkable_title Full configuration without tilt %}
|
||||
### {% linkable_title Full configuration state topic without tilt %}
|
||||
|
||||
The example below shows a full configuration for a cover without tilt.
|
||||
The example below shows a full configuration for a cover without tilt with state topic only.
|
||||
|
||||
```yaml
|
||||
# Example configuration.yaml entry
|
||||
@ -219,6 +238,32 @@ cover:
|
||||
value_template: '{% raw %}{{ value.x }}{% endraw %}'
|
||||
```
|
||||
|
||||
### {% linkable_title Full configuration position topic without tilt %}
|
||||
|
||||
The example below shows a full configuration for a cover without tilt with position topic.
|
||||
|
||||
```yaml
|
||||
# Example configuration.yaml entry
|
||||
cover:
|
||||
- platform: mqtt
|
||||
name: "MQTT Cover"
|
||||
command_topic: "home-assistant/cover/set"
|
||||
position_topic: "home-assistant/cover/position"
|
||||
availability_topic: "home-assistant/cover/availability"
|
||||
set_position_topic: "home-assistant/cover/set_position"
|
||||
qos: 0
|
||||
retain: true
|
||||
payload_open: "OPEN"
|
||||
payload_close: "CLOSE"
|
||||
payload_stop: "STOP"
|
||||
position_open: 100
|
||||
position_closed: 0
|
||||
payload_available: "online"
|
||||
payload_not_available: "offline"
|
||||
optimistic: false
|
||||
value_template: '{% raw %}{{ value.x }}{% endraw %}'
|
||||
```
|
||||
|
||||
### {% linkable_title Full configuration %}
|
||||
|
||||
The example below shows a full configuration for a cover.
|
||||
|
Loading…
x
Reference in New Issue
Block a user