Added 'availability_template' to all Template Lock platform (#10307)

* Added 'availability_template' to all Template Lock platform

* Fixed Syntax and default

* Removed optional parameter from example config

* Apply suggestions from code review

Co-Authored-By: Franck Nijhof <frenck@frenck.nl>
This commit is contained in:
Gil Peeters 2019-10-03 00:15:54 +10:00 committed by Franck Nijhof
parent cacd810353
commit 4688830ede

View File

@ -22,6 +22,7 @@ In optimistic mode, the lock will immediately change state after every command.
To enable Template Locks in your installation, add the following to your `configuration.yaml` file: To enable Template Locks in your installation, add the following to your `configuration.yaml` file:
{% raw %} {% raw %}
```yaml ```yaml
# Example configuration.yaml entry # Example configuration.yaml entry
lock: lock:
@ -37,6 +38,7 @@ lock:
data: data:
entity_id: switch.door entity_id: switch.door
``` ```
{% endraw %} {% endraw %}
{% configuration %} {% configuration %}
@ -49,6 +51,11 @@ lock:
description: Defines a template to set the state of the lock. description: Defines a template to set the state of the lock.
required: true required: true
type: template type: template
availability_template:
description: Defines a template to get the `available` state of the component. If the template returns `true`, the device is `available`. If the template returns any other value, the device will be `unavailable`. If `availability_template` is not configured, the component will always be `available`.
required: false
type: template
default: true
lock: lock:
description: Defines an action to run when the lock is locked. description: Defines an action to run when the lock is locked.
required: true required: true
@ -77,6 +84,7 @@ In this section, you find some real-life examples of how to use this lock.
This example shows a lock that copies data from a switch. This example shows a lock that copies data from a switch.
{% raw %} {% raw %}
```yaml ```yaml
lock: lock:
- platform: template - platform: template
@ -91,6 +99,7 @@ lock:
data: data:
entity_id: switch.source entity_id: switch.source
``` ```
{% endraw %} {% endraw %}
### Optimistic Mode ### Optimistic Mode
@ -98,6 +107,7 @@ lock:
This example shows a lock in optimistic mode. This lock will immediately change state after command and will not wait for state update from the sensor. This example shows a lock in optimistic mode. This lock will immediately change state after command and will not wait for state update from the sensor.
{% raw %} {% raw %}
```yaml ```yaml
lock: lock:
- platform: template - platform: template
@ -113,6 +123,7 @@ lock:
data: data:
entity_id: switch.source entity_id: switch.source
``` ```
{% endraw %} {% endraw %}
### Sensor and Two Switches ### Sensor and Two Switches
@ -120,6 +131,7 @@ lock:
This example shows a lock that takes its state from a sensor, and uses two momentary switches to control a device. This example shows a lock that takes its state from a sensor, and uses two momentary switches to control a device.
{% raw %} {% raw %}
```yaml ```yaml
lock: lock:
- platform: template - platform: template
@ -134,4 +146,5 @@ lock:
data: data:
entity_id: switch.skylight_close entity_id: switch.skylight_close
``` ```
{% endraw %} {% endraw %}