Added 'availability_template' to all Template Light platform (#10311)

* Added 'availability_template' to all Template Light platform

* Fixed Syntax and default

* Removed optional parameter from example config

* Update source/_components/light.template.markdown

Co-Authored-By: Franck Nijhof <frenck@frenck.nl>
This commit is contained in:
Gil Peeters 2019-09-28 22:00:57 +10:00 committed by Charles Garwood
parent acb0557228
commit 90d24a1a1e

View File

@ -17,6 +17,7 @@ To enable Template Lights in your installation, add the following to your
`configuration.yaml` file: `configuration.yaml` file:
{% raw %} {% raw %}
```yaml ```yaml
# Example configuration.yaml entry # Example configuration.yaml entry
light: light:
@ -35,6 +36,7 @@ light:
data_template: data_template:
brightness: "{{ brightness }}" brightness: "{{ brightness }}"
``` ```
{% endraw %} {% endraw %}
{% configuration %} {% configuration %}
@ -64,7 +66,12 @@ light:
icon_template: icon_template:
description: Defines a template for an icon or picture, e.g. showing a different icon for different states. description: Defines a template for an icon or picture, e.g. showing a different icon for different states.
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
turn_on: turn_on:
description: Defines an action to run when the light is turned on. description: Defines an action to run when the light is turned on.
required: true required: true
@ -104,6 +111,7 @@ make; the [Media Player component](/components/media_player/) needs a floating
point percentage value from `0.0` to `1.0`. point percentage value from `0.0` to `1.0`.
{% raw %} {% raw %}
```yaml ```yaml
light: light:
- platform: template - platform: template
@ -142,6 +150,7 @@ light:
0 0
{% endif %} {% endif %}
``` ```
{% endraw %} {% endraw %}
### Change The Icon ### Change The Icon
@ -149,6 +158,7 @@ light:
This example shows how to change the icon based on the light state. This example shows how to change the icon based on the light state.
{% raw %} {% raw %}
```yaml ```yaml
light: light:
- platform: template - platform: template
@ -186,6 +196,7 @@ light:
entity_id: media_player.receiver entity_id: media_player.receiver
is_volume_muted: true is_volume_muted: true
``` ```
{% endraw %} {% endraw %}
### Change The Entity Picture ### Change The Entity Picture
@ -193,6 +204,7 @@ light:
This example shows how to change the entity picture based on the light state. This example shows how to change the entity picture based on the light state.
{% raw %} {% raw %}
```yaml ```yaml
light: light:
- platform: template - platform: template
@ -230,4 +242,5 @@ light:
entity_id: media_player.receiver entity_id: media_player.receiver
is_volume_muted: true is_volume_muted: true
``` ```
{% endraw %} {% endraw %}