From 90d24a1a1e878ba1882af6e3b8d9672cbc1f5288 Mon Sep 17 00:00:00 2001 From: Gil Peeters Date: Sat, 28 Sep 2019 22:00:57 +1000 Subject: [PATCH] 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 --- source/_components/light.template.markdown | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/source/_components/light.template.markdown b/source/_components/light.template.markdown index f375aa0f1c9..7851264bf2a 100644 --- a/source/_components/light.template.markdown +++ b/source/_components/light.template.markdown @@ -17,6 +17,7 @@ To enable Template Lights in your installation, add the following to your `configuration.yaml` file: {% raw %} + ```yaml # Example configuration.yaml entry light: @@ -35,6 +36,7 @@ light: data_template: brightness: "{{ brightness }}" ``` + {% endraw %} {% configuration %} @@ -64,7 +66,12 @@ light: icon_template: description: Defines a template for an icon or picture, e.g. showing a different icon for different states. 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: description: Defines an action to run when the light is turned on. 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`. {% raw %} + ```yaml light: - platform: template @@ -142,6 +150,7 @@ light: 0 {% endif %} ``` + {% endraw %} ### Change The Icon @@ -149,6 +158,7 @@ light: This example shows how to change the icon based on the light state. {% raw %} + ```yaml light: - platform: template @@ -186,6 +196,7 @@ light: entity_id: media_player.receiver is_volume_muted: true ``` + {% endraw %} ### Change The Entity Picture @@ -193,6 +204,7 @@ light: This example shows how to change the entity picture based on the light state. {% raw %} + ```yaml light: - platform: template @@ -230,4 +242,5 @@ light: entity_id: media_player.receiver is_volume_muted: true ``` + {% endraw %}