You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/_components/switch.template.markdown
+7-19Lines changed: 7 additions & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -15,16 +15,13 @@ logo: home-assistant.png
15
15
16
16
The `template` platform creates switches that combines components.
17
17
18
-
For example, if you have a garage door with a toggle switch that operates the
19
-
motor and a sensor that allows you know whether the door is open or closed,
20
-
you can combine these into a switch that knows whether the garage door is open
21
-
or closed.
18
+
For example, if you have a garage door with a toggle switch that operates the motor and a sensor that allows you know whether the door is open or closed, you can combine these into a switch that knows whether the garage door is open or closed.
22
19
23
-
This can simplify the GUI and make it easier to write automations. You can mark
24
-
the components you have combined as `hidden` so they don't appear themselves.
20
+
This can simplify the GUI and make it easier to write automations. You can mark the components you have combined as `hidden` so they don't appear themselves.
25
21
26
-
To enable Template Switches in your installation, add the following to your
27
-
`configuration.yaml` file:
22
+
## {% linkable_title Configuration %}
23
+
24
+
To enable Template Switches in your installation, add the following to your `configuration.yaml` file:
28
25
29
26
{% raw %}
30
27
```yaml
@@ -83,15 +80,7 @@ switch:
83
80
84
81
## {% linkable_title Considerations %}
85
82
86
-
If you are using the state of a platform that takes extra time to load, the
87
-
Template Switch may get an `unknown` state during startup. This results
88
-
in error messages in your log file until that platform has completed loading.
89
-
If you use `is_state()` function in your template, you can avoid this situation.
90
-
For example, you would replace
91
-
{% raw %}`{{ states.switch.source.state == 'on' }}`{% endraw %}
92
-
with this equivalent that returns `true`/`false` and never gives an unknown
93
-
result:
94
-
{% raw %}`{{ is_state('switch.source', 'on') }}`{% endraw %}
83
+
If you are using the state of a platform that takes extra time to load, the Template Switch may get an `unknown` state during startup. This results in error messages in your log file until that platform has completed loading. If you use `is_state()` function in your template, you can avoid this situation. For example, you would replace {% raw %}`{{ states.switch.source.state == 'on' }}`{% endraw %} with this equivalent that returns `true`/`false` and never gives an unknown result: {% raw %}`{{ is_state('switch.source', 'on') }}`{% endraw %}
95
84
96
85
## {% linkable_title Examples %}
97
86
@@ -121,8 +110,7 @@ switch:
121
110
122
111
### {% linkable_title Toggle Switch %}
123
112
124
-
This example shows a switch that takes its state from a sensor, and toggles
125
-
a switch.
113
+
This example shows a switch that takes its state from a sensor and toggles a switch.
0 commit comments