adaptive-lighting/custom_components/adaptive_lighting/const.py

426 lines
16 KiB
Python
Raw Normal View History

2020-09-28 13:10:41 +02:00
"""Constants for the Adaptive Lighting integration."""
2020-09-23 18:20:25 +02:00
from homeassistant.components.light import VALID_TRANSITION
from homeassistant.const import (
CONF_ENTITY_ID,
SERVICE_TOGGLE,
SERVICE_TURN_OFF,
SERVICE_TURN_ON,
)
2022-08-31 22:01:21 -07:00
from homeassistant.helpers import selector
2020-09-26 17:39:17 +02:00
import homeassistant.helpers.config_validation as cv
2022-08-28 15:08:03 -07:00
import voluptuous as vol
2020-09-23 12:35:57 +02:00
Feature requests: Switch now optional for service calls | New default icons | Reload `.yaml` w/o restart | `adapt_delay` ms (#459) * added #274 * attempt getSwitchFromLightId() * Update switch.py * changed from register_entity_service to hass.services.async_register * Update switch.py * Update switch.py * Update switch.py * Update switch.py * Update switch.py * Update switch.py * Update services.yaml * Update switch.py * test * test builds ready * target selector may not be possible with current syntax priority is backwards-compatibility as I know most people will smash that update button * expanded light groups * test builds ready * add feature #104 * Update custom_components/adaptive_lighting/switch.py Co-authored-by: Chris <firstof9@gmail.com> * Might as well type both. No reason not to. Co-authored-by: Chris <firstof9@gmail.com> * Might as well type both. No reason not to. Co-authored-by: Chris <firstof9@gmail.com> * Reformatted debug messages. Reimported ServiceCall as suggested * Multiple switches allowed again in services. Apparently this was possible before. With this change, the `lights` argument must not be passed with multiple switches, or the integration has no way of knowing what the user wants to do. Integration did not make this check in prior versions. Also reformatted the debug messages. Removed `automerge.yaml` (my apologies) * Reload config without restart. You can now reload any changes to the yaml file without restarting your home assistant. Should show a 'reload' button in your integrations page or you can call the homeassistant reload integration service call. See https://community.home-assistant.io/t/how-to-allow-custom-compontent-for-yaml-configuration-reloading/391190/4 * Use snake_case for function name 'parseServiceArgs' * Slight rephrase * Small style changes * Rephrased debug messages. Removed `integration_entities` as we rewrote the code from that function already in parse_service_args. Reference function now above parse_service_args. * removed: `these_switches = data = None` * Factor out _find_switch_with_lights * Rename function and add log statement * Remove pylint marker * Handle multiple switches found * Small changes * Rename _parse_service_args to _get_switches_from_service_call * Rephrase log messages * Add type hint --------- Co-authored-by: Chris <firstof9@gmail.com> Co-authored-by: Bas Nijholt <bas@nijho.lt>
2023-03-25 22:22:05 -05:00
ICON_MAIN = "mdi:theme-light-dark"
ICON_BRIGHTNESS = "mdi:brightness-4"
ICON_COLOR_TEMP = "mdi:sun-thermometer"
ICON_SLEEP = "mdi:sleep"
2020-09-12 23:25:36 +02:00
DOMAIN = "adaptive_lighting"
SUN_EVENT_NOON = "solar_noon"
SUN_EVENT_MIDNIGHT = "solar_midnight"
DOCS = {CONF_ENTITY_ID: "Entity ID of the switch. 📝"}
2020-09-19 11:10:54 +02:00
CONF_NAME, DEFAULT_NAME = "name", "default"
DOCS[CONF_NAME] = "Display name for this switch. 📝"
2020-09-15 23:33:19 +02:00
CONF_LIGHTS, DEFAULT_LIGHTS = "lights", []
DOCS[CONF_LIGHTS] = "List of light entity_ids to be controlled (may be empty). 🌟"
2020-10-04 15:09:58 +02:00
CONF_DETECT_NON_HA_CHANGES, DEFAULT_DETECT_NON_HA_CHANGES = (
"detect_non_ha_changes",
False,
)
DOCS[CONF_DETECT_NON_HA_CHANGES] = (
"Detect non-`light.turn_on` state changes and stop adapting lights. "
"Requires `take_over_control`. 🕵️"
)
Squashed commit of the following: commit 7069d693b86cf6db76a04332a8220ad4c8f54c49 Merge: adde5b5 a888afd Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 12:52:19 2023 -0500 Merge branch 'main' into add-watched-lights commit adde5b56459be048dde50ad1191453692af72ac4 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 10:34:24 2023 -0500 fix pytest commit 2c5eaec2d3abad432292502f9b9b5ef0e5c74956 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 07:27:25 2023 -0500 Revert "Update const.py" This reverts commit e773af07ca2bf733619721286cdbd16a1f3eec56. commit e773af07ca2bf733619721286cdbd16a1f3eec56 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 07:20:23 2023 -0500 Update const.py commit c167f59ccdd342e7e29b9571a3f440d2c4851b97 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 06:09:14 2023 -0500 Update docs commit 6220df57d1c5f682b3eff4db41749d82d9639904 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 05:59:26 2023 -0500 fix the test commit ff292c2c1bf500a0d864c8e469e0ab9d41f9ef19 Merge: 4fdf42b 19d4468 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 05:39:17 2023 -0500 Merge branch 'add-watched-lights' of https://github.com/basnijholt/adaptive-lighting into add-watched-lights commit 4fdf42bea142d65c776f08497124ac8eeaf0888e Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 05:39:05 2023 -0500 small fixes commit 19d4468f63ca2585d1c0a1c62943ed81b5f41913 Author: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Date: Mon Apr 10 10:36:54 2023 +0000 Update README.md, strings.json, and services.yaml commit 70c90181f0fd9caf2cf49e13acbe850db3d143bb Merge: e30b7de b6a9265 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 10:34:49 2023 +0000 Merge b6a92650a9acdc46774297d0de040f9528711c32 into e30b7debe551e58cc6a738f7d15a4bb75d9bb545 commit b6a92650a9acdc46774297d0de040f9528711c32 Merge: 784eed0 ae04ab4 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 05:34:43 2023 -0500 Merge branch 'add-watched-lights' of https://github.com/basnijholt/adaptive-lighting into add-watched-lights commit 784eed09b31b891763c792df97dd630151ae4371 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 05:34:33 2023 -0500 squash merge `alt_detect_method` again commit ae04ab49a8cf8a34e2381728d60b405d7cf3a562 Author: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Date: Mon Apr 10 10:34:12 2023 +0000 Update README.md, strings.json, and services.yaml commit cfbd65f976177485b13f82ef043d95db53bfd34d Merge: e30b7de 3c5ea73 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 10:32:34 2023 +0000 Merge 3c5ea73341389e086be8f5f481beb255695cd378 into e30b7debe551e58cc6a738f7d15a4bb75d9bb545 commit 3c5ea73341389e086be8f5f481beb255695cd378 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 05:32:27 2023 -0500 Update switch.py commit 2f750694d9f73e923eb6f1dfa14b510a0df56eb0 Merge: 429251b 7a9dc8f Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 05:31:13 2023 -0500 Merge branch 'add-watched-lights' of https://github.com/basnijholt/adaptive-lighting into add-watched-lights commit 429251b45f219a856fd31e856a3b8e5fe25f0f9c Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 05:31:04 2023 -0500 update docs commit 7a9dc8f24a0edabbcf19f5a3898e9c3ebf28652f Author: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Date: Mon Apr 10 10:29:37 2023 +0000 Update README.md, strings.json, and services.yaml commit 37de4244b148a14bb04913b7fcd5eee45bf41b62 Merge: e30b7de d52ea53 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 10:28:01 2023 +0000 Merge d52ea53dcce038cf19a782dbd0b1c2de0e0dc1c9 into e30b7debe551e58cc6a738f7d15a4bb75d9bb545 commit d52ea53dcce038cf19a782dbd0b1c2de0e0dc1c9 Merge: dbc47c8 e30b7de Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 05:27:43 2023 -0500 Merge branch 'main' into add-watched-lights commit dbc47c8a3693eb73de618f5396eee02fb42008b9 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 05:26:11 2023 -0500 Update switch.py commit 2db675a434567c535160929dbbc9a0a57bdd8354 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 05:25:44 2023 -0500 merge with `alt_detect_method` required for this PR commit dced97b5ca40ec159f40ca63764f1f0f47e12359 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 05:21:51 2023 -0500 merge with `origin\main`
2023-04-11 19:08:49 -05:00
CONF_ALT_DETECT_METHOD, DEFAULT_ALT_DETECT_METHOD = "alt_detect_method", False
DOCS[CONF_ALT_DETECT_METHOD] = (
"alt_detect_method: When true, will check for any significant changes in the opposite direction"
" of where adaptive-lighting tried to adapt last."
" This is an alternative to 'detect_non_ha_changes' (default: false)"
)
CONF_INCLUDE_CONFIG_IN_ATTRIBUTES, DEFAULT_INCLUDE_CONFIG_IN_ATTRIBUTES = (
"include_config_in_attributes",
False,
)
DOCS[CONF_INCLUDE_CONFIG_IN_ATTRIBUTES] = (
"Show all options as attributes on the switch in "
"Home Assistant when set to `true`. 📝"
)
2020-09-12 23:25:36 +02:00
CONF_INITIAL_TRANSITION, DEFAULT_INITIAL_TRANSITION = "initial_transition", 1
DOCS[CONF_INITIAL_TRANSITION] = (
"Duration of the first transition when lights turn "
"from `off` to `on` in seconds. ⏲️"
)
CONF_SLEEP_TRANSITION, DEFAULT_SLEEP_TRANSITION = "sleep_transition", 1
DOCS[CONF_SLEEP_TRANSITION] = (
'Duration of transition when "sleep mode" is toggled ' "in seconds. 😴"
)
CONF_INTERVAL, DEFAULT_INTERVAL = "interval", 90
DOCS[CONF_INTERVAL] = "Frequency to adapt the lights, in seconds. 🔄"
2020-09-12 23:25:36 +02:00
CONF_MAX_BRIGHTNESS, DEFAULT_MAX_BRIGHTNESS = "max_brightness", 100
DOCS[CONF_MAX_BRIGHTNESS] = "Maximum brightness percentage. 💡"
2020-09-15 23:33:19 +02:00
CONF_MAX_COLOR_TEMP, DEFAULT_MAX_COLOR_TEMP = "max_color_temp", 5500
DOCS[CONF_MAX_COLOR_TEMP] = "Coldest color temperature in Kelvin. ❄️"
2020-09-12 23:25:36 +02:00
CONF_MIN_BRIGHTNESS, DEFAULT_MIN_BRIGHTNESS = "min_brightness", 1
DOCS[CONF_MIN_BRIGHTNESS] = "Minimum brightness percentage. 💡"
2020-10-05 14:41:21 +02:00
CONF_MIN_COLOR_TEMP, DEFAULT_MIN_COLOR_TEMP = "min_color_temp", 2000
DOCS[CONF_MIN_COLOR_TEMP] = "Warmest color temperature in Kelvin. 🔥"
CONF_FLAT_LIMITS, DEFAULT_FLAT_LIMITS = "flat_limits", False
DOCS[CONF_FLAT_LIMITS] = (
"When True, will not calculate between the"
" max/min supported limits of your light. Example: when adapting brightness to 50% while "
+ CONF_MAX_BRIGHTNESS
+ " is set to 80%, Adaptive Lighting will use 80% instead of 90%"
)
2020-09-15 23:33:19 +02:00
CONF_ONLY_ONCE, DEFAULT_ONLY_ONCE = "only_once", False
DOCS[CONF_ONLY_ONCE] = (
"Adapt lights only when they are turned on (`true`) or keep adapting them "
"(`false`). 🔄"
)
CONF_PREFER_RGB_COLOR, DEFAULT_PREFER_RGB_COLOR = "prefer_rgb_color", False
DOCS[CONF_PREFER_RGB_COLOR] = (
"Whether to prefer RGB color adjustment over "
"light color temperature when possible. 🌈"
)
CONF_SEPARATE_TURN_ON_COMMANDS, DEFAULT_SEPARATE_TURN_ON_COMMANDS = (
"separate_turn_on_commands",
False,
)
DOCS[CONF_SEPARATE_TURN_ON_COMMANDS] = (
"Use separate `light.turn_on` calls for color and brightness, needed for "
"some light types. 🔀"
)
2020-09-12 23:25:36 +02:00
CONF_SLEEP_BRIGHTNESS, DEFAULT_SLEEP_BRIGHTNESS = "sleep_brightness", 1
DOCS[CONF_SLEEP_BRIGHTNESS] = "Brightness percentage of lights in sleep mode. 😴"
2020-09-15 23:33:19 +02:00
CONF_SLEEP_COLOR_TEMP, DEFAULT_SLEEP_COLOR_TEMP = "sleep_color_temp", 1000
DOCS[CONF_SLEEP_COLOR_TEMP] = (
"Color temperature in sleep mode (used when `sleep_rgb_or_color_temp` is "
"`color_temp`) in Kelvin. 😴"
)
2022-08-31 22:01:21 -07:00
CONF_SLEEP_RGB_COLOR, DEFAULT_SLEEP_RGB_COLOR = "sleep_rgb_color", [255, 56, 0]
DOCS[CONF_SLEEP_RGB_COLOR] = (
"RGB color in sleep mode (used when " '`sleep_rgb_or_color_temp` is "rgb_color"). 🌈'
)
2022-08-31 22:05:31 -07:00
CONF_SLEEP_RGB_OR_COLOR_TEMP, DEFAULT_SLEEP_RGB_OR_COLOR_TEMP = (
"sleep_rgb_or_color_temp",
"color_temp",
)
DOCS[CONF_SLEEP_RGB_OR_COLOR_TEMP] = (
'Use either `"rgb_color"` or `"color_temp"` ' "in sleep mode. 🌙"
)
CONF_SUNRISE_OFFSET, DEFAULT_SUNRISE_OFFSET = "sunrise_offset", 0
DOCS[CONF_SUNRISE_OFFSET] = (
"Adjust sunrise time with a positive or negative offset " "in seconds. ⏰"
)
2020-09-12 23:25:36 +02:00
CONF_SUNRISE_TIME = "sunrise_time"
DOCS[CONF_SUNRISE_TIME] = "Set a fixed time (HH:MM:SS) for sunrise. 🌅"
CONF_MAX_SUNRISE_TIME = "max_sunrise_time"
DOCS[CONF_MAX_SUNRISE_TIME] = (
"Set the latest virtual sunrise time (HH:MM:SS), allowing"
" for earlier real sunrises. 🌅"
)
CONF_SUNSET_OFFSET, DEFAULT_SUNSET_OFFSET = "sunset_offset", 0
DOCS[
CONF_SUNSET_OFFSET
] = "Adjust sunset time with a positive or negative offset in seconds. ⏰"
2020-09-12 23:25:36 +02:00
CONF_SUNSET_TIME = "sunset_time"
DOCS[CONF_SUNSET_TIME] = "Set a fixed time (HH:MM:SS) for sunset. 🌇"
CONF_MIN_SUNSET_TIME = "min_sunset_time"
DOCS[CONF_MIN_SUNSET_TIME] = (
"Set the earliest virtual sunset time (HH:MM:SS), allowing"
" for later real sunsets. 🌇"
)
2020-10-04 15:09:58 +02:00
CONF_TAKE_OVER_CONTROL, DEFAULT_TAKE_OVER_CONTROL = "take_over_control", True
DOCS[CONF_TAKE_OVER_CONTROL] = (
"Disable Adaptive Lighting if another source calls `light.turn_on` while lights "
"are on and being adapted. Note that this calls `homeassistant.update_entity` "
"every `interval`! 🔒"
)
2020-10-05 14:41:21 +02:00
CONF_TRANSITION, DEFAULT_TRANSITION = "transition", 45
DOCS[CONF_TRANSITION] = "Duration of transition when lights change, in seconds. 🕑"
CONF_ADAPT_UNTIL_SLEEP, DEFAULT_ADAPT_UNTIL_SLEEP = (
"transition_until_sleep",
False,
)
DOCS[CONF_ADAPT_UNTIL_SLEEP] = (
Squashed commit of the following: commit 5b927dbb020443b7272f7353fd056d512afe61a4 Merge: 78395ee a888afd Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 12:52:46 2023 -0500 Merge branch 'main' into adjust_adapt_until_sleep commit 78395eea6503bad462ab38826882e480199bcdef Author: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Date: Mon Apr 10 09:38:11 2023 +0000 Update README.md, strings.json, and services.yaml commit bc39f5e977b12faf03e6403fb476a396635300d4 Merge: e30b7de c4b5067 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 09:36:39 2023 +0000 Merge c4b5067b052527cefbfb014a1dd024550865434e into e30b7debe551e58cc6a738f7d15a4bb75d9bb545 commit c4b5067b052527cefbfb014a1dd024550865434e Merge: 7244a5f 91d6065 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 04:36:25 2023 -0500 Merge branch 'adjust_adapt_until_sleep' of https://github.com/basnijholt/adaptive-lighting into adjust_adapt_until_sleep commit 7244a5f48374b9c0f54ee20af5b857e94faf03eb Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 04:36:14 2023 -0500 Update const.py commit 91d606586fd48bb9d27025f7f84e1aac50b9a926 Author: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Date: Mon Apr 10 09:28:58 2023 +0000 Update README.md, strings.json, and services.yaml commit 4509c0a0f1b809d5821d003c1f336afd395e7837 Merge: e30b7de e46d867 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 09:27:02 2023 +0000 Merge e46d867854ad0ebe000868f4e82be03111104d7a into e30b7debe551e58cc6a738f7d15a4bb75d9bb545 commit e46d867854ad0ebe000868f4e82be03111104d7a Merge: e7e266b 3b61f49 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 04:26:56 2023 -0500 Merge branch 'adjust_adapt_until_sleep' of https://github.com/basnijholt/adaptive-lighting into adjust_adapt_until_sleep commit e7e266b5a19385cee711ff6ed920addf6eefb6d7 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 04:26:47 2023 -0500 Update const.py commit 3b61f49fb395343788530f95bf1bd4fe0cce85ee Author: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Date: Mon Apr 10 09:26:09 2023 +0000 Update README.md, strings.json, and services.yaml commit 7f952e06585b62d1d3ca770a0cae3f85a5b0f8e8 Merge: e30b7de a4d5f86 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 09:24:27 2023 +0000 Merge a4d5f861ff2e0cadcfc33bef1a78dc3c840cdbcc into e30b7debe551e58cc6a738f7d15a4bb75d9bb545 commit a4d5f861ff2e0cadcfc33bef1a78dc3c840cdbcc Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 04:24:20 2023 -0500 autofill workaround commit 06dd2a5c9a9d5ca983996c32123864b3ca6be41c Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 04:23:01 2023 -0500 Revert "Merge branch 'adjust_adapt_until_sleep' of https://github.com/basnijholt/adaptive-lighting into adjust_adapt_until_sleep" This reverts commit bca9f1bd3d9428e09c5695082059e493e7085c35, reversing changes made to 840aab6158229875e04911de4a45549ad244074e. commit bca9f1bd3d9428e09c5695082059e493e7085c35 Merge: 840aab6 2d74a31 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 04:22:19 2023 -0500 Merge branch 'adjust_adapt_until_sleep' of https://github.com/basnijholt/adaptive-lighting into adjust_adapt_until_sleep commit 840aab6158229875e04911de4a45549ad244074e Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 04:22:07 2023 -0500 add `adapt_color_temp_until_sleep` supports backward-compatibility commit 2d74a313bb7b6ae7d5c6eb8fb2191db0c44c69db Author: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Date: Mon Apr 10 09:14:31 2023 +0000 Update README.md, strings.json, and services.yaml commit 553265a1e8cab8ab38bba57e926edd033e21f0cd Merge: e30b7de b53a5af Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 09:12:53 2023 +0000 Merge b53a5aff68f06501c41f64070e2cc9f327f250c2 into e30b7debe551e58cc6a738f7d15a4bb75d9bb545 commit b53a5aff68f06501c41f64070e2cc9f327f250c2 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 04:11:48 2023 -0500 add new config option commit 4e1c769feb0a78188ed2dc49143147f634ad0a94 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 04:06:09 2023 -0500 initial commit
2023-04-11 19:10:37 -05:00
"This option ignores the current state of the sleep switch. "
"When enabled, Adaptive Lighting will treat sleep settings as the minimum, "
Squashed commit of the following: commit 5b927dbb020443b7272f7353fd056d512afe61a4 Merge: 78395ee a888afd Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 12:52:46 2023 -0500 Merge branch 'main' into adjust_adapt_until_sleep commit 78395eea6503bad462ab38826882e480199bcdef Author: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Date: Mon Apr 10 09:38:11 2023 +0000 Update README.md, strings.json, and services.yaml commit bc39f5e977b12faf03e6403fb476a396635300d4 Merge: e30b7de c4b5067 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 09:36:39 2023 +0000 Merge c4b5067b052527cefbfb014a1dd024550865434e into e30b7debe551e58cc6a738f7d15a4bb75d9bb545 commit c4b5067b052527cefbfb014a1dd024550865434e Merge: 7244a5f 91d6065 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 04:36:25 2023 -0500 Merge branch 'adjust_adapt_until_sleep' of https://github.com/basnijholt/adaptive-lighting into adjust_adapt_until_sleep commit 7244a5f48374b9c0f54ee20af5b857e94faf03eb Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 04:36:14 2023 -0500 Update const.py commit 91d606586fd48bb9d27025f7f84e1aac50b9a926 Author: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Date: Mon Apr 10 09:28:58 2023 +0000 Update README.md, strings.json, and services.yaml commit 4509c0a0f1b809d5821d003c1f336afd395e7837 Merge: e30b7de e46d867 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 09:27:02 2023 +0000 Merge e46d867854ad0ebe000868f4e82be03111104d7a into e30b7debe551e58cc6a738f7d15a4bb75d9bb545 commit e46d867854ad0ebe000868f4e82be03111104d7a Merge: e7e266b 3b61f49 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 04:26:56 2023 -0500 Merge branch 'adjust_adapt_until_sleep' of https://github.com/basnijholt/adaptive-lighting into adjust_adapt_until_sleep commit e7e266b5a19385cee711ff6ed920addf6eefb6d7 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 04:26:47 2023 -0500 Update const.py commit 3b61f49fb395343788530f95bf1bd4fe0cce85ee Author: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Date: Mon Apr 10 09:26:09 2023 +0000 Update README.md, strings.json, and services.yaml commit 7f952e06585b62d1d3ca770a0cae3f85a5b0f8e8 Merge: e30b7de a4d5f86 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 09:24:27 2023 +0000 Merge a4d5f861ff2e0cadcfc33bef1a78dc3c840cdbcc into e30b7debe551e58cc6a738f7d15a4bb75d9bb545 commit a4d5f861ff2e0cadcfc33bef1a78dc3c840cdbcc Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 04:24:20 2023 -0500 autofill workaround commit 06dd2a5c9a9d5ca983996c32123864b3ca6be41c Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 04:23:01 2023 -0500 Revert "Merge branch 'adjust_adapt_until_sleep' of https://github.com/basnijholt/adaptive-lighting into adjust_adapt_until_sleep" This reverts commit bca9f1bd3d9428e09c5695082059e493e7085c35, reversing changes made to 840aab6158229875e04911de4a45549ad244074e. commit bca9f1bd3d9428e09c5695082059e493e7085c35 Merge: 840aab6 2d74a31 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 04:22:19 2023 -0500 Merge branch 'adjust_adapt_until_sleep' of https://github.com/basnijholt/adaptive-lighting into adjust_adapt_until_sleep commit 840aab6158229875e04911de4a45549ad244074e Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 04:22:07 2023 -0500 add `adapt_color_temp_until_sleep` supports backward-compatibility commit 2d74a313bb7b6ae7d5c6eb8fb2191db0c44c69db Author: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Date: Mon Apr 10 09:14:31 2023 +0000 Update README.md, strings.json, and services.yaml commit 553265a1e8cab8ab38bba57e926edd033e21f0cd Merge: e30b7de b53a5af Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 09:12:53 2023 +0000 Merge b53a5aff68f06501c41f64070e2cc9f327f250c2 into e30b7debe551e58cc6a738f7d15a4bb75d9bb545 commit b53a5aff68f06501c41f64070e2cc9f327f250c2 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 04:11:48 2023 -0500 add new config option commit 4e1c769feb0a78188ed2dc49143147f634ad0a94 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 04:06:09 2023 -0500 initial commit
2023-04-11 19:10:37 -05:00
"transitioning color temperature to these values after sunset. 🌙"
)
Squashed commit of the following: commit 5b927dbb020443b7272f7353fd056d512afe61a4 Merge: 78395ee a888afd Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 12:52:46 2023 -0500 Merge branch 'main' into adjust_adapt_until_sleep commit 78395eea6503bad462ab38826882e480199bcdef Author: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Date: Mon Apr 10 09:38:11 2023 +0000 Update README.md, strings.json, and services.yaml commit bc39f5e977b12faf03e6403fb476a396635300d4 Merge: e30b7de c4b5067 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 09:36:39 2023 +0000 Merge c4b5067b052527cefbfb014a1dd024550865434e into e30b7debe551e58cc6a738f7d15a4bb75d9bb545 commit c4b5067b052527cefbfb014a1dd024550865434e Merge: 7244a5f 91d6065 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 04:36:25 2023 -0500 Merge branch 'adjust_adapt_until_sleep' of https://github.com/basnijholt/adaptive-lighting into adjust_adapt_until_sleep commit 7244a5f48374b9c0f54ee20af5b857e94faf03eb Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 04:36:14 2023 -0500 Update const.py commit 91d606586fd48bb9d27025f7f84e1aac50b9a926 Author: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Date: Mon Apr 10 09:28:58 2023 +0000 Update README.md, strings.json, and services.yaml commit 4509c0a0f1b809d5821d003c1f336afd395e7837 Merge: e30b7de e46d867 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 09:27:02 2023 +0000 Merge e46d867854ad0ebe000868f4e82be03111104d7a into e30b7debe551e58cc6a738f7d15a4bb75d9bb545 commit e46d867854ad0ebe000868f4e82be03111104d7a Merge: e7e266b 3b61f49 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 04:26:56 2023 -0500 Merge branch 'adjust_adapt_until_sleep' of https://github.com/basnijholt/adaptive-lighting into adjust_adapt_until_sleep commit e7e266b5a19385cee711ff6ed920addf6eefb6d7 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 04:26:47 2023 -0500 Update const.py commit 3b61f49fb395343788530f95bf1bd4fe0cce85ee Author: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Date: Mon Apr 10 09:26:09 2023 +0000 Update README.md, strings.json, and services.yaml commit 7f952e06585b62d1d3ca770a0cae3f85a5b0f8e8 Merge: e30b7de a4d5f86 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 09:24:27 2023 +0000 Merge a4d5f861ff2e0cadcfc33bef1a78dc3c840cdbcc into e30b7debe551e58cc6a738f7d15a4bb75d9bb545 commit a4d5f861ff2e0cadcfc33bef1a78dc3c840cdbcc Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 04:24:20 2023 -0500 autofill workaround commit 06dd2a5c9a9d5ca983996c32123864b3ca6be41c Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 04:23:01 2023 -0500 Revert "Merge branch 'adjust_adapt_until_sleep' of https://github.com/basnijholt/adaptive-lighting into adjust_adapt_until_sleep" This reverts commit bca9f1bd3d9428e09c5695082059e493e7085c35, reversing changes made to 840aab6158229875e04911de4a45549ad244074e. commit bca9f1bd3d9428e09c5695082059e493e7085c35 Merge: 840aab6 2d74a31 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 04:22:19 2023 -0500 Merge branch 'adjust_adapt_until_sleep' of https://github.com/basnijholt/adaptive-lighting into adjust_adapt_until_sleep commit 840aab6158229875e04911de4a45549ad244074e Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 04:22:07 2023 -0500 add `adapt_color_temp_until_sleep` supports backward-compatibility commit 2d74a313bb7b6ae7d5c6eb8fb2191db0c44c69db Author: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Date: Mon Apr 10 09:14:31 2023 +0000 Update README.md, strings.json, and services.yaml commit 553265a1e8cab8ab38bba57e926edd033e21f0cd Merge: e30b7de b53a5af Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 09:12:53 2023 +0000 Merge b53a5aff68f06501c41f64070e2cc9f327f250c2 into e30b7debe551e58cc6a738f7d15a4bb75d9bb545 commit b53a5aff68f06501c41f64070e2cc9f327f250c2 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 04:11:48 2023 -0500 add new config option commit 4e1c769feb0a78188ed2dc49143147f634ad0a94 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 04:06:09 2023 -0500 initial commit
2023-04-11 19:10:37 -05:00
CONF_ADAPT_COLOR_TEMP_UNTIL_SLEEP, DEFAULT_ADAPT_COLOR_TEMP_UNTIL_SLEEP = (
"adapt_color_temp_until_sleep",
True,
)
DOCS[
CONF_ADAPT_COLOR_TEMP_UNTIL_SLEEP
] = "Only active when `transition_until_sleep` is true."
CONF_ADAPT_BRIGHTNESS_UNTIL_SLEEP, DEFAULT_ADAPT_BRIGHTNESS_UNTIL_SLEEP = (
"adapt_brightness_until_sleep",
False,
)
DOCS[
CONF_ADAPT_BRIGHTNESS_UNTIL_SLEEP
] = "Only active when `transition_until_sleep` is true."
CONF_ADAPT_DELAY, DEFAULT_ADAPT_DELAY = "adapt_delay", 0
DOCS[CONF_ADAPT_DELAY] = (
"Wait time (seconds) between light turn on and Adaptive Lighting applying "
"changes. Might help to avoid flickering. ⏲️"
)
CONF_SEND_SPLIT_DELAY, DEFAULT_SEND_SPLIT_DELAY = "send_split_delay", 0
DOCS[CONF_SEND_SPLIT_DELAY] = (
"Delay (ms) between `separate_turn_on_commands` for lights that don't support "
"simultaneous brightness and color setting. ⏲️"
)
CONF_AUTORESET_CONTROL, DEFAULT_AUTORESET_CONTROL = "autoreset_control_seconds", 0
DOCS[CONF_AUTORESET_CONTROL] = (
"Automatically reset the manual control after a number of seconds. "
"Set to 0 to disable. ⏲️"
)
Squashed commit of the following: commit 7069d693b86cf6db76a04332a8220ad4c8f54c49 Merge: adde5b5 a888afd Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 12:52:19 2023 -0500 Merge branch 'main' into add-watched-lights commit adde5b56459be048dde50ad1191453692af72ac4 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 10:34:24 2023 -0500 fix pytest commit 2c5eaec2d3abad432292502f9b9b5ef0e5c74956 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 07:27:25 2023 -0500 Revert "Update const.py" This reverts commit e773af07ca2bf733619721286cdbd16a1f3eec56. commit e773af07ca2bf733619721286cdbd16a1f3eec56 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 07:20:23 2023 -0500 Update const.py commit c167f59ccdd342e7e29b9571a3f440d2c4851b97 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 06:09:14 2023 -0500 Update docs commit 6220df57d1c5f682b3eff4db41749d82d9639904 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 05:59:26 2023 -0500 fix the test commit ff292c2c1bf500a0d864c8e469e0ab9d41f9ef19 Merge: 4fdf42b 19d4468 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 05:39:17 2023 -0500 Merge branch 'add-watched-lights' of https://github.com/basnijholt/adaptive-lighting into add-watched-lights commit 4fdf42bea142d65c776f08497124ac8eeaf0888e Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 05:39:05 2023 -0500 small fixes commit 19d4468f63ca2585d1c0a1c62943ed81b5f41913 Author: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Date: Mon Apr 10 10:36:54 2023 +0000 Update README.md, strings.json, and services.yaml commit 70c90181f0fd9caf2cf49e13acbe850db3d143bb Merge: e30b7de b6a9265 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 10:34:49 2023 +0000 Merge b6a92650a9acdc46774297d0de040f9528711c32 into e30b7debe551e58cc6a738f7d15a4bb75d9bb545 commit b6a92650a9acdc46774297d0de040f9528711c32 Merge: 784eed0 ae04ab4 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 05:34:43 2023 -0500 Merge branch 'add-watched-lights' of https://github.com/basnijholt/adaptive-lighting into add-watched-lights commit 784eed09b31b891763c792df97dd630151ae4371 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 05:34:33 2023 -0500 squash merge `alt_detect_method` again commit ae04ab49a8cf8a34e2381728d60b405d7cf3a562 Author: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Date: Mon Apr 10 10:34:12 2023 +0000 Update README.md, strings.json, and services.yaml commit cfbd65f976177485b13f82ef043d95db53bfd34d Merge: e30b7de 3c5ea73 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 10:32:34 2023 +0000 Merge 3c5ea73341389e086be8f5f481beb255695cd378 into e30b7debe551e58cc6a738f7d15a4bb75d9bb545 commit 3c5ea73341389e086be8f5f481beb255695cd378 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 05:32:27 2023 -0500 Update switch.py commit 2f750694d9f73e923eb6f1dfa14b510a0df56eb0 Merge: 429251b 7a9dc8f Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 05:31:13 2023 -0500 Merge branch 'add-watched-lights' of https://github.com/basnijholt/adaptive-lighting into add-watched-lights commit 429251b45f219a856fd31e856a3b8e5fe25f0f9c Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 05:31:04 2023 -0500 update docs commit 7a9dc8f24a0edabbcf19f5a3898e9c3ebf28652f Author: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Date: Mon Apr 10 10:29:37 2023 +0000 Update README.md, strings.json, and services.yaml commit 37de4244b148a14bb04913b7fcd5eee45bf41b62 Merge: e30b7de d52ea53 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 10:28:01 2023 +0000 Merge d52ea53dcce038cf19a782dbd0b1c2de0e0dc1c9 into e30b7debe551e58cc6a738f7d15a4bb75d9bb545 commit d52ea53dcce038cf19a782dbd0b1c2de0e0dc1c9 Merge: dbc47c8 e30b7de Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 05:27:43 2023 -0500 Merge branch 'main' into add-watched-lights commit dbc47c8a3693eb73de618f5396eee02fb42008b9 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 05:26:11 2023 -0500 Update switch.py commit 2db675a434567c535160929dbbc9a0a57bdd8354 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 05:25:44 2023 -0500 merge with `alt_detect_method` required for this PR commit dced97b5ca40ec159f40ca63764f1f0f47e12359 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 05:21:51 2023 -0500 merge with `origin\main`
2023-04-11 19:08:49 -05:00
CONF_WATCHED_LIGHTS, DEFAULT_WATCHED_LIGHTS = "watched_lights", {}
DOCS[CONF_WATCHED_LIGHTS] = (
"Use this dictionary of lights to check for manually controlled events"
" in addition to the main lights 🌟"
" Requires `alt_detect_method` to be True."
" Example: `watched_lights: {light.watch_light: light.main_light}` will fire"
" manually controlled events to `light.main_light`"
)
2020-10-20 00:06:10 +02:00
SLEEP_MODE_SWITCH = "sleep_mode_switch"
ADAPT_COLOR_SWITCH = "adapt_color_switch"
ADAPT_BRIGHTNESS_SWITCH = "adapt_brightness_switch"
2020-09-28 13:10:41 +02:00
ATTR_TURN_ON_OFF_LISTENER = "turn_on_off_listener"
UNDO_UPDATE_LISTENER = "undo_update_listener"
2020-09-28 13:10:41 +02:00
NONE_STR = "None"
ATTR_ADAPT_COLOR = "adapt_color"
DOCS[ATTR_ADAPT_COLOR] = "Whether to adapt the color on supporting lights. 🌈"
ATTR_ADAPT_BRIGHTNESS = "adapt_brightness"
DOCS[ATTR_ADAPT_BRIGHTNESS] = "Whether to adapt the brightness of the light. 🌞"
2020-09-23 12:35:57 +02:00
SERVICE_SET_MANUAL_CONTROL = "set_manual_control"
CONF_MANUAL_CONTROL = "manual_control"
DOCS[CONF_MANUAL_CONTROL] = "Whether to manually control the lights. 🔒"
2020-09-25 16:45:10 +02:00
SERVICE_APPLY = "apply"
2020-09-29 23:39:46 +02:00
CONF_TURN_ON_LIGHTS = "turn_on_lights"
DOCS[CONF_TURN_ON_LIGHTS] = "Whether to turn on lights that are currently off. 🔆"
SERVICE_CHANGE_SWITCH_SETTINGS = "change_switch_settings"
CONF_USE_DEFAULTS = "use_defaults"
DOCS[CONF_USE_DEFAULTS] = (
2023-04-11 19:16:56 -05:00
"Where to autofill config options that are not passed to this service. Options: "
'"current" (default, retains current values), "factory" (resets to '
2023-04-11 19:16:56 -05:00
'documented defaults), or "configuration" (reverts to original user config). ⚙️'
)
CONF_WHICH_SWITCH, DEFAULT_WHICH_SWITCH = "switch_type", "main"
DOCS[CONF_WHICH_SWITCH] = (
"Which switch to target in this service call. Options: "
'"main" (default, targets the main switch), "sleep", "brightness", "color"'
)
DOCS[
SERVICE_TURN_ON
] = "Turn on an Adaptive Lighting main/sleep/brightness/color switch"
DOCS[
SERVICE_TURN_OFF
] = "Turn off an Adaptive Lighting main/sleep/brightness/color switch"
DOCS[SERVICE_TOGGLE] = "Toggle an Adaptive Lighting main/sleep/brightness/color switch"
TURNING_OFF_DELAY = 5
DOCS_MANUAL_CONTROL = {
CONF_ENTITY_ID: "The `entity_id` of the switch in which to (un)mark the "
"light as being `manually controlled`. 📝",
CONF_LIGHTS: "entity_id(s) of lights, if not specified, all lights in the "
"switch are selected. 💡",
CONF_MANUAL_CONTROL: 'Whether to add ("true") or remove ("false") the '
'light from the "manual_control" list. 🔒',
}
DOCS_APPLY = {
CONF_ENTITY_ID: "The `entity_id` of the switch with the settings to apply. 📝",
CONF_LIGHTS: "A light (or list of lights) to apply the settings to. 💡",
}
2020-09-23 18:20:25 +02:00
2020-09-27 16:21:42 +02:00
def int_between(min_int, max_int):
"""Return an integer between 'min_int' and 'max_int'."""
return vol.All(vol.Coerce(int), vol.Range(min=min_int, max=max_int))
2020-09-23 18:20:25 +02:00
VALIDATION_TUPLES = [
(CONF_LIGHTS, DEFAULT_LIGHTS, cv.entity_ids),
Squashed commit of the following: commit 7069d693b86cf6db76a04332a8220ad4c8f54c49 Merge: adde5b5 a888afd Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 12:52:19 2023 -0500 Merge branch 'main' into add-watched-lights commit adde5b56459be048dde50ad1191453692af72ac4 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 10:34:24 2023 -0500 fix pytest commit 2c5eaec2d3abad432292502f9b9b5ef0e5c74956 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 07:27:25 2023 -0500 Revert "Update const.py" This reverts commit e773af07ca2bf733619721286cdbd16a1f3eec56. commit e773af07ca2bf733619721286cdbd16a1f3eec56 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 07:20:23 2023 -0500 Update const.py commit c167f59ccdd342e7e29b9571a3f440d2c4851b97 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 06:09:14 2023 -0500 Update docs commit 6220df57d1c5f682b3eff4db41749d82d9639904 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 05:59:26 2023 -0500 fix the test commit ff292c2c1bf500a0d864c8e469e0ab9d41f9ef19 Merge: 4fdf42b 19d4468 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 05:39:17 2023 -0500 Merge branch 'add-watched-lights' of https://github.com/basnijholt/adaptive-lighting into add-watched-lights commit 4fdf42bea142d65c776f08497124ac8eeaf0888e Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 05:39:05 2023 -0500 small fixes commit 19d4468f63ca2585d1c0a1c62943ed81b5f41913 Author: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Date: Mon Apr 10 10:36:54 2023 +0000 Update README.md, strings.json, and services.yaml commit 70c90181f0fd9caf2cf49e13acbe850db3d143bb Merge: e30b7de b6a9265 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 10:34:49 2023 +0000 Merge b6a92650a9acdc46774297d0de040f9528711c32 into e30b7debe551e58cc6a738f7d15a4bb75d9bb545 commit b6a92650a9acdc46774297d0de040f9528711c32 Merge: 784eed0 ae04ab4 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 05:34:43 2023 -0500 Merge branch 'add-watched-lights' of https://github.com/basnijholt/adaptive-lighting into add-watched-lights commit 784eed09b31b891763c792df97dd630151ae4371 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 05:34:33 2023 -0500 squash merge `alt_detect_method` again commit ae04ab49a8cf8a34e2381728d60b405d7cf3a562 Author: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Date: Mon Apr 10 10:34:12 2023 +0000 Update README.md, strings.json, and services.yaml commit cfbd65f976177485b13f82ef043d95db53bfd34d Merge: e30b7de 3c5ea73 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 10:32:34 2023 +0000 Merge 3c5ea73341389e086be8f5f481beb255695cd378 into e30b7debe551e58cc6a738f7d15a4bb75d9bb545 commit 3c5ea73341389e086be8f5f481beb255695cd378 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 05:32:27 2023 -0500 Update switch.py commit 2f750694d9f73e923eb6f1dfa14b510a0df56eb0 Merge: 429251b 7a9dc8f Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 05:31:13 2023 -0500 Merge branch 'add-watched-lights' of https://github.com/basnijholt/adaptive-lighting into add-watched-lights commit 429251b45f219a856fd31e856a3b8e5fe25f0f9c Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 05:31:04 2023 -0500 update docs commit 7a9dc8f24a0edabbcf19f5a3898e9c3ebf28652f Author: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Date: Mon Apr 10 10:29:37 2023 +0000 Update README.md, strings.json, and services.yaml commit 37de4244b148a14bb04913b7fcd5eee45bf41b62 Merge: e30b7de d52ea53 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 10:28:01 2023 +0000 Merge d52ea53dcce038cf19a782dbd0b1c2de0e0dc1c9 into e30b7debe551e58cc6a738f7d15a4bb75d9bb545 commit d52ea53dcce038cf19a782dbd0b1c2de0e0dc1c9 Merge: dbc47c8 e30b7de Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 05:27:43 2023 -0500 Merge branch 'main' into add-watched-lights commit dbc47c8a3693eb73de618f5396eee02fb42008b9 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 05:26:11 2023 -0500 Update switch.py commit 2db675a434567c535160929dbbc9a0a57bdd8354 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 05:25:44 2023 -0500 merge with `alt_detect_method` required for this PR commit dced97b5ca40ec159f40ca63764f1f0f47e12359 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 05:21:51 2023 -0500 merge with `origin\main`
2023-04-11 19:08:49 -05:00
(CONF_WATCHED_LIGHTS, DEFAULT_WATCHED_LIGHTS, dict),
2020-10-09 15:13:09 +02:00
(CONF_PREFER_RGB_COLOR, DEFAULT_PREFER_RGB_COLOR, bool),
(CONF_INCLUDE_CONFIG_IN_ATTRIBUTES, DEFAULT_INCLUDE_CONFIG_IN_ATTRIBUTES, bool),
2020-09-23 18:20:25 +02:00
(CONF_INITIAL_TRANSITION, DEFAULT_INITIAL_TRANSITION, VALID_TRANSITION),
(CONF_SLEEP_TRANSITION, DEFAULT_SLEEP_TRANSITION, VALID_TRANSITION),
2020-10-04 15:12:14 +02:00
(CONF_TRANSITION, DEFAULT_TRANSITION, VALID_TRANSITION),
(CONF_ADAPT_UNTIL_SLEEP, DEFAULT_ADAPT_UNTIL_SLEEP, bool),
Squashed commit of the following: commit 5b927dbb020443b7272f7353fd056d512afe61a4 Merge: 78395ee a888afd Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 12:52:46 2023 -0500 Merge branch 'main' into adjust_adapt_until_sleep commit 78395eea6503bad462ab38826882e480199bcdef Author: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Date: Mon Apr 10 09:38:11 2023 +0000 Update README.md, strings.json, and services.yaml commit bc39f5e977b12faf03e6403fb476a396635300d4 Merge: e30b7de c4b5067 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 09:36:39 2023 +0000 Merge c4b5067b052527cefbfb014a1dd024550865434e into e30b7debe551e58cc6a738f7d15a4bb75d9bb545 commit c4b5067b052527cefbfb014a1dd024550865434e Merge: 7244a5f 91d6065 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 04:36:25 2023 -0500 Merge branch 'adjust_adapt_until_sleep' of https://github.com/basnijholt/adaptive-lighting into adjust_adapt_until_sleep commit 7244a5f48374b9c0f54ee20af5b857e94faf03eb Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 04:36:14 2023 -0500 Update const.py commit 91d606586fd48bb9d27025f7f84e1aac50b9a926 Author: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Date: Mon Apr 10 09:28:58 2023 +0000 Update README.md, strings.json, and services.yaml commit 4509c0a0f1b809d5821d003c1f336afd395e7837 Merge: e30b7de e46d867 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 09:27:02 2023 +0000 Merge e46d867854ad0ebe000868f4e82be03111104d7a into e30b7debe551e58cc6a738f7d15a4bb75d9bb545 commit e46d867854ad0ebe000868f4e82be03111104d7a Merge: e7e266b 3b61f49 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 04:26:56 2023 -0500 Merge branch 'adjust_adapt_until_sleep' of https://github.com/basnijholt/adaptive-lighting into adjust_adapt_until_sleep commit e7e266b5a19385cee711ff6ed920addf6eefb6d7 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 04:26:47 2023 -0500 Update const.py commit 3b61f49fb395343788530f95bf1bd4fe0cce85ee Author: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Date: Mon Apr 10 09:26:09 2023 +0000 Update README.md, strings.json, and services.yaml commit 7f952e06585b62d1d3ca770a0cae3f85a5b0f8e8 Merge: e30b7de a4d5f86 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 09:24:27 2023 +0000 Merge a4d5f861ff2e0cadcfc33bef1a78dc3c840cdbcc into e30b7debe551e58cc6a738f7d15a4bb75d9bb545 commit a4d5f861ff2e0cadcfc33bef1a78dc3c840cdbcc Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 04:24:20 2023 -0500 autofill workaround commit 06dd2a5c9a9d5ca983996c32123864b3ca6be41c Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 04:23:01 2023 -0500 Revert "Merge branch 'adjust_adapt_until_sleep' of https://github.com/basnijholt/adaptive-lighting into adjust_adapt_until_sleep" This reverts commit bca9f1bd3d9428e09c5695082059e493e7085c35, reversing changes made to 840aab6158229875e04911de4a45549ad244074e. commit bca9f1bd3d9428e09c5695082059e493e7085c35 Merge: 840aab6 2d74a31 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 04:22:19 2023 -0500 Merge branch 'adjust_adapt_until_sleep' of https://github.com/basnijholt/adaptive-lighting into adjust_adapt_until_sleep commit 840aab6158229875e04911de4a45549ad244074e Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 04:22:07 2023 -0500 add `adapt_color_temp_until_sleep` supports backward-compatibility commit 2d74a313bb7b6ae7d5c6eb8fb2191db0c44c69db Author: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Date: Mon Apr 10 09:14:31 2023 +0000 Update README.md, strings.json, and services.yaml commit 553265a1e8cab8ab38bba57e926edd033e21f0cd Merge: e30b7de b53a5af Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 09:12:53 2023 +0000 Merge b53a5aff68f06501c41f64070e2cc9f327f250c2 into e30b7debe551e58cc6a738f7d15a4bb75d9bb545 commit b53a5aff68f06501c41f64070e2cc9f327f250c2 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 04:11:48 2023 -0500 add new config option commit 4e1c769feb0a78188ed2dc49143147f634ad0a94 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 04:06:09 2023 -0500 initial commit
2023-04-11 19:10:37 -05:00
(CONF_ADAPT_BRIGHTNESS_UNTIL_SLEEP, DEFAULT_ADAPT_BRIGHTNESS_UNTIL_SLEEP, bool),
(CONF_ADAPT_COLOR_TEMP_UNTIL_SLEEP, DEFAULT_ADAPT_COLOR_TEMP_UNTIL_SLEEP, bool),
2020-09-23 18:20:25 +02:00
(CONF_INTERVAL, DEFAULT_INTERVAL, cv.positive_int),
(CONF_MIN_BRIGHTNESS, DEFAULT_MIN_BRIGHTNESS, int_between(1, 100)),
2020-10-05 14:41:21 +02:00
(CONF_MAX_BRIGHTNESS, DEFAULT_MAX_BRIGHTNESS, int_between(1, 100)),
2020-09-23 18:20:25 +02:00
(CONF_MIN_COLOR_TEMP, DEFAULT_MIN_COLOR_TEMP, int_between(1000, 10000)),
2020-10-05 14:41:21 +02:00
(CONF_MAX_COLOR_TEMP, DEFAULT_MAX_COLOR_TEMP, int_between(1000, 10000)),
2020-09-23 18:20:25 +02:00
(CONF_SLEEP_BRIGHTNESS, DEFAULT_SLEEP_BRIGHTNESS, int_between(1, 100)),
(
CONF_SLEEP_RGB_OR_COLOR_TEMP,
DEFAULT_SLEEP_RGB_OR_COLOR_TEMP,
selector.SelectSelector(
selector.SelectSelectorConfig(
2022-08-31 22:44:07 -07:00
options=["color_temp", "rgb_color"],
multiple=False,
mode=selector.SelectSelectorMode.DROPDOWN,
),
2022-08-31 22:44:07 -07:00
),
),
2022-08-31 22:54:37 -07:00
(CONF_SLEEP_COLOR_TEMP, DEFAULT_SLEEP_COLOR_TEMP, int_between(1000, 10000)),
(
CONF_SLEEP_RGB_COLOR,
DEFAULT_SLEEP_RGB_COLOR,
selector.ColorRGBSelector(selector.ColorRGBSelectorConfig()),
),
2020-09-24 23:54:14 +02:00
(CONF_SUNRISE_TIME, NONE_STR, str),
(CONF_MAX_SUNRISE_TIME, NONE_STR, str),
2020-10-05 14:41:21 +02:00
(CONF_SUNRISE_OFFSET, DEFAULT_SUNRISE_OFFSET, int),
2020-09-24 23:54:14 +02:00
(CONF_SUNSET_TIME, NONE_STR, str),
(CONF_MIN_SUNSET_TIME, NONE_STR, str),
2020-10-05 14:41:21 +02:00
(CONF_SUNSET_OFFSET, DEFAULT_SUNSET_OFFSET, int),
(CONF_ONLY_ONCE, DEFAULT_ONLY_ONCE, bool),
(CONF_FLAT_LIMITS, DEFAULT_FLAT_LIMITS, bool),
(CONF_TAKE_OVER_CONTROL, DEFAULT_TAKE_OVER_CONTROL, bool),
Squashed commit of the following: commit 7069d693b86cf6db76a04332a8220ad4c8f54c49 Merge: adde5b5 a888afd Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 12:52:19 2023 -0500 Merge branch 'main' into add-watched-lights commit adde5b56459be048dde50ad1191453692af72ac4 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 10:34:24 2023 -0500 fix pytest commit 2c5eaec2d3abad432292502f9b9b5ef0e5c74956 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 07:27:25 2023 -0500 Revert "Update const.py" This reverts commit e773af07ca2bf733619721286cdbd16a1f3eec56. commit e773af07ca2bf733619721286cdbd16a1f3eec56 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 07:20:23 2023 -0500 Update const.py commit c167f59ccdd342e7e29b9571a3f440d2c4851b97 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 06:09:14 2023 -0500 Update docs commit 6220df57d1c5f682b3eff4db41749d82d9639904 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 05:59:26 2023 -0500 fix the test commit ff292c2c1bf500a0d864c8e469e0ab9d41f9ef19 Merge: 4fdf42b 19d4468 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 05:39:17 2023 -0500 Merge branch 'add-watched-lights' of https://github.com/basnijholt/adaptive-lighting into add-watched-lights commit 4fdf42bea142d65c776f08497124ac8eeaf0888e Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 05:39:05 2023 -0500 small fixes commit 19d4468f63ca2585d1c0a1c62943ed81b5f41913 Author: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Date: Mon Apr 10 10:36:54 2023 +0000 Update README.md, strings.json, and services.yaml commit 70c90181f0fd9caf2cf49e13acbe850db3d143bb Merge: e30b7de b6a9265 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 10:34:49 2023 +0000 Merge b6a92650a9acdc46774297d0de040f9528711c32 into e30b7debe551e58cc6a738f7d15a4bb75d9bb545 commit b6a92650a9acdc46774297d0de040f9528711c32 Merge: 784eed0 ae04ab4 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 05:34:43 2023 -0500 Merge branch 'add-watched-lights' of https://github.com/basnijholt/adaptive-lighting into add-watched-lights commit 784eed09b31b891763c792df97dd630151ae4371 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 05:34:33 2023 -0500 squash merge `alt_detect_method` again commit ae04ab49a8cf8a34e2381728d60b405d7cf3a562 Author: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Date: Mon Apr 10 10:34:12 2023 +0000 Update README.md, strings.json, and services.yaml commit cfbd65f976177485b13f82ef043d95db53bfd34d Merge: e30b7de 3c5ea73 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 10:32:34 2023 +0000 Merge 3c5ea73341389e086be8f5f481beb255695cd378 into e30b7debe551e58cc6a738f7d15a4bb75d9bb545 commit 3c5ea73341389e086be8f5f481beb255695cd378 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 05:32:27 2023 -0500 Update switch.py commit 2f750694d9f73e923eb6f1dfa14b510a0df56eb0 Merge: 429251b 7a9dc8f Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 05:31:13 2023 -0500 Merge branch 'add-watched-lights' of https://github.com/basnijholt/adaptive-lighting into add-watched-lights commit 429251b45f219a856fd31e856a3b8e5fe25f0f9c Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 05:31:04 2023 -0500 update docs commit 7a9dc8f24a0edabbcf19f5a3898e9c3ebf28652f Author: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Date: Mon Apr 10 10:29:37 2023 +0000 Update README.md, strings.json, and services.yaml commit 37de4244b148a14bb04913b7fcd5eee45bf41b62 Merge: e30b7de d52ea53 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 10:28:01 2023 +0000 Merge d52ea53dcce038cf19a782dbd0b1c2de0e0dc1c9 into e30b7debe551e58cc6a738f7d15a4bb75d9bb545 commit d52ea53dcce038cf19a782dbd0b1c2de0e0dc1c9 Merge: dbc47c8 e30b7de Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 05:27:43 2023 -0500 Merge branch 'main' into add-watched-lights commit dbc47c8a3693eb73de618f5396eee02fb42008b9 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 05:26:11 2023 -0500 Update switch.py commit 2db675a434567c535160929dbbc9a0a57bdd8354 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 05:25:44 2023 -0500 merge with `alt_detect_method` required for this PR commit dced97b5ca40ec159f40ca63764f1f0f47e12359 Author: Benjamin Auquite <halomastar@gmail.com> Date: Mon Apr 10 05:21:51 2023 -0500 merge with `origin\main`
2023-04-11 19:08:49 -05:00
(CONF_ALT_DETECT_METHOD, DEFAULT_ALT_DETECT_METHOD, bool),
2020-10-04 15:12:14 +02:00
(CONF_DETECT_NON_HA_CHANGES, DEFAULT_DETECT_NON_HA_CHANGES, bool),
(CONF_SEPARATE_TURN_ON_COMMANDS, DEFAULT_SEPARATE_TURN_ON_COMMANDS, bool),
(CONF_SEND_SPLIT_DELAY, DEFAULT_SEND_SPLIT_DELAY, int_between(0, 10000)),
Feature requests: Switch now optional for service calls | New default icons | Reload `.yaml` w/o restart | `adapt_delay` ms (#459) * added #274 * attempt getSwitchFromLightId() * Update switch.py * changed from register_entity_service to hass.services.async_register * Update switch.py * Update switch.py * Update switch.py * Update switch.py * Update switch.py * Update switch.py * Update services.yaml * Update switch.py * test * test builds ready * target selector may not be possible with current syntax priority is backwards-compatibility as I know most people will smash that update button * expanded light groups * test builds ready * add feature #104 * Update custom_components/adaptive_lighting/switch.py Co-authored-by: Chris <firstof9@gmail.com> * Might as well type both. No reason not to. Co-authored-by: Chris <firstof9@gmail.com> * Might as well type both. No reason not to. Co-authored-by: Chris <firstof9@gmail.com> * Reformatted debug messages. Reimported ServiceCall as suggested * Multiple switches allowed again in services. Apparently this was possible before. With this change, the `lights` argument must not be passed with multiple switches, or the integration has no way of knowing what the user wants to do. Integration did not make this check in prior versions. Also reformatted the debug messages. Removed `automerge.yaml` (my apologies) * Reload config without restart. You can now reload any changes to the yaml file without restarting your home assistant. Should show a 'reload' button in your integrations page or you can call the homeassistant reload integration service call. See https://community.home-assistant.io/t/how-to-allow-custom-compontent-for-yaml-configuration-reloading/391190/4 * Use snake_case for function name 'parseServiceArgs' * Slight rephrase * Small style changes * Rephrased debug messages. Removed `integration_entities` as we rewrote the code from that function already in parse_service_args. Reference function now above parse_service_args. * removed: `these_switches = data = None` * Factor out _find_switch_with_lights * Rename function and add log statement * Remove pylint marker * Handle multiple switches found * Small changes * Rename _parse_service_args to _get_switches_from_service_call * Rephrase log messages * Add type hint --------- Co-authored-by: Chris <firstof9@gmail.com> Co-authored-by: Bas Nijholt <bas@nijho.lt>
2023-03-25 22:22:05 -05:00
(CONF_ADAPT_DELAY, DEFAULT_ADAPT_DELAY, cv.positive_float),
(
CONF_AUTORESET_CONTROL,
DEFAULT_AUTORESET_CONTROL,
int_between(0, 365 * 24 * 60 * 60), # 1 year max
),
2020-09-23 12:35:57 +02:00
]
2020-09-23 18:20:25 +02:00
CONST_COLOR = "color"
2020-09-24 20:41:24 +02:00
def timedelta_as_int(value):
"""Convert a `datetime.timedelta` object to an integer.
This integer can be serialized to json but a timedelta cannot.
"""
2020-09-24 20:41:24 +02:00
return value.total_seconds()
2020-09-24 23:42:21 +02:00
# conf_option: (validator, coerce) tuples
# these validators cannot be serialized but can be serialized when coerced by coerce.
2020-09-24 20:41:24 +02:00
EXTRA_VALIDATION = {
CONF_INTERVAL: (cv.time_period, timedelta_as_int),
CONF_SUNRISE_OFFSET: (cv.time_period, timedelta_as_int),
CONF_SUNRISE_TIME: (cv.time, str),
CONF_MAX_SUNRISE_TIME: (cv.time, str),
2020-09-24 20:41:24 +02:00
CONF_SUNSET_OFFSET: (cv.time_period, timedelta_as_int),
CONF_SUNSET_TIME: (cv.time, str),
CONF_MIN_SUNSET_TIME: (cv.time, str),
2020-09-23 18:20:25 +02:00
}
2020-09-25 10:33:49 +02:00
def maybe_coerce(key, validation):
"""Coerce the validation into a json serializable type."""
2020-09-24 23:42:21 +02:00
validation, coerce = EXTRA_VALIDATION.get(key, (validation, None))
if coerce is not None:
return vol.All(validation, vol.Coerce(coerce))
return validation
2020-09-24 20:41:24 +02:00
2020-09-23 18:20:25 +02:00
def replace_none_str(value, replace_with=None):
"""Replace "None" -> replace_with."""
2020-09-25 10:49:58 +02:00
return value if value != NONE_STR else replace_with
2020-09-23 18:20:25 +02:00
2020-09-24 23:42:21 +02:00
2020-09-26 13:05:27 +02:00
_yaml_validation_tuples = [
2020-09-25 10:33:49 +02:00
(key, default, maybe_coerce(key, validation))
2020-09-24 23:42:21 +02:00
for key, default, validation in VALIDATION_TUPLES
] + [(CONF_NAME, DEFAULT_NAME, cv.string)]
_DOMAIN_SCHEMA = vol.Schema(
{
vol.Optional(key, default=replace_none_str(default, vol.UNDEFINED)): validation
2020-09-26 13:05:27 +02:00
for key, default, validation in _yaml_validation_tuples
2020-09-23 18:20:25 +02:00
}
2020-09-24 23:42:21 +02:00
)
2023-04-11 19:16:56 -05:00
SCHEMA_APPLY = vol.Schema(
{
vol.Optional(CONF_ENTITY_ID): cv.entity_ids,
vol.Optional(CONF_LIGHTS, default=[]): cv.entity_ids,
vol.Optional(CONF_TRANSITION): VALID_TRANSITION,
vol.Optional(ATTR_ADAPT_BRIGHTNESS, default=True): cv.boolean,
vol.Optional(ATTR_ADAPT_COLOR, default=True): cv.boolean,
vol.Optional(CONF_PREFER_RGB_COLOR, default=False): cv.boolean,
vol.Optional(CONF_TURN_ON_LIGHTS, default=False): cv.boolean,
}
)
2023-04-11 19:16:56 -05:00
SCHEMA_SERVICE_TOGGLE = vol.Schema(
{
vol.Optional(CONF_ENTITY_ID): cv.entity_ids,
vol.Optional(CONF_LIGHTS, default=[]): cv.entity_ids,
vol.Optional(CONF_WHICH_SWITCH): cv.string,
}
)
2023-04-11 19:16:56 -05:00
SCHEMA_SET_MANUAL_CONTROL = vol.Schema(
{
vol.Optional(CONF_ENTITY_ID): cv.entity_ids,
vol.Optional(CONF_LIGHTS, default=[]): cv.entity_ids,
vol.Optional(CONF_MANUAL_CONTROL, default=True): cv.boolean,
}
)
2023-04-11 19:16:56 -05:00
SCHEMA_CHANGE_SWITCH_SETTINGS = vol.Schema(
{
vol.Optional(CONF_USE_DEFAULTS): cv.string,
vol.Optional(CONF_ENTITY_ID): cv.entity_ids,
vol.Required(CONF_LIGHTS, default=[]): [],
**{
vol.Optional(k): valid
for k, _, valid in VALIDATION_TUPLES
if k not in [CONF_INTERVAL, CONF_NAME, CONF_LIGHTS]
},
}
)