From 21705a10a7fe523c1d6efd37141687625c51e455 Mon Sep 17 00:00:00 2001 From: Kendell R Date: Sun, 4 Oct 2020 07:41:32 -0700 Subject: [PATCH 01/40] Create adaptive_lighting.markdown --- .../_integrations/adaptive_lighting.markdown | 114 ++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 source/_integrations/adaptive_lighting.markdown diff --git a/source/_integrations/adaptive_lighting.markdown b/source/_integrations/adaptive_lighting.markdown new file mode 100644 index 000000000000..08ca6f10469f --- /dev/null +++ b/source/_integrations/adaptive_lighting.markdown @@ -0,0 +1,114 @@ +--- +title: Adaptive Lighting +description: Instructions for setting up Adaptive Lighting with Home Assistant +ha_category: + - Automation +ha_release: 0.116 +ha_quality_scale: internal +ha_domain: adaptive_lighting +ha_config_flow: true +--- + +The `adaptive_lighting` platform syncs the color and brightness of your lights to your circadian rhythm. You can set it up using the UI. + +The integration will update your lights based on the time of day. It will only affect lights that are turned on and listed in the flux configuration. + +During the day (in between `start time` and `sunset time`), it will fade the lights from the `start_colortemp` to the `sunset_colortemp`. After sunset (between `sunset_time` and `stop_time`), the lights will fade from the `sunset_colortemp` to the `stop_colortemp`. If the lights are still on after the `stop_time` it will continue to change the light to the `stop_colortemp` until the light is turned off. The fade effect is created by updating the lights periodically. + +The color temperature is specified kelvin, and accepted values are between 1000 and 40000 kelvin. Lower values will seem more red, while higher will look more white. + +If you want to update at variable intervals, you can leave the switch turned off and use automation rules that call the service `switch._update` whenever you want the lights updated, where `` equals the `name:` property in the switch configuration. + +## Configuration + +The integration is configurable through the frontend. (**Configuration** -> **Integrations** -> **Adaptive Lighting**, **Adaptive Lighting** -> **Options**) + +You can configure more advanced options with `configuration.yaml`. + +```yaml +# Example configuration.yaml entry +adaptive_lighting: + lights: + - light.living_room_lights +``` + +{% configuration %} +lights: + description: List of light entities. + required: true + type: list +name: + description: The name to use when displaying this switch. + required: false + default: default + type: string +disable_brightness_adjust: + description: Whether to disable adjusting brightness of lights. + required: false + type: boolean +disable_entity: + description: An entity to disable adaptive lighting. + required: false + type: time +start_colortemp: + description: The color temperature at the start. + required: false + default: 4000 + type: integer +sunset_colortemp: + description: The sun set color temperature. + required: false + default: 3000 + type: integer +stop_colortemp: + description: The color temperature at the end. + required: false + default: 1900 + type: integer +brightness: + description: The brightness of the lights. + required: false + type: integer +disable_brightness_adjust: + description: If true, brightness will not be adjusted besides color temperature. + required: false + type: boolean + default: false +mode: + description: Select how color temperature is passed to lights. Valid values are `xy`, `mired` and `rgb`. + required: false + default: xy + type: string +transition: + description: Transition time in seconds for the light changes (high values may not be supported by all light models). + required: false + default: 30 + type: integer +interval: + description: Frequency in seconds at which the lights should be updated. + required: false + default: 30 + type: integer +{% endconfiguration %} + +Full example: + +```yaml +# Example configuration.yaml entry +switch: + - platform: flux + lights: + - light.desk + - light.lamp + name: Fluxer + start_time: '7:00' + stop_time: '23:00' + start_colortemp: 4000 + sunset_colortemp: 3000 + stop_colortemp: 1900 + brightness: 200 + disable_brightness_adjust: true + mode: xy + transition: 30 + interval: 60 +``` From f198f2c3cd5b5ae9cd790c2eb1a57ea8f3146aa2 Mon Sep 17 00:00:00 2001 From: Kendell R Date: Sun, 4 Oct 2020 07:58:33 -0700 Subject: [PATCH 02/40] Update adaptive_lighting.markdown --- .../_integrations/adaptive_lighting.markdown | 67 +++++++++++-------- 1 file changed, 38 insertions(+), 29 deletions(-) diff --git a/source/_integrations/adaptive_lighting.markdown b/source/_integrations/adaptive_lighting.markdown index 08ca6f10469f..34c40ab33860 100644 --- a/source/_integrations/adaptive_lighting.markdown +++ b/source/_integrations/adaptive_lighting.markdown @@ -45,50 +45,51 @@ name: disable_brightness_adjust: description: Whether to disable adjusting brightness of lights. required: false + default: false type: boolean disable_entity: - description: An entity to disable adaptive lighting. + description: An entity to toggle disabling adaptive lighting. + required: false + type: boolean +disable_state: + description: The state of the entity to disable adaptive lighting. required: false + type: [list, string] +initial_transition: + description: How long the first transition is. + required: false + default: 1 type: time -start_colortemp: - description: The color temperature at the start. +transition: + description: How long the transition is when the lights change, in seconds. required: false - default: 4000 + default: 60 type: integer -sunset_colortemp: - description: The sun set color temperature. +max_brightness: + description: The maximum percent of brightness to set the lights to. required: false - default: 3000 + default: 100 type: integer -stop_colortemp: - description: The color temperature at the end. +max_color_temp: + description: The warmest color temperature to set the lights to. required: false - default: 1900 + default: 5500 type: integer -brightness: - description: The brightness of the lights. +min_brightness: + description: The minimum percent of brightness to set the lights to. required: false + default: 1 type: integer -disable_brightness_adjust: - description: If true, brightness will not be adjusted besides color temperature. - required: false - type: boolean - default: false -mode: - description: Select how color temperature is passed to lights. Valid values are `xy`, `mired` and `rgb`. +min_color_temp: + description: The coldest color temperature to set the lights to. required: false - default: xy - type: string -transition: - description: Transition time in seconds for the light changes (high values may not be supported by all light models). - required: false - default: 30 + default: 2500 type: integer -interval: - description: Frequency in seconds at which the lights should be updated. +only_once: + description: Whether to keep adjusting the lights, or to only adjust the lights as soon as they're turned on. required: false - default: 30 - type: integer + default: false + type: boolean {% endconfiguration %} Full example: @@ -112,3 +113,11 @@ switch: transition: 30 interval: 60 ``` + +### Services + +You can call `adaptive_lighting.apply` to manually adjust a light. + +| Service data attribute | Optional | Description | +|---------------------------|----------|-------------------------------------------------------| +| `entity_id` | yes | Only act on specific vacuum. Use `entity_id: all` to target all. | From b0a90a42a2df6696f07430a6cc5b27e383c691e8 Mon Sep 17 00:00:00 2001 From: Kendell R Date: Sun, 4 Oct 2020 08:06:21 -0700 Subject: [PATCH 03/40] Update adaptive_lighting.markdown --- source/_integrations/adaptive_lighting.markdown | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/source/_integrations/adaptive_lighting.markdown b/source/_integrations/adaptive_lighting.markdown index 34c40ab33860..30f0c3bdd224 100644 --- a/source/_integrations/adaptive_lighting.markdown +++ b/source/_integrations/adaptive_lighting.markdown @@ -116,8 +116,14 @@ switch: ### Services -You can call `adaptive_lighting.apply` to manually adjust a light. +`adaptive_lighting.apply` applies adaptive lighting settings to lights on demand. | Service data attribute | Optional | Description | |---------------------------|----------|-------------------------------------------------------| -| `entity_id` | yes | Only act on specific vacuum. Use `entity_id: all` to target all. | +| `entity_id` | no | The entity ID of the switch with the settings to apply. | +| `lights` | no | A list of lights to apply the settings to. | +| `transition` | yes | The number of seconds for the transition. | +| `adapt_brightness` | yes | Whether to change the brightness of the light or not. | +| `adapt_color_temp` | yes | Whether to adapt the color temperature on supporting lights. | +| `adapt_rgb_color` | yes | Whether to adapt the color temperature with RGB. | +| `turn_on_lights` | yes | Whether turn on lights that are currently off. | From 9c133edd6ac74eda6b9c52873352526a7474f2ec Mon Sep 17 00:00:00 2001 From: Kendell R Date: Sun, 4 Oct 2020 08:07:51 -0700 Subject: [PATCH 04/40] Update adaptive_lighting.markdown --- source/_integrations/adaptive_lighting.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/_integrations/adaptive_lighting.markdown b/source/_integrations/adaptive_lighting.markdown index 30f0c3bdd224..3e097ccb83c1 100644 --- a/source/_integrations/adaptive_lighting.markdown +++ b/source/_integrations/adaptive_lighting.markdown @@ -50,7 +50,7 @@ disable_brightness_adjust: disable_entity: description: An entity to toggle disabling adaptive lighting. required: false - type: boolean + type: string disable_state: description: The state of the entity to disable adaptive lighting. required: false From fd1047374effb78e63c099bffeaff0b7a1e36692 Mon Sep 17 00:00:00 2001 From: Kendell R Date: Sun, 4 Oct 2020 08:19:05 -0700 Subject: [PATCH 05/40] Update adaptive_lighting.markdown --- source/_integrations/adaptive_lighting.markdown | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/source/_integrations/adaptive_lighting.markdown b/source/_integrations/adaptive_lighting.markdown index 3e097ccb83c1..722b58095bdd 100644 --- a/source/_integrations/adaptive_lighting.markdown +++ b/source/_integrations/adaptive_lighting.markdown @@ -49,11 +49,11 @@ disable_brightness_adjust: type: boolean disable_entity: description: An entity to toggle disabling adaptive lighting. - required: false + required: inclusive type: string disable_state: description: The state of the entity to disable adaptive lighting. - required: false + required: inclusive type: [list, string] initial_transition: description: How long the first transition is. @@ -90,6 +90,14 @@ only_once: required: false default: false type: boolean +sleep_brightness: + description: Brightness to use in sleep mode. + required: false + type: integer +sleep_color_temp: + description: Color temperature to use in sleep mode. + required: false + type: integer {% endconfiguration %} Full example: From 3e9cd9b3725662a7a48cb5e066fda56b7faa4795 Mon Sep 17 00:00:00 2001 From: Kendell R Date: Sun, 4 Oct 2020 09:42:29 -0700 Subject: [PATCH 06/40] Update adaptive_lighting.markdown --- .../_integrations/adaptive_lighting.markdown | 89 ++++++++++++------- 1 file changed, 57 insertions(+), 32 deletions(-) diff --git a/source/_integrations/adaptive_lighting.markdown b/source/_integrations/adaptive_lighting.markdown index 722b58095bdd..505f338c7784 100644 --- a/source/_integrations/adaptive_lighting.markdown +++ b/source/_integrations/adaptive_lighting.markdown @@ -1,6 +1,6 @@ --- title: Adaptive Lighting -description: Instructions for setting up Adaptive Lighting with Home Assistant +description: How to set up Adaptive Lighting with Home Assistant ha_category: - Automation ha_release: 0.116 @@ -9,19 +9,11 @@ ha_domain: adaptive_lighting ha_config_flow: true --- -The `adaptive_lighting` platform syncs the color and brightness of your lights to your circadian rhythm. You can set it up using the UI. - -The integration will update your lights based on the time of day. It will only affect lights that are turned on and listed in the flux configuration. - -During the day (in between `start time` and `sunset time`), it will fade the lights from the `start_colortemp` to the `sunset_colortemp`. After sunset (between `sunset_time` and `stop_time`), the lights will fade from the `sunset_colortemp` to the `stop_colortemp`. If the lights are still on after the `stop_time` it will continue to change the light to the `stop_colortemp` until the light is turned off. The fade effect is created by updating the lights periodically. - -The color temperature is specified kelvin, and accepted values are between 1000 and 40000 kelvin. Lower values will seem more red, while higher will look more white. - -If you want to update at variable intervals, you can leave the switch turned off and use automation rules that call the service `switch._update` whenever you want the lights updated, where `` equals the `name:` property in the switch configuration. +The `adaptive_lighting` platform syncs the color and brightness of your lights to natural lighting brightness and color temperature. This helps maintain your circadian rhythm, which can help you have better sleep and feel better. ## Configuration -The integration is configurable through the frontend. (**Configuration** -> **Integrations** -> **Adaptive Lighting**, **Adaptive Lighting** -> **Options**) +This integration is configurable through the frontend. (**Configuration** -> **Integrations** -> **Adaptive Lighting**, **Adaptive Lighting** -> **Options**) You can configure more advanced options with `configuration.yaml`. @@ -60,11 +52,6 @@ initial_transition: required: false default: 1 type: time -transition: - description: How long the transition is when the lights change, in seconds. - required: false - default: 60 - type: integer max_brightness: description: The maximum percent of brightness to set the lights to. required: false @@ -98,28 +85,66 @@ sleep_color_temp: description: Color temperature to use in sleep mode. required: false type: integer +sleep_entity: + description: An entity to toggle sleep mode. + required: inclusive + type: string +sleep_state: + description: When the sleep entity is one of/this state(s), use the sleep brightness and temperature. + required: inclusive + type: [list, string] +sunrise_offset: + description: Positive or negative offset from the sunrise time. + required: false + type: time +sunrise_time: + description: Set a fixed time for sunrise. + required: false + type: time +sunset_offset: + description: Positive or negative offset from the sunset time. + required: false + type: time +sunrise_time: + description: Set a fixed time for sunset. + required: false + type: time +transition: + description: How long the transition is when the lights change, in seconds. + required: false + default: 60 + type: integer {% endconfiguration %} Full example: ```yaml # Example configuration.yaml entry -switch: - - platform: flux - lights: - - light.desk - - light.lamp - name: Fluxer - start_time: '7:00' - stop_time: '23:00' - start_colortemp: 4000 - sunset_colortemp: 3000 - stop_colortemp: 1900 - brightness: 200 - disable_brightness_adjust: true - mode: xy - transition: 30 - interval: 60 +adaptive_lighting: + - name: All settings + lights: light.living_room_lights + disable_brightness_adjust: false + disable_entity: input_select.sleep_mode + disable_state: + - 'off' + - 'half' + initial_transition: + seconds: 10 + interval: "00:00:30" + max_brightness: 90 + max_color_temp: 5500 + min_brightness: 1 + min_color_temp: 2500 + only_once: false + sleep_brightness: 1 + sleep_color_temp: 1000 + sleep_entity: input_boolean.sleep_mode + sleep_state: "total" + sunrise_offset: 1800 + sunrise_time: "08:00:00" + sunset_offset: 0 + sunset_time: null + transition: 10 ``` ### Services From da7af67591463d3a340b36e144d7c694c20c8c63 Mon Sep 17 00:00:00 2001 From: Kendell R Date: Sun, 4 Oct 2020 09:51:30 -0700 Subject: [PATCH 07/40] Update adaptive_lighting.markdown --- source/_integrations/adaptive_lighting.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/_integrations/adaptive_lighting.markdown b/source/_integrations/adaptive_lighting.markdown index 505f338c7784..3b46d35ea659 100644 --- a/source/_integrations/adaptive_lighting.markdown +++ b/source/_integrations/adaptive_lighting.markdown @@ -9,7 +9,7 @@ ha_domain: adaptive_lighting ha_config_flow: true --- -The `adaptive_lighting` platform syncs the color and brightness of your lights to natural lighting brightness and color temperature. This helps maintain your circadian rhythm, which can help you have better sleep and feel better. +The `adaptive_lighting` platform syncs the color and brightness of your lights to natural lighting brightness and color temperature. This helps maintain your circadian rhythm, which can help you have better sleep and feel better. You can see [the README](https://github.com/claytonjn/hass-circadian_lighting/blame/db7d0574dd7e4fdad5bd9b9c08db24f85bdddedb/README.md#L2-L20) of the project that this component was based off of for more details. ## Configuration From deba8fbc5fb98002c4f70ac55171f37bcbf37d06 Mon Sep 17 00:00:00 2001 From: Kendell R Date: Sun, 4 Oct 2020 12:09:00 -0700 Subject: [PATCH 08/40] Update adaptive_lighting.markdown --- source/_integrations/adaptive_lighting.markdown | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/_integrations/adaptive_lighting.markdown b/source/_integrations/adaptive_lighting.markdown index 3b46d35ea659..3fb57836c6ea 100644 --- a/source/_integrations/adaptive_lighting.markdown +++ b/source/_integrations/adaptive_lighting.markdown @@ -44,7 +44,7 @@ disable_entity: required: inclusive type: string disable_state: - description: The state of the entity to disable adaptive lighting. + description: When the sleep entity is this state (or one of the states in the list), disable Adaptive Lighting. required: inclusive type: [list, string] initial_transition: @@ -90,23 +90,23 @@ sleep_entity: required: inclusive type: string sleep_state: - description: When the sleep entity is one of/this state(s), use the sleep brightness and temperature. + description: When the sleep entity is this state (or one of the states in the list), use the sleep brightness and temperature. required: inclusive type: [list, string] sunrise_offset: - description: Positive or negative offset from the sunrise time. + description: Change the sunrise time with a positive or negative offset. required: false type: time sunrise_time: - description: Set a fixed time for sunrise. + description: Override the sunrise time with a fixed time. required: false type: time sunset_offset: - description: Positive or negative offset from the sunset time. + description: Change the sunset time with a positive or negative offset. required: false type: time sunrise_time: - description: Set a fixed time for sunset. + description: Override the sunset time with a fixed time. required: false type: time transition: From 5213ee370734a7801ee4648f7666ce74ce556187 Mon Sep 17 00:00:00 2001 From: Kendell R Date: Mon, 5 Oct 2020 08:57:29 -0700 Subject: [PATCH 09/40] Update adaptive_lighting.markdown --- source/_integrations/adaptive_lighting.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/_integrations/adaptive_lighting.markdown b/source/_integrations/adaptive_lighting.markdown index 3fb57836c6ea..89bb91241cdd 100644 --- a/source/_integrations/adaptive_lighting.markdown +++ b/source/_integrations/adaptive_lighting.markdown @@ -58,7 +58,7 @@ max_brightness: default: 100 type: integer max_color_temp: - description: The warmest color temperature to set the lights to. + description: The warmest color temperature to set the lights to, in Kelvin. required: false default: 5500 type: integer @@ -68,7 +68,7 @@ min_brightness: default: 1 type: integer min_color_temp: - description: The coldest color temperature to set the lights to. + description: The coldest color temperature to set the lights to, in Kelvin. required: false default: 2500 type: integer From a31cffbf5b2d052a78f0309f2062c797b172c4a6 Mon Sep 17 00:00:00 2001 From: Kendell R Date: Mon, 5 Oct 2020 10:50:37 -0700 Subject: [PATCH 10/40] Update adaptive_lighting.markdown --- .../_integrations/adaptive_lighting.markdown | 59 ++++++++++--------- 1 file changed, 31 insertions(+), 28 deletions(-) diff --git a/source/_integrations/adaptive_lighting.markdown b/source/_integrations/adaptive_lighting.markdown index 89bb91241cdd..6030db5a5205 100644 --- a/source/_integrations/adaptive_lighting.markdown +++ b/source/_integrations/adaptive_lighting.markdown @@ -26,7 +26,7 @@ adaptive_lighting: {% configuration %} lights: - description: List of light entities. + description: List of light entities for Adaptive Lighting to control. required: true type: list name: @@ -34,19 +34,26 @@ name: required: false default: default type: string -disable_brightness_adjust: - description: Whether to disable adjusting brightness of lights. +adapt_brightness: + description: Whether Adaptive Lighting should adjust brightness of lights. required: false - default: false + default: true type: boolean -disable_entity: - description: An entity to toggle disabling adaptive lighting. - required: inclusive - type: string -disable_state: - description: When the sleep entity is this state (or one of the states in the list), disable Adaptive Lighting. +adapt_color_temp: + description: Whether Adaptive Lighting should adjust color temperature of lights. + required: false + default: true + type: boolean +adapt_rgb_color: + description: Whether Adaptive Lighting should adjust RGB color of lights (when color temperature doesn't work). + required: false + default: true + type: boolean +detect_non_ha_changes: + description: Whether to detect changes and stop adjusting lights, even not from `light.turn_on`. Requires `take_over_control` to be enabled. required: inclusive - type: [list, string] + default: true + type: boolean initial_transition: description: How long the first transition is. required: false @@ -70,32 +77,22 @@ min_brightness: min_color_temp: description: The coldest color temperature to set the lights to, in Kelvin. required: false - default: 2500 + default: 2000 type: integer only_once: description: Whether to keep adjusting the lights, or to only adjust the lights as soon as they're turned on. required: false default: false type: boolean -sleep_brightness: - description: Brightness to use in sleep mode. - required: false - type: integer -sleep_color_temp: - description: Color temperature to use in sleep mode. +prefer_rgb_color: + description: Whether to use RGB color adjustment instead of native light color temperature. required: false - type: integer -sleep_entity: - description: An entity to toggle sleep mode. - required: inclusive - type: string -sleep_state: - description: When the sleep entity is this state (or one of the states in the list), use the sleep brightness and temperature. - required: inclusive - type: [list, string] + default: false + type: boolean sunrise_offset: description: Change the sunrise time with a positive or negative offset. required: false + default: 0 type: time sunrise_time: description: Override the sunrise time with a fixed time. @@ -104,15 +101,21 @@ sunrise_time: sunset_offset: description: Change the sunset time with a positive or negative offset. required: false + default: 0 type: time sunrise_time: description: Override the sunset time with a fixed time. required: false type: time +take_over_control: + description: If another source calls `light.turn_on` while the lights are on and being adjusted, disable Adaptive Lighting. + required: false + default: true + type: boolean transition: description: How long the transition is when the lights change, in seconds. required: false - default: 60 + default: 45 type: integer {% endconfiguration %} From ec14563d1d688d4f20ded6a57809bc4668b9eaee Mon Sep 17 00:00:00 2001 From: Kendell R Date: Mon, 5 Oct 2020 11:00:47 -0700 Subject: [PATCH 11/40] Update adaptive_lighting.markdown --- source/_integrations/adaptive_lighting.markdown | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/source/_integrations/adaptive_lighting.markdown b/source/_integrations/adaptive_lighting.markdown index 6030db5a5205..04fa9010f5a9 100644 --- a/source/_integrations/adaptive_lighting.markdown +++ b/source/_integrations/adaptive_lighting.markdown @@ -45,17 +45,12 @@ adapt_color_temp: default: true type: boolean adapt_rgb_color: - description: Whether Adaptive Lighting should adjust RGB color of lights (when color temperature doesn't work). + description: Whether Adaptive Lighting should adjust RGB color of lights. required: false default: true type: boolean -detect_non_ha_changes: - description: Whether to detect changes and stop adjusting lights, even not from `light.turn_on`. Requires `take_over_control` to be enabled. - required: inclusive - default: true - type: boolean initial_transition: - description: How long the first transition is. + description: How long the first transition is when the lights go from `off` to `on`. required: false default: 1 type: time @@ -112,6 +107,11 @@ take_over_control: required: false default: true type: boolean +detect_non_ha_changes: + description: Whether to detect changes and stop adjusting lights, even not from `light.turn_on`. Needs `take_over_control` to be enabled. + required: inclusive + default: true + type: boolean transition: description: How long the transition is when the lights change, in seconds. required: false From 9d8b563aba64bde47a8b74083cccd18ce87102f0 Mon Sep 17 00:00:00 2001 From: Kendell R Date: Tue, 13 Oct 2020 14:08:51 -0700 Subject: [PATCH 12/40] Update adaptive_lighting.markdown --- .../_integrations/adaptive_lighting.markdown | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/source/_integrations/adaptive_lighting.markdown b/source/_integrations/adaptive_lighting.markdown index 04fa9010f5a9..fa65d2f8583a 100644 --- a/source/_integrations/adaptive_lighting.markdown +++ b/source/_integrations/adaptive_lighting.markdown @@ -29,6 +29,7 @@ lights: description: List of light entities for Adaptive Lighting to control. required: true type: list + default: [] name: description: The name to use when displaying this switch. required: false @@ -54,6 +55,11 @@ initial_transition: required: false default: 1 type: time +interval: + description: How often to adjust the lights. + required: false + default: 90 + type: integer max_brightness: description: The maximum percent of brightness to set the lights to. required: false @@ -102,6 +108,16 @@ sunrise_time: description: Override the sunset time with a fixed time. required: false type: time +sleep_brightness: + description: Brightness of lights while the sleep mode is enabled. + required: false + default: 1 + type: integer +sleep_color_temp: + description: Color temperature of lights while the sleep mode is enabled. + required: false + default: 1000 + type: integer take_over_control: description: If another source calls `light.turn_on` while the lights are on and being adjusted, disable Adaptive Lighting. required: false @@ -110,7 +126,7 @@ take_over_control: detect_non_ha_changes: description: Whether to detect changes and stop adjusting lights, even not from `light.turn_on`. Needs `take_over_control` to be enabled. required: inclusive - default: true + default: false type: boolean transition: description: How long the transition is when the lights change, in seconds. From a977ca2409c42c16d05a5663d24f463d05a3e3d3 Mon Sep 17 00:00:00 2001 From: Kendell R Date: Wed, 14 Oct 2020 07:50:25 -0700 Subject: [PATCH 13/40] Update adaptive_lighting.markdown --- source/_integrations/adaptive_lighting.markdown | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/_integrations/adaptive_lighting.markdown b/source/_integrations/adaptive_lighting.markdown index fa65d2f8583a..883a1617f495 100644 --- a/source/_integrations/adaptive_lighting.markdown +++ b/source/_integrations/adaptive_lighting.markdown @@ -179,3 +179,10 @@ adaptive_lighting: | `adapt_color_temp` | yes | Whether to adapt the color temperature on supporting lights. | | `adapt_rgb_color` | yes | Whether to adapt the color temperature with RGB. | | `turn_on_lights` | yes | Whether turn on lights that are currently off. | + +`adaptive_lighting.set_manually_controlled` changes whether lights are manually controlled. + +| Service data attribute | Optional | Description | +|---------------------------|----------|-------------------------------------------------------| +| `entity_id` | no | The entity ID of the switch with the settings to apply. | +| `lights` | no | A list of lights to apply the settings to. | From da9a921fe882e6fab5850ac6d8387b1471e0d987 Mon Sep 17 00:00:00 2001 From: Kendell R Date: Wed, 14 Oct 2020 09:03:00 -0700 Subject: [PATCH 14/40] Update adaptive_lighting.markdown --- source/_integrations/adaptive_lighting.markdown | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/_integrations/adaptive_lighting.markdown b/source/_integrations/adaptive_lighting.markdown index 883a1617f495..559e021b04d3 100644 --- a/source/_integrations/adaptive_lighting.markdown +++ b/source/_integrations/adaptive_lighting.markdown @@ -180,9 +180,10 @@ adaptive_lighting: | `adapt_rgb_color` | yes | Whether to adapt the color temperature with RGB. | | `turn_on_lights` | yes | Whether turn on lights that are currently off. | -`adaptive_lighting.set_manually_controlled` changes whether lights are manually controlled. +`adaptive_lighting.set_manually_controlled` changes whether lights are automatically adjusted. | Service data attribute | Optional | Description | |---------------------------|----------|-------------------------------------------------------| -| `entity_id` | no | The entity ID of the switch with the settings to apply. | -| `lights` | no | A list of lights to apply the settings to. | +| `entity_id` | no | The entity ID of the switch with the settings to apply. | +| `lights` | no | A list of lights to apply the settings to. | +| `manually_controlled` | no | Whether to add (true) or remove (false) this/these lights in the list of lights to not adjust. | From 0e153db8fee16467518424d048e78a4f9cc9f68b Mon Sep 17 00:00:00 2001 From: Kendell R Date: Wed, 14 Oct 2020 14:01:37 -0700 Subject: [PATCH 15/40] Update adaptive_lighting.markdown --- source/_integrations/adaptive_lighting.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/_integrations/adaptive_lighting.markdown b/source/_integrations/adaptive_lighting.markdown index 559e021b04d3..2b1a2c7384df 100644 --- a/source/_integrations/adaptive_lighting.markdown +++ b/source/_integrations/adaptive_lighting.markdown @@ -3,7 +3,7 @@ title: Adaptive Lighting description: How to set up Adaptive Lighting with Home Assistant ha_category: - Automation -ha_release: 0.116 +ha_release: 0.117 ha_quality_scale: internal ha_domain: adaptive_lighting ha_config_flow: true @@ -180,7 +180,7 @@ adaptive_lighting: | `adapt_rgb_color` | yes | Whether to adapt the color temperature with RGB. | | `turn_on_lights` | yes | Whether turn on lights that are currently off. | -`adaptive_lighting.set_manually_controlled` changes whether lights are automatically adjusted. +`adaptive_lighting.set_manual_control` changes whether lights are automatically adjusted. | Service data attribute | Optional | Description | |---------------------------|----------|-------------------------------------------------------| From d38e93db4240cf950d763b08b014b6f07761d5b3 Mon Sep 17 00:00:00 2001 From: Bas Nijholt Date: Wed, 14 Oct 2020 23:58:38 +0200 Subject: [PATCH 16/40] rewrite documentation parts --- .../_integrations/adaptive_lighting.markdown | 221 +++++++++++------- 1 file changed, 134 insertions(+), 87 deletions(-) diff --git a/source/_integrations/adaptive_lighting.markdown b/source/_integrations/adaptive_lighting.markdown index 2b1a2c7384df..520afa13a1d3 100644 --- a/source/_integrations/adaptive_lighting.markdown +++ b/source/_integrations/adaptive_lighting.markdown @@ -3,19 +3,43 @@ title: Adaptive Lighting description: How to set up Adaptive Lighting with Home Assistant ha_category: - Automation + - Light ha_release: 0.117 -ha_quality_scale: internal ha_domain: adaptive_lighting +ha_codeowners: + - '@basnijholt' ha_config_flow: true --- -The `adaptive_lighting` platform syncs the color and brightness of your lights to natural lighting brightness and color temperature. This helps maintain your circadian rhythm, which can help you have better sleep and feel better. You can see [the README](https://github.com/claytonjn/hass-circadian_lighting/blame/db7d0574dd7e4fdad5bd9b9c08db24f85bdddedb/README.md#L2-L20) of the project that this component was based off of for more details. +The `adaptive_lighting` platform changes the settings of your lights throughout the day. +It uses the position of the sun to calculate the color temperature and brightness that is most fitting for that time of the day. +Scientific research has shown that this helps to maintain your natural circadian rhythm (your biological clock) and might lead to improved sleep, mood, and general well-being. -## Configuration +In practical terms, this means that after the sun sets, the brightness of your lights will decrease to a certain minimum brightness, while the color temperature will be at its coolest color temperature at noon, after which it will decrease and reach its warmest color at sunset. +Around sunrise, the opposite will happen. + +Additionally, the integration provides a way to define and set your lights in "sleep mode". +When "sleep mode" is enabled, the lights will be at a minimal brightness and have a very warm color. + +The integration creates two switches. +The first switch `switch.adaptive_lighting_default` (with name `"default"`) turns the Adaptive Lighting on or off. +It has several attributes that show the current light settings. +The second switch is `switch.adaptive_lighting_sleep_mode_default` (with name `"default"`) that when activated, turns on "sleep mode". -This integration is configurable through the frontend. (**Configuration** -> **Integrations** -> **Adaptive Lighting**, **Adaptive Lighting** -> **Options**) +## Taking back control + +Although having your lights automatically adapt is great most of the time, there might be times at which you want to set the lights to a different color/brightness and keep it that way. +For this purpose, the integration (when `take_over_control` is enabled) automatically detects whether someone (e.g., person toggling the light switch) or something (automation) changes the lights. +If this happens *and* the light is already on, the light that was changed gets marked as "manually controlled" and the Adaptive Lighting component will stop adapting that light until it turns off and on again (or if you use the service call `adaptive_lighting.set_manual_control`). +This mechanism works by listening to all `light.turn_on` calls and by noting that the component did not make the call. +Additionally, there is an option to detect all state changes (when `detect_non_ha_changes` is enabled), so also changes to the lights that were not made by a `light.turn_on` call (e.g., through an app or via something not controlled by Home Assistant.) +It does this by comparing a light's state to Adaptive Lighting's previously used settings. +Whenever a light gets marked as "manually controlled", an `adaptive_lighting.manual_control` event is fired, such that one can use this information in automations. + +## Configuration -You can configure more advanced options with `configuration.yaml`. +This integration is both fully configurable through YAML _and_ the frontend. (**Configuration** -> **Integrations** -> **Adaptive Lighting**, **Adaptive Lighting** -> **Options**) +Here, the options in the frontend and in YAML have the same names. ```yaml # Example configuration.yaml entry @@ -25,78 +49,92 @@ adaptive_lighting: ``` {% configuration %} -lights: - description: List of light entities for Adaptive Lighting to control. - required: true - type: list - default: [] name: description: The name to use when displaying this switch. required: false default: default type: string +lights: + description: List of light entities for Adaptive Lighting to control (may be empty). + required: false + type: list + default: [] adapt_brightness: - description: Whether Adaptive Lighting should adjust brightness of lights. + description: Whether Adaptive Lighting should adjust brightness of lights (if supported by the light). required: false default: true type: boolean adapt_color_temp: - description: Whether Adaptive Lighting should adjust color temperature of lights. + description: Whether Adaptive Lighting should adjust color temperature of lights (if supported by the light). required: false default: true type: boolean adapt_rgb_color: - description: Whether Adaptive Lighting should adjust RGB color of lights. + description: Whether Adaptive Lighting should adjust RGB color of lights (if supported by the light). required: false default: true type: boolean +prefer_rgb_color: + description: Whether to use RGB color adjustment instead of native light color temperature. + required: false + default: false + type: boolean initial_transition: - description: How long the first transition is when the lights go from `off` to `on`. + description: How long the first transition is when the lights go from `off` to `on` (or when "sleep mode" is (de)activated). required: false default: 1 type: time +transition: + description: How long the transition is when the lights change, in seconds. + required: false + default: 45 + type: integer interval: - description: How often to adjust the lights. + description: Period between adapting the lights, in seconds. required: false default: 90 type: integer +min_brightness: + description: The minimum percent of brightness to set the lights to. + required: false + default: 1 + type: integer max_brightness: description: The maximum percent of brightness to set the lights to. required: false default: 100 type: integer +min_color_temp: + description: The coldest color temperature to set the lights to, in Kelvin. + required: false + default: 2000 + type: integer max_color_temp: description: The warmest color temperature to set the lights to, in Kelvin. required: false default: 5500 type: integer -min_brightness: - description: The minimum percent of brightness to set the lights to. +sleep_brightness: + description: Brightness of lights while the sleep mode is enabled. required: false default: 1 type: integer -min_color_temp: - description: The coldest color temperature to set the lights to, in Kelvin. +sleep_color_temp: + description: Color temperature of lights while the sleep mode is enabled. required: false - default: 2000 + default: 1000 type: integer -only_once: - description: Whether to keep adjusting the lights, or to only adjust the lights as soon as they're turned on. - required: false - default: false - type: boolean -prefer_rgb_color: - description: Whether to use RGB color adjustment instead of native light color temperature. +sunrise_time: + description: Override the sunrise time with a fixed time. required: false - default: false - type: boolean + type: time sunrise_offset: description: Change the sunrise time with a positive or negative offset. required: false default: 0 type: time sunrise_time: - description: Override the sunrise time with a fixed time. + description: Override the sunset time with a fixed time. required: false type: time sunset_offset: @@ -104,35 +142,21 @@ sunset_offset: required: false default: 0 type: time -sunrise_time: - description: Override the sunset time with a fixed time. - required: false - type: time -sleep_brightness: - description: Brightness of lights while the sleep mode is enabled. - required: false - default: 1 - type: integer -sleep_color_temp: - description: Color temperature of lights while the sleep mode is enabled. +only_once: + description: Whether to keep adapting the lights (false) or to only adapt the lights as soon as they are turned on (true). required: false - default: 1000 - type: integer + default: false + type: boolean take_over_control: - description: If another source calls `light.turn_on` while the lights are on and being adjusted, disable Adaptive Lighting. + description: If another source calls `light.turn_on` while the lights are on and being adaptive, disable Adaptive Lighting. required: false default: true type: boolean detect_non_ha_changes: - description: Whether to detect changes and stop adjusting lights, even not from `light.turn_on`. Needs `take_over_control` to be enabled. + description: Whether to detect state changes and stop adapting lights, even not from `light.turn_on`. Needs `take_over_control` to be enabled. Note that by enabling this option, it calls 'homeassistant.update_entity' every 'interval'! required: inclusive default: false type: boolean -transition: - description: How long the transition is when the lights change, in seconds. - required: false - default: 45 - type: integer {% endconfiguration %} Full example: @@ -140,50 +164,73 @@ Full example: ```yaml # Example configuration.yaml entry adaptive_lighting: - - name: All settings - lights: light.living_room_lights - disable_brightness_adjust: false - disable_entity: input_select.sleep_mode - disable_state: - - 'off' - - 'half' - initial_transition: - seconds: 10 - interval: "00:00:30" - max_brightness: 90 - max_color_temp: 5500 - min_brightness: 1 - min_color_temp: 2500 - only_once: false - sleep_brightness: 1 - sleep_color_temp: 1000 - sleep_entity: input_boolean.sleep_mode - sleep_state: "total" - sunrise_offset: 1800 - sunrise_time: "08:00:00" - sunset_offset: 0 - sunset_time: null - transition: 10 +- name: "default" + lights: [] + adapt_brightness: true + adapt_color_temp: true + adapt_rgb_color: true + prefer_rgb_color: false + transition: 45 + initial_transition: 1 + interval: 90 + min_brightness: 1 + max_brightness: 100 + min_color_temp: 2000 + max_color_temp: 5500 + sleep_brightness: 1 + sleep_color_temp: 1000 + sunrise_time: "08:00:00" # override the sunrise time + sunrise_offset: "00:15:00" + sunset_time: + sunset_offset: -1800 # in seconds + take_over_control: true + detect_non_ha_changes: false + only_once: false + ``` ### Services -`adaptive_lighting.apply` applies adaptive lighting settings to lights on demand. +`adaptive_lighting.apply` applies Adaptive Lighting settings to lights on demand. -| Service data attribute | Optional | Description | -|---------------------------|----------|-------------------------------------------------------| -| `entity_id` | no | The entity ID of the switch with the settings to apply. | -| `lights` | no | A list of lights to apply the settings to. | +| Service data attribute | Optional | Description | +|---------------------------|----------|-------------------------------------------------------------------------| +| `entity_id` | no | The `entity_id` of the switch with the settings to apply. | +| `lights` | no | A light (or list of lights) to apply the settings to. | | `transition` | yes | The number of seconds for the transition. | | `adapt_brightness` | yes | Whether to change the brightness of the light or not. | | `adapt_color_temp` | yes | Whether to adapt the color temperature on supporting lights. | -| `adapt_rgb_color` | yes | Whether to adapt the color temperature with RGB. | -| `turn_on_lights` | yes | Whether turn on lights that are currently off. | +| `adapt_rgb_color` | yes | Whether to adapt the color temperature with `rgb_color`. | +| `turn_on_lights` | yes | Whether to turn on lights that are currently off. | -`adaptive_lighting.set_manual_control` changes whether lights are automatically adjusted. +`adaptive_lighting.set_manual_control` can mark (or unmark) whether a light is "manually controlled", meaning that when a light has `manual_control`, the light is not adapted. -| Service data attribute | Optional | Description | -|---------------------------|----------|-------------------------------------------------------| -| `entity_id` | no | The entity ID of the switch with the settings to apply. | -| `lights` | no | A list of lights to apply the settings to. | -| `manually_controlled` | no | Whether to add (true) or remove (false) this/these lights in the list of lights to not adjust. | +| Service data attribute | Optional | Description | +|---------------------------|----------|----------------------------------------------------------------------------------------------------| +| `entity_id` | no | The `entity_id` of the switch in which to (un)mark the light as being "manually controlled". | +| `lights` | no | A light (or list of lights) to apply the settings to. | +| `manual_control` | no | Whether to mark (true) or unmark (false) the light as "manually controlled". | + + +### Automation examples + +Reset the `manual_control` status of a light after an hour. +```yaml +- alias: "Adaptive lighting: reset manual_control after 1 hour" + mode: parallel + trigger: + platform: event + event_type: adaptive_lighting.manual_control + variables: + light: "{{ trigger.event.data.entity_id }}" + switch: "{{ trigger.entity_id }}" + action: + - delay: "01:00:00" + - condition: template + value_template: "{{ light in state_attr('switch', 'manual_control') }}" + - service: adaptive_lighting.set_manually_controlled + data: + entity_id: "{{ switch }}" + lights: "{{ light }}" + manual_control: false +``` From ecbd6a56d5af0eeca565dbabad8483212a29b56e Mon Sep 17 00:00:00 2001 From: Kendell R Date: Wed, 14 Oct 2020 15:05:05 -0700 Subject: [PATCH 17/40] Update source/_integrations/adaptive_lighting.markdown Co-authored-by: Bas Nijholt --- source/_integrations/adaptive_lighting.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/_integrations/adaptive_lighting.markdown b/source/_integrations/adaptive_lighting.markdown index 520afa13a1d3..ecd2fbaa4227 100644 --- a/source/_integrations/adaptive_lighting.markdown +++ b/source/_integrations/adaptive_lighting.markdown @@ -228,7 +228,7 @@ Reset the `manual_control` status of a light after an hour. - delay: "01:00:00" - condition: template value_template: "{{ light in state_attr('switch', 'manual_control') }}" - - service: adaptive_lighting.set_manually_controlled + - service: adaptive_lighting.set_manual_control data: entity_id: "{{ switch }}" lights: "{{ light }}" From d92301196a0e5ca5e2eaa8639e8b374ff5a56582 Mon Sep 17 00:00:00 2001 From: Kendell R Date: Wed, 14 Oct 2020 15:05:14 -0700 Subject: [PATCH 18/40] Update source/_integrations/adaptive_lighting.markdown Co-authored-by: Bas Nijholt --- source/_integrations/adaptive_lighting.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/_integrations/adaptive_lighting.markdown b/source/_integrations/adaptive_lighting.markdown index ecd2fbaa4227..44034125400c 100644 --- a/source/_integrations/adaptive_lighting.markdown +++ b/source/_integrations/adaptive_lighting.markdown @@ -212,7 +212,7 @@ adaptive_lighting: | `manual_control` | no | Whether to mark (true) or unmark (false) the light as "manually controlled". | -### Automation examples +## Automation examples Reset the `manual_control` status of a light after an hour. ```yaml From 4dc76613a8fd85f4f0953a75a38b4700c348afe3 Mon Sep 17 00:00:00 2001 From: Kendell R Date: Wed, 14 Oct 2020 15:08:51 -0700 Subject: [PATCH 19/40] Update source/_integrations/adaptive_lighting.markdown Co-authored-by: Bas Nijholt --- source/_integrations/adaptive_lighting.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/_integrations/adaptive_lighting.markdown b/source/_integrations/adaptive_lighting.markdown index 44034125400c..95e50b2eb5e6 100644 --- a/source/_integrations/adaptive_lighting.markdown +++ b/source/_integrations/adaptive_lighting.markdown @@ -148,7 +148,7 @@ only_once: default: false type: boolean take_over_control: - description: If another source calls `light.turn_on` while the lights are on and being adaptive, disable Adaptive Lighting. + description: If another source calls `light.turn_on` while the lights are on and being adapted, disable Adaptive Lighting. required: false default: true type: boolean From b1611e00afcbf35996a29d2d4d73447c449ea087 Mon Sep 17 00:00:00 2001 From: Kendell R Date: Wed, 14 Oct 2020 17:46:33 -0700 Subject: [PATCH 20/40] Update source/_integrations/adaptive_lighting.markdown Co-authored-by: Bas Nijholt --- source/_integrations/adaptive_lighting.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/_integrations/adaptive_lighting.markdown b/source/_integrations/adaptive_lighting.markdown index 95e50b2eb5e6..2e9d764ffd3c 100644 --- a/source/_integrations/adaptive_lighting.markdown +++ b/source/_integrations/adaptive_lighting.markdown @@ -32,7 +32,7 @@ Although having your lights automatically adapt is great most of the time, there For this purpose, the integration (when `take_over_control` is enabled) automatically detects whether someone (e.g., person toggling the light switch) or something (automation) changes the lights. If this happens *and* the light is already on, the light that was changed gets marked as "manually controlled" and the Adaptive Lighting component will stop adapting that light until it turns off and on again (or if you use the service call `adaptive_lighting.set_manual_control`). This mechanism works by listening to all `light.turn_on` calls and by noting that the component did not make the call. -Additionally, there is an option to detect all state changes (when `detect_non_ha_changes` is enabled), so also changes to the lights that were not made by a `light.turn_on` call (e.g., through an app or via something not controlled by Home Assistant.) +Additionally, there is an option to detect all state changes (when `detect_non_ha_changes` is enabled), so also changes to the lights that were not made by a `light.turn_on` call (e.g., through an app or via something outside of Home Assistant.) It does this by comparing a light's state to Adaptive Lighting's previously used settings. Whenever a light gets marked as "manually controlled", an `adaptive_lighting.manual_control` event is fired, such that one can use this information in automations. From 61bc3045275c08c3b2b86c8526bc949418e20cf5 Mon Sep 17 00:00:00 2001 From: Kendell R Date: Thu, 15 Oct 2020 07:10:03 -0700 Subject: [PATCH 21/40] Update source/_integrations/adaptive_lighting.markdown Co-authored-by: Bas Nijholt --- source/_integrations/adaptive_lighting.markdown | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/source/_integrations/adaptive_lighting.markdown b/source/_integrations/adaptive_lighting.markdown index 2e9d764ffd3c..d109749ec304 100644 --- a/source/_integrations/adaptive_lighting.markdown +++ b/source/_integrations/adaptive_lighting.markdown @@ -234,3 +234,20 @@ Reset the `manual_control` status of a light after an hour. lights: "{{ light }}" manual_control: false ``` + +Toggle multiple Adaptive Lighting switches to "sleep mode" using an `input_boolean.sleep_mode`. +```yaml +- alias: "Adaptive lighting: toggle 'sleep mode'" + trigger: + - platform: state + entity_id: input_boolean.sleep_mode + - platform: homeassistant + event: start # in case the states aren't properly restored + variables: + sleep_mode: "{{ states('input_boolean.sleep_mode') }}" + action: + service: "switch.turn_{{ sleep_mode }}" + entity_id: + - switch.adaptive_lighting_sleep_mode_living_room + - switch.adaptive_lighting_sleep_mode_bedroom +``` From 15c9803001d145a6ade56e03b7b22fdcff5dcddd Mon Sep 17 00:00:00 2001 From: Kendell R Date: Thu, 15 Oct 2020 07:12:46 -0700 Subject: [PATCH 22/40] Update source/_integrations/adaptive_lighting.markdown Co-authored-by: Bas Nijholt --- source/_integrations/adaptive_lighting.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/_integrations/adaptive_lighting.markdown b/source/_integrations/adaptive_lighting.markdown index d109749ec304..c19d5524213c 100644 --- a/source/_integrations/adaptive_lighting.markdown +++ b/source/_integrations/adaptive_lighting.markdown @@ -227,7 +227,7 @@ Reset the `manual_control` status of a light after an hour. action: - delay: "01:00:00" - condition: template - value_template: "{{ light in state_attr('switch', 'manual_control') }}" + value_template: "{{ light in state_attr(switch, 'manual_control') }}" - service: adaptive_lighting.set_manual_control data: entity_id: "{{ switch }}" From 7561004aba8048551d3be788e38f1b29b7b60a94 Mon Sep 17 00:00:00 2001 From: Kendell R Date: Thu, 15 Oct 2020 07:19:10 -0700 Subject: [PATCH 23/40] Update source/_integrations/adaptive_lighting.markdown Co-authored-by: Bas Nijholt --- source/_integrations/adaptive_lighting.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/_integrations/adaptive_lighting.markdown b/source/_integrations/adaptive_lighting.markdown index c19d5524213c..2b529187a0f2 100644 --- a/source/_integrations/adaptive_lighting.markdown +++ b/source/_integrations/adaptive_lighting.markdown @@ -227,7 +227,7 @@ Reset the `manual_control` status of a light after an hour. action: - delay: "01:00:00" - condition: template - value_template: "{{ light in state_attr(switch, 'manual_control') }}" + value_template: "{% raw %}{{ light in state_attr(switch, 'manual_control') }}{% endraw %}" - service: adaptive_lighting.set_manual_control data: entity_id: "{{ switch }}" From 5533b0a3af79d436fbbcaac0de2a18ddc7dd5ba3 Mon Sep 17 00:00:00 2001 From: Kendell R Date: Thu, 15 Oct 2020 07:22:06 -0700 Subject: [PATCH 24/40] Update source/_integrations/adaptive_lighting.markdown Co-authored-by: Bas Nijholt --- source/_integrations/adaptive_lighting.markdown | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/_integrations/adaptive_lighting.markdown b/source/_integrations/adaptive_lighting.markdown index 2b529187a0f2..00af84f53402 100644 --- a/source/_integrations/adaptive_lighting.markdown +++ b/source/_integrations/adaptive_lighting.markdown @@ -215,6 +215,7 @@ adaptive_lighting: ## Automation examples Reset the `manual_control` status of a light after an hour. +{% raw %} ```yaml - alias: "Adaptive lighting: reset manual_control after 1 hour" mode: parallel @@ -227,13 +228,14 @@ Reset the `manual_control` status of a light after an hour. action: - delay: "01:00:00" - condition: template - value_template: "{% raw %}{{ light in state_attr(switch, 'manual_control') }}{% endraw %}" + value_template: "{{ light in state_attr(switch, 'manual_control') }}" - service: adaptive_lighting.set_manual_control data: entity_id: "{{ switch }}" lights: "{{ light }}" manual_control: false ``` +{% endraw %} Toggle multiple Adaptive Lighting switches to "sleep mode" using an `input_boolean.sleep_mode`. ```yaml From 87e899f71c86540dd56a9e9c162554bb5fbb1608 Mon Sep 17 00:00:00 2001 From: Kendell R Date: Thu, 15 Oct 2020 07:24:38 -0700 Subject: [PATCH 25/40] Update source/_integrations/adaptive_lighting.markdown Co-authored-by: Bas Nijholt --- source/_integrations/adaptive_lighting.markdown | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/_integrations/adaptive_lighting.markdown b/source/_integrations/adaptive_lighting.markdown index 00af84f53402..fe363961c5ff 100644 --- a/source/_integrations/adaptive_lighting.markdown +++ b/source/_integrations/adaptive_lighting.markdown @@ -238,6 +238,7 @@ Reset the `manual_control` status of a light after an hour. {% endraw %} Toggle multiple Adaptive Lighting switches to "sleep mode" using an `input_boolean.sleep_mode`. +{% raw %} ```yaml - alias: "Adaptive lighting: toggle 'sleep mode'" trigger: @@ -253,3 +254,4 @@ Toggle multiple Adaptive Lighting switches to "sleep mode" using an `input_boole - switch.adaptive_lighting_sleep_mode_living_room - switch.adaptive_lighting_sleep_mode_bedroom ``` +{% endraw %} From 317adca45fbbd6a850eedd3fd0e46e5e4a6e83be Mon Sep 17 00:00:00 2001 From: Kendell R Date: Thu, 15 Oct 2020 08:57:56 -0700 Subject: [PATCH 26/40] Update source/_integrations/adaptive_lighting.markdown --- source/_integrations/adaptive_lighting.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/_integrations/adaptive_lighting.markdown b/source/_integrations/adaptive_lighting.markdown index fe363961c5ff..a8a43879b1f9 100644 --- a/source/_integrations/adaptive_lighting.markdown +++ b/source/_integrations/adaptive_lighting.markdown @@ -105,12 +105,12 @@ max_brightness: default: 100 type: integer min_color_temp: - description: The coldest color temperature to set the lights to, in Kelvin. + description: The warmest color temperature to set the lights to, in Kelvin. required: false default: 2000 type: integer max_color_temp: - description: The warmest color temperature to set the lights to, in Kelvin. + description: The coldest color temperature to set the lights to, in Kelvin. required: false default: 5500 type: integer From af80fb54b32a03aad6d2774cb766ce9be9ebc49f Mon Sep 17 00:00:00 2001 From: Kendell R Date: Thu, 15 Oct 2020 10:52:07 -0700 Subject: [PATCH 27/40] Update source/_integrations/adaptive_lighting.markdown --- source/_integrations/adaptive_lighting.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/_integrations/adaptive_lighting.markdown b/source/_integrations/adaptive_lighting.markdown index a8a43879b1f9..f5a113134cd4 100644 --- a/source/_integrations/adaptive_lighting.markdown +++ b/source/_integrations/adaptive_lighting.markdown @@ -80,7 +80,7 @@ prefer_rgb_color: default: false type: boolean initial_transition: - description: How long the first transition is when the lights go from `off` to `on` (or when "sleep mode" is (de)activated). + description: How long the first transition is when the lights go from `off` to `on` (or when "sleep mode" is toggled). required: false default: 1 type: time From 6fb577f5e5b309195cc9651b97e3b0cba4ae7efd Mon Sep 17 00:00:00 2001 From: Kendell R Date: Thu, 15 Oct 2020 10:52:21 -0700 Subject: [PATCH 28/40] Update source/_integrations/adaptive_lighting.markdown --- source/_integrations/adaptive_lighting.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/_integrations/adaptive_lighting.markdown b/source/_integrations/adaptive_lighting.markdown index f5a113134cd4..6fd5cde12658 100644 --- a/source/_integrations/adaptive_lighting.markdown +++ b/source/_integrations/adaptive_lighting.markdown @@ -90,7 +90,7 @@ transition: default: 45 type: integer interval: - description: Period between adapting the lights, in seconds. + description: How often to adapt the lights, in seconds. required: false default: 90 type: integer From a292de41e3eef12ea2df513ccecddf462a2ec9a1 Mon Sep 17 00:00:00 2001 From: Kendell R Date: Fri, 16 Oct 2020 09:14:58 -0700 Subject: [PATCH 29/40] Update source/_integrations/adaptive_lighting.markdown Co-authored-by: Bas Nijholt --- source/_integrations/adaptive_lighting.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/_integrations/adaptive_lighting.markdown b/source/_integrations/adaptive_lighting.markdown index 6fd5cde12658..eacb6f5c2581 100644 --- a/source/_integrations/adaptive_lighting.markdown +++ b/source/_integrations/adaptive_lighting.markdown @@ -180,9 +180,9 @@ adaptive_lighting: sleep_brightness: 1 sleep_color_temp: 1000 sunrise_time: "08:00:00" # override the sunrise time - sunrise_offset: "00:15:00" + sunrise_offset: sunset_time: - sunset_offset: -1800 # in seconds + sunset_offset: 1800 # in seconds or '00:15:00' take_over_control: true detect_non_ha_changes: false only_once: false From 7956899d0e9d4482f90e16a98b1868d35912cf95 Mon Sep 17 00:00:00 2001 From: Kendell R Date: Wed, 21 Oct 2020 16:01:12 -0700 Subject: [PATCH 30/40] Update source/_integrations/adaptive_lighting.markdown Co-authored-by: Bas Nijholt --- source/_integrations/adaptive_lighting.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/_integrations/adaptive_lighting.markdown b/source/_integrations/adaptive_lighting.markdown index eacb6f5c2581..11f91389a336 100644 --- a/source/_integrations/adaptive_lighting.markdown +++ b/source/_integrations/adaptive_lighting.markdown @@ -31,7 +31,7 @@ The second switch is `switch.adaptive_lighting_sleep_mode_default` (with name `" Although having your lights automatically adapt is great most of the time, there might be times at which you want to set the lights to a different color/brightness and keep it that way. For this purpose, the integration (when `take_over_control` is enabled) automatically detects whether someone (e.g., person toggling the light switch) or something (automation) changes the lights. If this happens *and* the light is already on, the light that was changed gets marked as "manually controlled" and the Adaptive Lighting component will stop adapting that light until it turns off and on again (or if you use the service call `adaptive_lighting.set_manual_control`). -This mechanism works by listening to all `light.turn_on` calls and by noting that the component did not make the call. +This mechanism works by listening to all `light.turn_on` calls that change the color or brightness and by noting that the component did not make the call. Additionally, there is an option to detect all state changes (when `detect_non_ha_changes` is enabled), so also changes to the lights that were not made by a `light.turn_on` call (e.g., through an app or via something outside of Home Assistant.) It does this by comparing a light's state to Adaptive Lighting's previously used settings. Whenever a light gets marked as "manually controlled", an `adaptive_lighting.manual_control` event is fired, such that one can use this information in automations. From 37759469bdae1969def1a34a700e9f9f545b4d43 Mon Sep 17 00:00:00 2001 From: Kendell R Date: Wed, 21 Oct 2020 16:01:28 -0700 Subject: [PATCH 31/40] Update source/_integrations/adaptive_lighting.markdown Co-authored-by: Bas Nijholt --- source/_integrations/adaptive_lighting.markdown | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/source/_integrations/adaptive_lighting.markdown b/source/_integrations/adaptive_lighting.markdown index 11f91389a336..da742418c72f 100644 --- a/source/_integrations/adaptive_lighting.markdown +++ b/source/_integrations/adaptive_lighting.markdown @@ -21,10 +21,11 @@ Around sunrise, the opposite will happen. Additionally, the integration provides a way to define and set your lights in "sleep mode". When "sleep mode" is enabled, the lights will be at a minimal brightness and have a very warm color. -The integration creates two switches. -The first switch `switch.adaptive_lighting_default` (with name `"default"`) turns the Adaptive Lighting on or off. -It has several attributes that show the current light settings. -The second switch is `switch.adaptive_lighting_sleep_mode_default` (with name `"default"`) that when activated, turns on "sleep mode". +The integration creates 4 switches (in this example the component's name is `"living_room"`): +1. `switch.adaptive_lighting_living_room`, which turns the Adaptive Lighting integration on or off. It has several attributes that show the current light settings. +2. `switch.adaptive_lighting_sleep_mode_living_room`, which when activated, turns on "sleep mode" (you can set a specific `sleep_brightness` and `sleep_color_temp`). +3. `switch.adaptive_lighting_adapt_brightness_living_room`, which sets whether the integration should adapt the brightness of the lights (if supported by the light). +4. `switch.adaptive_lighting_adapt_color_living_room`, which sets whether the integration should adapt the color of the lights (if supported by the light). ## Taking back control From 4a91ad0c524670cbbac7b7c0a657e2d65ba9ecad Mon Sep 17 00:00:00 2001 From: Kendell R Date: Wed, 21 Oct 2020 16:03:50 -0700 Subject: [PATCH 32/40] Update source/_integrations/adaptive_lighting.markdown Co-authored-by: Bas Nijholt --- source/_integrations/adaptive_lighting.markdown | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/source/_integrations/adaptive_lighting.markdown b/source/_integrations/adaptive_lighting.markdown index da742418c72f..59e012709bab 100644 --- a/source/_integrations/adaptive_lighting.markdown +++ b/source/_integrations/adaptive_lighting.markdown @@ -60,21 +60,6 @@ lights: required: false type: list default: [] -adapt_brightness: - description: Whether Adaptive Lighting should adjust brightness of lights (if supported by the light). - required: false - default: true - type: boolean -adapt_color_temp: - description: Whether Adaptive Lighting should adjust color temperature of lights (if supported by the light). - required: false - default: true - type: boolean -adapt_rgb_color: - description: Whether Adaptive Lighting should adjust RGB color of lights (if supported by the light). - required: false - default: true - type: boolean prefer_rgb_color: description: Whether to use RGB color adjustment instead of native light color temperature. required: false From 910e2de9236f138a569a696a0bf491766bc4ca26 Mon Sep 17 00:00:00 2001 From: Kendell R Date: Thu, 22 Oct 2020 10:19:35 -0700 Subject: [PATCH 33/40] Update source/_integrations/adaptive_lighting.markdown Co-authored-by: Bas Nijholt --- source/_integrations/adaptive_lighting.markdown | 3 --- 1 file changed, 3 deletions(-) diff --git a/source/_integrations/adaptive_lighting.markdown b/source/_integrations/adaptive_lighting.markdown index 59e012709bab..39eaee364dc4 100644 --- a/source/_integrations/adaptive_lighting.markdown +++ b/source/_integrations/adaptive_lighting.markdown @@ -152,9 +152,6 @@ Full example: adaptive_lighting: - name: "default" lights: [] - adapt_brightness: true - adapt_color_temp: true - adapt_rgb_color: true prefer_rgb_color: false transition: 45 initial_transition: 1 From 8d05fd71f5a07d929db22e66586c184aa28077b1 Mon Sep 17 00:00:00 2001 From: Kendell R Date: Sun, 25 Oct 2020 07:32:29 -0700 Subject: [PATCH 34/40] Update source/_integrations/adaptive_lighting.markdown Co-authored-by: Bas Nijholt --- source/_integrations/adaptive_lighting.markdown | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/_integrations/adaptive_lighting.markdown b/source/_integrations/adaptive_lighting.markdown index 39eaee364dc4..eaf511c8d310 100644 --- a/source/_integrations/adaptive_lighting.markdown +++ b/source/_integrations/adaptive_lighting.markdown @@ -181,10 +181,10 @@ adaptive_lighting: | `entity_id` | no | The `entity_id` of the switch with the settings to apply. | | `lights` | no | A light (or list of lights) to apply the settings to. | | `transition` | yes | The number of seconds for the transition. | -| `adapt_brightness` | yes | Whether to change the brightness of the light or not. | -| `adapt_color_temp` | yes | Whether to adapt the color temperature on supporting lights. | -| `adapt_rgb_color` | yes | Whether to adapt the color temperature with `rgb_color`. | -| `turn_on_lights` | yes | Whether to turn on lights that are currently off. | +| `adapt_brightness` | yes | Whether to change the brightness of the light or not. | +| `adapt_color` | yes | Whether to adapt the color on supporting lights. | +| `prefer_rgb_color` | yes | Whether to prefer RGB color adjustment over of native light color temperature when possible. | +| `turn_on_lights` | yes | Whether to turn on lights that are currently off. | `adaptive_lighting.set_manual_control` can mark (or unmark) whether a light is "manually controlled", meaning that when a light has `manual_control`, the light is not adapted. From 41486b1d23fa2ae92bb23c6a6336a97ad10776b3 Mon Sep 17 00:00:00 2001 From: Kendell R Date: Tue, 27 Oct 2020 11:48:24 -0700 Subject: [PATCH 35/40] Update source/_integrations/adaptive_lighting.markdown Co-authored-by: Bas Nijholt --- source/_integrations/adaptive_lighting.markdown | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/_integrations/adaptive_lighting.markdown b/source/_integrations/adaptive_lighting.markdown index eaf511c8d310..0cdbfafe5f78 100644 --- a/source/_integrations/adaptive_lighting.markdown +++ b/source/_integrations/adaptive_lighting.markdown @@ -188,11 +188,11 @@ adaptive_lighting: `adaptive_lighting.set_manual_control` can mark (or unmark) whether a light is "manually controlled", meaning that when a light has `manual_control`, the light is not adapted. -| Service data attribute | Optional | Description | -|---------------------------|----------|----------------------------------------------------------------------------------------------------| -| `entity_id` | no | The `entity_id` of the switch in which to (un)mark the light as being "manually controlled". | -| `lights` | no | A light (or list of lights) to apply the settings to. | -| `manual_control` | no | Whether to mark (true) or unmark (false) the light as "manually controlled". | +| Service data attribute | Optional | Description | +|------------------------|----------|--------------------------------------------------------------------------------------------------------------------------------------| +| `entity_id` | no | The `entity_id` of the switch in which to (un)mark the light as being "manually controlled". | +| `lights` | no | A light (or list of lights) to apply the settings to. | +| `manual_control` | no | Whether to mark (true) or unmark (false) the light as "manually controlled", when not specified it selects all lights in the switch. | ## Automation examples From a9fe0f1ed169ee0625592d0ef3c42928f58bc0cd Mon Sep 17 00:00:00 2001 From: Kendell R Date: Fri, 30 Oct 2020 06:48:52 -0700 Subject: [PATCH 36/40] Update source/_integrations/adaptive_lighting.markdown --- source/_integrations/adaptive_lighting.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/_integrations/adaptive_lighting.markdown b/source/_integrations/adaptive_lighting.markdown index 0cdbfafe5f78..c4c7459bbdbb 100644 --- a/source/_integrations/adaptive_lighting.markdown +++ b/source/_integrations/adaptive_lighting.markdown @@ -4,7 +4,7 @@ description: How to set up Adaptive Lighting with Home Assistant ha_category: - Automation - Light -ha_release: 0.117 +ha_release: 0.118 ha_domain: adaptive_lighting ha_codeowners: - '@basnijholt' From 608c00f41604472c0682999ac357c042ab977f35 Mon Sep 17 00:00:00 2001 From: Kendell R Date: Fri, 6 Nov 2020 17:24:58 -0800 Subject: [PATCH 37/40] Update source/_integrations/adaptive_lighting.markdown Co-authored-by: mountainsandcode --- source/_integrations/adaptive_lighting.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/_integrations/adaptive_lighting.markdown b/source/_integrations/adaptive_lighting.markdown index c4c7459bbdbb..52548a0606d7 100644 --- a/source/_integrations/adaptive_lighting.markdown +++ b/source/_integrations/adaptive_lighting.markdown @@ -119,7 +119,7 @@ sunrise_offset: required: false default: 0 type: time -sunrise_time: +sunset_time: description: Override the sunset time with a fixed time. required: false type: time From 6b78abd58a6978f4caaedd521963cef1a5407aac Mon Sep 17 00:00:00 2001 From: Kendell R Date: Sat, 19 Dec 2020 07:31:15 -0800 Subject: [PATCH 38/40] Change 0.118 to 2021.1.0 Co-authored-by: Bas Nijholt --- source/_integrations/adaptive_lighting.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/_integrations/adaptive_lighting.markdown b/source/_integrations/adaptive_lighting.markdown index 52548a0606d7..e9cb04b4c548 100644 --- a/source/_integrations/adaptive_lighting.markdown +++ b/source/_integrations/adaptive_lighting.markdown @@ -4,7 +4,7 @@ description: How to set up Adaptive Lighting with Home Assistant ha_category: - Automation - Light -ha_release: 0.118 +ha_release: 2021.1.0 ha_domain: adaptive_lighting ha_codeowners: - '@basnijholt' From f963eec15c9ea6acd9a63a3a831f5d0b87363b34 Mon Sep 17 00:00:00 2001 From: Kendell R Date: Sat, 19 Dec 2020 07:31:30 -0800 Subject: [PATCH 39/40] Fix automation Co-authored-by: Bas Nijholt --- source/_integrations/adaptive_lighting.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/_integrations/adaptive_lighting.markdown b/source/_integrations/adaptive_lighting.markdown index e9cb04b4c548..b379b591f277 100644 --- a/source/_integrations/adaptive_lighting.markdown +++ b/source/_integrations/adaptive_lighting.markdown @@ -207,7 +207,7 @@ Reset the `manual_control` status of a light after an hour. event_type: adaptive_lighting.manual_control variables: light: "{{ trigger.event.data.entity_id }}" - switch: "{{ trigger.entity_id }}" + switch: "{{ trigger.event.data.switch }}" action: - delay: "01:00:00" - condition: template From 10bdb84c83603d79243ff60bf2397ea3ac9e063b Mon Sep 17 00:00:00 2001 From: Kendell R Date: Sat, 19 Dec 2020 10:11:30 -0800 Subject: [PATCH 40/40] Add some more docs Co-authored-by: Bas Nijholt --- source/_integrations/adaptive_lighting.markdown | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source/_integrations/adaptive_lighting.markdown b/source/_integrations/adaptive_lighting.markdown index b379b591f277..5bfb2762d2c3 100644 --- a/source/_integrations/adaptive_lighting.markdown +++ b/source/_integrations/adaptive_lighting.markdown @@ -140,7 +140,12 @@ take_over_control: type: boolean detect_non_ha_changes: description: Whether to detect state changes and stop adapting lights, even not from `light.turn_on`. Needs `take_over_control` to be enabled. Note that by enabling this option, it calls 'homeassistant.update_entity' every 'interval'! - required: inclusive + required: false + default: false + type: boolean +separate_turn_on_commands: + description: Whether to use separate `light.turn_on` calls for color and brightness, needed for some types of lights. + required: false default: false type: boolean {% endconfiguration %}