Added 'availability_template' to Template Vacuum platform (#10309)

* Added 'availability_template' to Template Vacuum 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-09-28 22:02:37 +10:00 committed by Charles Garwood
parent 90d24a1a1e
commit 75505dbfb8

View File

@ -15,6 +15,8 @@ return_to_base, clean_spot, locate and set_fan_speed commands of a vacuum.
To enable Template Vacuums in your installation, add the following to your To enable Template Vacuums in your installation, add the following to your
`configuration.yaml` file: `configuration.yaml` file:
{% raw %}
```yaml ```yaml
# Example configuration.yaml entry # Example configuration.yaml entry
vacuum: vacuum:
@ -25,6 +27,8 @@ vacuum:
service: script.vacuum_start service: script.vacuum_start
``` ```
{% endraw %}
{% configuration %} {% configuration %}
vacuums: vacuums:
description: List of your vacuums. description: List of your vacuums.
@ -47,6 +51,11 @@ vacuum:
description: Defines a template to get the fan speed of the vacuum. description: Defines a template to get the fan speed of the vacuum.
required: false required: false
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
start: start:
description: Defines an action to run when the vacuum is started. description: Defines an action to run when the vacuum is started.
required: true required: true
@ -117,6 +126,7 @@ vacuum:
This example shows how to use templates to specify the state of the vacuum. This example shows how to use templates to specify the state of the vacuum.
{% raw %} {% raw %}
```yaml ```yaml
vacuum: vacuum:
- platform: template - platform: template
@ -144,4 +154,5 @@ vacuum:
- Medium - Medium
- High - High
``` ```
{% endraw %} {% endraw %}