mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-16 13:56:53 +00:00
Remove line breaks
This commit is contained in:
parent
9c2f51659f
commit
0a23a4b77c
@ -15,16 +15,13 @@ logo: home-assistant.png
|
|||||||
|
|
||||||
The `template` platform creates switches that combines components.
|
The `template` platform creates switches that combines components.
|
||||||
|
|
||||||
For example, if you have a garage door with a toggle switch that operates the
|
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.
|
||||||
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.
|
|
||||||
|
|
||||||
This can simplify the GUI and make it easier to write automations. You can mark
|
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.
|
||||||
the components you have combined as `hidden` so they don't appear themselves.
|
|
||||||
|
|
||||||
To enable Template Switches in your installation, add the following to your
|
## {% linkable_title Configuration %}
|
||||||
`configuration.yaml` file:
|
|
||||||
|
To enable Template Switches in your installation, add the following to your `configuration.yaml` file:
|
||||||
|
|
||||||
{% raw %}
|
{% raw %}
|
||||||
```yaml
|
```yaml
|
||||||
@ -83,15 +80,7 @@ switch:
|
|||||||
|
|
||||||
## {% linkable_title Considerations %}
|
## {% linkable_title Considerations %}
|
||||||
|
|
||||||
If you are using the state of a platform that takes extra time to load, the
|
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 %}
|
||||||
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 %}
|
|
||||||
|
|
||||||
## {% linkable_title Examples %}
|
## {% linkable_title Examples %}
|
||||||
|
|
||||||
@ -121,8 +110,7 @@ switch:
|
|||||||
|
|
||||||
### {% linkable_title Toggle Switch %}
|
### {% linkable_title Toggle Switch %}
|
||||||
|
|
||||||
This example shows a switch that takes its state from a sensor, and toggles
|
This example shows a switch that takes its state from a sensor and toggles a switch.
|
||||||
a switch.
|
|
||||||
|
|
||||||
{% raw %}
|
{% raw %}
|
||||||
```yaml
|
```yaml
|
||||||
|
Loading…
x
Reference in New Issue
Block a user