mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-23 01:06:52 +00:00
Update light.markdown (#2744)
* Update light.markdown I had a hard time setting up attributes to entities until I research for some other user's examples and saw they were using "data:". I feel like this should be mentioned or at least exposed with an example. I saw being used in 2 different ways: ```yaml action: service: light.turn_on data: entity_id: light.kitchen_lights brightness: 200 ``` ```yaml action: - service: light.turn_on entity_id: light.kitchen_lights data: brightness: 200 ``` I'm not sure which one is the best/correct way but tried with both and they work * Fix typos
This commit is contained in:
parent
c2133ae816
commit
31628bfd6d
@ -36,6 +36,27 @@ Most lights do not support all attributes. You can check the platform documentat
|
|||||||
| `flash` | yes | Tell light to flash, can be either value `short` or `long`.
|
| `flash` | yes | Tell light to flash, can be either value `short` or `long`.
|
||||||
| `effect`| yes | Applies an effect such as `colorloop` or `random`.
|
| `effect`| yes | Applies an effect such as `colorloop` or `random`.
|
||||||
|
|
||||||
|
<p class='note'>
|
||||||
|
In order to apply attributes to an entity you will need to add `data:` to the configuration. See example below
|
||||||
|
</p>
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# Example configuration.yaml entry
|
||||||
|
automation:
|
||||||
|
- id: one
|
||||||
|
alias: Turn on light when motion is detected
|
||||||
|
trigger:
|
||||||
|
- platform: state
|
||||||
|
entity_id: binary_sensor.motion_1
|
||||||
|
to: 'on'
|
||||||
|
action:
|
||||||
|
- service: light.turn_on
|
||||||
|
data:
|
||||||
|
entity_id: light.living_room
|
||||||
|
brightness: 255
|
||||||
|
kelvin: 2700
|
||||||
|
```
|
||||||
|
|
||||||
### {% linkable_title Service `light.turn_off` %}
|
### {% linkable_title Service `light.turn_off` %}
|
||||||
|
|
||||||
Turns one or multiple lights off.
|
Turns one or multiple lights off.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user