-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Template Light Platform documentation #2661
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Template Light Platform documentation #2661
Conversation
theater_volume: | ||
friendly_name: 'Receiver Volume' | ||
value_template: >- | ||
{%- if is_state("media_player.receiver", "on") -%} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid render of the template, use {% raw %}{{your_template}}{% endraw %}
.
To enable Template lights in your installation, add the following to your `configuration.yaml` file: | ||
|
||
```yaml | ||
# Example configuration.yaml entry |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This example doesn't seem to have anything todo with lights?
|
||
The `template` platform creates lights that combine components. | ||
|
||
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. If your garage door also has the ability to where you can set its position, you can bind the `set_level` command to a script or service and capture the brightness variable and manipulate it before sending it to your script or service. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Template light and example is for a garage door?
|
||
```yaml | ||
# Example configuration.yaml entry | ||
light: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A simpler example for users getting started could be preferable and having the advanced one as an option after the configuration variables.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good and can be merged when parent PR is merged.
|
||
The `template` platform creates lights that combine components. | ||
|
||
This provides pretty much the same functionality as a [template switch](/components/switch.template/) with the exception is that you can pass brightness commands through. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rewrite this paragraph assuming the user hasn't yet read about template switches. Just describe what this platform will do here. You can keep a link at the end, or in a see also section, but this page should stand alone.
- **turn_off** (*Required*): Defines an [action](/getting-started/automation/) to run when the light is turned off. | ||
- **set_level** (*Optional*): Defines an [action](/getting-started/automation/) to run when the light is given a brightness command. | ||
- **level_template** (*Optional): Defines a [template](/topics/templating/) to get the brightness of the light. If not provided the component defaults to optimisitc brightness determination. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
entity_id is missing here. It can be copied from the template switch docs.
…ine with actual example
I fixed the name of the light in the example while I was in there
…On Wed, May 24, 2017 at 2:17 PM, Adam Mills ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In source/_components/light.template.markdown
<#2661 (comment)>
:
> + service: script.theater_lights_level
+ data_template:
+ volume_level: "{% raw %}{{brightness}}{% endraw %}"
+ level_template: "{% raw %}{{is_state('sensor.theater_brightness.attributes.lux'}}{% endraw %}"
+```
+
+Configuration variables:
+
+- **lights** array (*Required*): List of your lights.
+ - **friendly_name** (*Optional*): Name to use in the Frontend.
+ - **value_template** (*Optional*): Defines a [template](/topics/templating/) to get the state of the light. If not provided the component defaults to optimisitc state determination.
+ - **turn_on** (*Required*): Defines an [action](/getting-started/automation/) to run when the light is turned on.
+ - **turn_off** (*Required*): Defines an [action](/getting-started/automation/) to run when the light is turned off.
+ - **set_level** (*Optional*): Defines an [action](/getting-started/automation/) to run when the light is given a brightness command.
+ - **level_template** (*Optional): Defines a [template](/topics/templating/) to get the brightness of the light. If not provided the component defaults to optimisitc brightness determination.
+
entity_id is missing here. It can be copied from the template switch docs.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#2661 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABjyferX-w7SY08RZq-X7cxjaENh0SuPks5r9HQpgaJpZM4Nghbn>
.
|
Description:
The Light platform analog to the Template Switch
Pull request in home-assistant (if applicable): home-assistant/core#7657