From 31628bfd6d1023345539c01f4fca3607aacc24a5 Mon Sep 17 00:00:00 2001 From: Jonatan Castro Date: Sun, 4 Jun 2017 12:02:08 +0200 Subject: [PATCH] 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 --- source/_components/light.markdown | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/source/_components/light.markdown b/source/_components/light.markdown index 27ad3eb65be..c4ec7bce9ec 100644 --- a/source/_components/light.markdown +++ b/source/_components/light.markdown @@ -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`. | `effect`| yes | Applies an effect such as `colorloop` or `random`. +

+In order to apply attributes to an entity you will need to add `data:` to the configuration. See example below +

+ +```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` %} Turns one or multiple lights off.