Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added 'availability_template' to all Template Lock platform #10307

Merged
merged 4 commits into from Oct 2, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 14 additions & 1 deletion source/_integrations/lock.template.markdown
Expand Up @@ -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:

{% raw %}

```yaml
# Example configuration.yaml entry
lock:
Expand All @@ -37,6 +38,7 @@ lock:
data:
entity_id: switch.door
```

{% endraw %}

{% configuration %}
Expand All @@ -49,7 +51,12 @@ lock:
description: Defines a template to set the state of the lock.
required: true
type: template
lock:
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:
description: Defines an action to run when the lock is locked.
required: true
type: action
Expand Down Expand Up @@ -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.

{% raw %}

```yaml
lock:
- platform: template
Expand All @@ -91,13 +99,15 @@ lock:
data:
entity_id: switch.source
```

{% endraw %}

### Optimistic Mode

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 %}

```yaml
lock:
- platform: template
Expand All @@ -113,13 +123,15 @@ lock:
data:
entity_id: switch.source
```

{% endraw %}

### Sensor and Two Switches

This example shows a lock that takes its state from a sensor, and uses two momentary switches to control a device.

{% raw %}

```yaml
lock:
- platform: template
Expand All @@ -134,4 +146,5 @@ lock:
data:
entity_id: switch.skylight_close
```

{% endraw %}