From 822a45b6d4fed01fec99dfe1ff72050ed191d354 Mon Sep 17 00:00:00 2001 From: Gil Peeters Date: Sat, 28 Sep 2019 21:53:01 +1000 Subject: [PATCH] Added 'availability_template' to Template Cover platform (#10314) * Added 'availability_template' to all Template Cover platform * Fixed Syntax and default * Apply suggestions from code review Co-Authored-By: Franck Nijhof * Removed optional values from example configuration --- source/_components/cover.template.markdown | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/source/_components/cover.template.markdown b/source/_components/cover.template.markdown index 6d130751268..cf5e96224c2 100644 --- a/source/_components/cover.template.markdown +++ b/source/_components/cover.template.markdown @@ -19,6 +19,7 @@ To enable Template Covers in your installation, add the following to your `configuration.yaml` file: {% raw %} + ```yaml # Example configuration.yaml entry cover: @@ -34,6 +35,7 @@ cover: stop_cover: service: script.stop_garage_door ``` + {% endraw %} {% configuration %} @@ -62,6 +64,11 @@ cover: description: Defines a template to specify which icon to use. required: false 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 device_class: description: Sets the [class of the device](/components/cover/), changing the device state and icon that is displayed on the frontend. required: false @@ -136,6 +143,7 @@ This example converts a garage door with a controllable switch and position sensor into a cover. {% raw %} + ```yaml cover: - platform: template @@ -162,6 +170,7 @@ cover: mdi:garage {% endif %} ``` + {% endraw %} ### Multiple Covers @@ -169,6 +178,7 @@ cover: This example allows you to control two or more covers at once. {% raw %} + ```yaml homeassistant: customize: @@ -249,6 +259,7 @@ automation: entity_id: cover.cover_group position: 25 ``` + {% endraw %} ### Change The Icon @@ -256,6 +267,7 @@ automation: This example shows how to change the icon based on the cover state. {% raw %} + ```yaml cover: - platform: template @@ -282,6 +294,7 @@ cover: mdi:window-closed {% endif %} ``` + {% endraw %} ### Change The Entity Picture @@ -289,6 +302,7 @@ cover: This example shows how to change the entity picture based on the cover state. {% raw %} + ```yaml cover: - platform: template @@ -315,4 +329,5 @@ cover: /local/cover-closed.png {% endif %} ``` + {% endraw %}