Skip to content

Commit 90d24a1

Browse files
grillpfrenck
authored andcommitted
Added 'availability_template' to all Template Light platform (home-assistant#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>
1 parent acb0557 commit 90d24a1

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

source/_components/light.template.markdown

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ To enable Template Lights in your installation, add the following to your
1717
`configuration.yaml` file:
1818

1919
{% raw %}
20+
2021
```yaml
2122
# Example configuration.yaml entry
2223
light:
@@ -35,6 +36,7 @@ light:
3536
data_template:
3637
brightness: "{{ brightness }}"
3738
```
39+
3840
{% endraw %}
3941
4042
{% configuration %}
@@ -64,7 +66,12 @@ light:
6466
icon_template:
6567
description: Defines a template for an icon or picture, e.g. showing a different icon for different states.
6668
required: false
67-
type: template
69+
type: template
70+
availability_template:
71+
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`.
72+
required: false
73+
type: template
74+
default: true
6875
turn_on:
6976
description: Defines an action to run when the light is turned on.
7077
required: true
@@ -104,6 +111,7 @@ make; the [Media Player component](/components/media_player/) needs a floating
104111
point percentage value from `0.0` to `1.0`.
105112

106113
{% raw %}
114+
107115
```yaml
108116
light:
109117
- platform: template
@@ -142,13 +150,15 @@ light:
142150
0
143151
{% endif %}
144152
```
153+
145154
{% endraw %}
146155

147156
### Change The Icon
148157

149158
This example shows how to change the icon based on the light state.
150159

151160
{% raw %}
161+
152162
```yaml
153163
light:
154164
- platform: template
@@ -186,13 +196,15 @@ light:
186196
entity_id: media_player.receiver
187197
is_volume_muted: true
188198
```
199+
189200
{% endraw %}
190201

191202
### Change The Entity Picture
192203

193204
This example shows how to change the entity picture based on the light state.
194205

195206
{% raw %}
207+
196208
```yaml
197209
light:
198210
- platform: template
@@ -230,4 +242,5 @@ light:
230242
entity_id: media_player.receiver
231243
is_volume_muted: true
232244
```
245+
233246
{% endraw %}

0 commit comments

Comments
 (0)