From b730c7cc9009be3b7a9a187e15286dcb4d06c6ef Mon Sep 17 00:00:00 2001 From: Bas Nijholt Date: Mon, 3 Apr 2023 14:59:14 -0700 Subject: [PATCH] Add scripts to auto update en.json, strings.json and services.yaml (#520) * Add scripts to auto update strings.json and services.yaml * Run services * simplify * Run strings * rerun * revert * allow unicode * Add CODEOWNERS * Update CODEOWNERS * set CONF_USE_DEFAULTS docs * add field_name * Auto run scripts * Update desc * Update README.md, strings.json, and services.yaml * double quotes * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update README.md, strings.json, and services.yaml * Add newline * sync changes between en.json and strings.json * Update README.md, strings.json, and services.yaml * double quotes * fix * Update README.md, strings.json, and services.yaml * Add comments * Remove comments * shorter * Update README.md, strings.json, and services.yaml * Rephrase * Update README.md, strings.json, and services.yaml * remove key from desc --------- Co-authored-by: Benjamin Auquite Co-authored-by: github-actions[bot] Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .github/update-services.py | 25 +++ .github/update-strings.py | 31 ++++ .github/workflows/update-readme.yml | 14 +- README.md | 14 +- custom_components/adaptive_lighting/const.py | 26 +-- .../adaptive_lighting/services.yaml | 169 +++++++++--------- .../adaptive_lighting/strings.json | 60 +++---- .../adaptive_lighting/translations/en.json | 58 +++--- 8 files changed, 231 insertions(+), 166 deletions(-) create mode 100644 .github/update-services.py create mode 100644 .github/update-strings.py mode change 100755 => 100644 custom_components/adaptive_lighting/services.yaml diff --git a/.github/update-services.py b/.github/update-services.py new file mode 100644 index 00000000..df4c7b30 --- /dev/null +++ b/.github/update-services.py @@ -0,0 +1,25 @@ +from pathlib import Path +import sys + +import yaml + +sys.path.append(str(Path(__file__).parent.parent)) + +from custom_components.adaptive_lighting import const # noqa: E402 + +services_filename = "custom_components/adaptive_lighting/services.yaml" +with open(services_filename) as f: + services = yaml.safe_load(f) + +for service_name, dct in services.items(): + _docs = {"set_manual_control": const.DOCS_MANUAL_CONTROL, "apply": const.DOCS_APPLY} + alternative_docs = _docs.get(service_name, const.DOCS) + for field_name, field in dct["fields"].items(): + description = alternative_docs.get(field_name, const.DOCS[field_name]) + field["description"] = description + +comment = "# This file is auto-generated by .github/update-services.py." + +with open(services_filename, "w") as f: + f.write(comment + "\n") + yaml.dump(services, f, sort_keys=False, width=1000, allow_unicode=True) diff --git a/.github/update-strings.py b/.github/update-strings.py new file mode 100644 index 00000000..aabc7443 --- /dev/null +++ b/.github/update-strings.py @@ -0,0 +1,31 @@ +import json +from pathlib import Path +import sys + +sys.path.append(str(Path(__file__).parent.parent)) + +from custom_components.adaptive_lighting import const # noqa: E402 + +strings_fname = "custom_components/adaptive_lighting/strings.json" +en_fname = "custom_components/adaptive_lighting/translations/en.json" +with open(strings_fname) as f: + strings = json.load(f) + +data = {k: f"{k}: {const.DOCS[k]}" for k, _, _ in const.VALIDATION_TUPLES} +strings["options"]["step"]["init"]["data"] = data + +with open(strings_fname, "w") as f: + json.dump(strings, f, indent=2, ensure_ascii=False) + f.write("\n") + + +# Sync changes from strings.json to en.json +with open(en_fname) as f: + en = json.load(f) + +en["config"]["step"]["user"] = strings["config"]["step"]["user"] +en["options"]["step"]["init"]["data"] = data + +with open(en_fname, "w") as f: + json.dump(en, f, indent=2, ensure_ascii=False) + f.write("\n") diff --git a/.github/workflows/update-readme.yml b/.github/workflows/update-readme.yml index bc31bb94..bec8cb4c 100644 --- a/.github/workflows/update-readme.yml +++ b/.github/workflows/update-readme.yml @@ -34,17 +34,23 @@ jobs: - name: Run markdown-code-runner run: markdown-code-runner --debug README.md - - name: Commit updated README.md + - name: Run update strings.json + run: python .github/update-strings.py + + - name: Run update services.yaml + run: python .github/update-services.py + + - name: Commit updated README.md, strings.json, and services.yaml id: commit run: | - git add README.md + git add -u . git config --local user.email "github-actions[bot]@users.noreply.github.com" git config --local user.name "github-actions[bot]" if git diff --quiet && git diff --staged --quiet; then - echo "No changes in README.md, skipping commit." + echo "No changes in README.md, strings.json, and services.yaml, skipping commit." echo "commit_status=skipped" >> $GITHUB_ENV else - git commit -m "Update README.md" + git commit -m "Update README.md, strings.json, and services.yaml" echo "commit_status=committed" >> $GITHUB_ENV fi diff --git a/README.md b/README.md index 5b98de8b..c7a873d0 100644 --- a/README.md +++ b/README.md @@ -90,11 +90,11 @@ The YAML and frontend configuration methods support all of the options listed be | Variable name | Description | Default | Type | |:-------------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------------|:-------------------------------------| -| `lights` | List of light entities to be controlled by Adaptive Lighting (may be empty). 🌟 | `[]` | list of `entity_id`s | +| `lights` | List of light entity_ids to be controlled (may be empty). 🌟 | `[]` | list of `entity_id`s | | `prefer_rgb_color` | Whether to prefer RGB color adjustment over light color temperature when possible. 🌈 | `False` | `bool` | | `include_config_in_attributes` | Show all options as attributes on the switch in Home Assistant when set to `true`. 📝 | `False` | `bool` | | `initial_transition` | Duration of the first transition when lights turn from `off` to `on` in seconds. ⏲️ | `1` | `float` 0-6553 | -| `sleep_transition` | Duration of transition when 'sleep mode' is toggled in seconds. 😴 | `1` | `float` 0-6553 | +| `sleep_transition` | Duration of transition when "sleep mode" is toggled in seconds. 😴 | `1` | `float` 0-6553 | | `transition` | Duration of transition when lights change, in seconds. 🕑 | `45` | `float` 0-6553 | | `transition_until_sleep` | When enabled, Adaptive Lighting will treat sleep settings as the minimum, transitioning to these values after sunset. 🌙 | `False` | `bool` | | `interval` | Frequency to adapt the lights, in seconds. 🔄 | `90` | `int > 0` | @@ -103,9 +103,9 @@ The YAML and frontend configuration methods support all of the options listed be | `min_color_temp` | Warmest color temperature in Kelvin. 🔥 | `2000` | `int` 1000-10000 | | `max_color_temp` | Coldest color temperature in Kelvin. ❄️ | `5500` | `int` 1000-10000 | | `sleep_brightness` | Brightness percentage of lights in sleep mode. 😴 | `1` | `int` 1-100 | -| `sleep_rgb_or_color_temp` | Use either `'rgb_color'` or `'color_temp'` in sleep mode. 🌙 | `color_temp` | one of `['color_temp', 'rgb_color']` | +| `sleep_rgb_or_color_temp` | Use either `"rgb_color"` or `"color_temp"` in sleep mode. 🌙 | `color_temp` | one of `['color_temp', 'rgb_color']` | | `sleep_color_temp` | Color temperature in sleep mode (used when `sleep_rgb_or_color_temp` is `color_temp`) in Kelvin. 😴 | `1000` | `int` 1000-10000 | -| `sleep_rgb_color` | RGB color in sleep mode (used when `sleep_rgb_or_color_temp` is 'rgb_color'). 🌈 | `[255, 56, 0]` | RGB color | +| `sleep_rgb_color` | RGB color in sleep mode (used when `sleep_rgb_or_color_temp` is "rgb_color"). 🌈 | `[255, 56, 0]` | RGB color | | `sunrise_time` | Set a fixed time (HH:MM:SS) for sunrise. 🌅 | `None` | `str` | | `max_sunrise_time` | Set the latest virtual sunrise time (HH:MM:SS), allowing for earlier real sunrises. 🌅 | `None` | `str` | | `sunrise_offset` | Adjust sunrise time with a positive or negative offset in seconds. ⏰ | `0` | `int` | @@ -116,8 +116,8 @@ The YAML and frontend configuration methods support all of the options listed be | `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`! 🔒 | `True` | `bool` | | `detect_non_ha_changes` | Detect non-`light.turn_on` state changes and stop adapting lights. Requires `take_over_control`. 🕵️ | `False` | `bool` | | `separate_turn_on_commands` | Use separate `light.turn_on` calls for color and brightness, needed for some light types. 🔀 | `False` | `bool` | -| `send_split_delay` | Wait time (milliseconds) between commands when using `separate_turn_on_commands`. Helps ensure correct handling. ⏲️ | `0` | `int` 0-10000 | -| `adapt_delay` | Wait time (seconds) between light turn on and Adaptive Lighting applying changes. Helps avoid flickering. ⏲️ | `0` | `float > 0` | +| `send_split_delay` | Delay (ms) between `separate_turn_on_commands` for lights that don't support simultaneous brightness and color setting. ⏲️ | `0` | `int` 0-10000 | +| `adapt_delay` | Wait time (seconds) between light turn on and Adaptive Lighting applying changes. Might help to avoid flickering. ⏲️ | `0` | `float > 0` | | `autoreset_control_seconds` | Automatically reset the manual control after a number of seconds. Set to 0 to disable. ⏲️ | `0` | `int` 0-31536000 | @@ -188,7 +188,7 @@ adaptive_lighting: |:-------------------------|:-----------------------------------------------------------------------------------------------|:-----------|:---------------------| | `entity_id` | The `entity_id` of the switch in which to (un)mark the light as being `manually controlled`. 📝 | ✅ | list of `entity_id`s | | `lights` | entity_id(s) of lights, if not specified, all lights in the switch are selected. 💡 | ❌ | list of `entity_id`s | -| `manual_control` | Whether to add ('true') or remove ('false') the light from the 'manual_control' list. 🔒 | ❌ | bool | +| `manual_control` | Whether to add ("true") or remove ("false") the light from the "manual_control" list. 🔒 | ❌ | bool | #### `adaptive_lighting.change_switch_settings` diff --git a/custom_components/adaptive_lighting/const.py b/custom_components/adaptive_lighting/const.py index bb0c07cd..64620927 100644 --- a/custom_components/adaptive_lighting/const.py +++ b/custom_components/adaptive_lighting/const.py @@ -22,9 +22,7 @@ CONF_NAME, DEFAULT_NAME = "name", "default" DOCS[CONF_NAME] = "Display name for this switch. 📝" CONF_LIGHTS, DEFAULT_LIGHTS = "lights", [] -DOCS[CONF_LIGHTS] = ( - "List of light entities to be controlled by Adaptive " "Lighting (may be empty). 🌟" -) +DOCS[CONF_LIGHTS] = "List of light entity_ids to be controlled (may be empty). 🌟" CONF_DETECT_NON_HA_CHANGES, DEFAULT_DETECT_NON_HA_CHANGES = ( "detect_non_ha_changes", @@ -52,7 +50,7 @@ DOCS[CONF_INITIAL_TRANSITION] = ( CONF_SLEEP_TRANSITION, DEFAULT_SLEEP_TRANSITION = "sleep_transition", 1 DOCS[CONF_SLEEP_TRANSITION] = ( - "Duration of transition when 'sleep mode' is toggled " "in seconds. 😴" + 'Duration of transition when "sleep mode" is toggled ' "in seconds. 😴" ) CONF_INTERVAL, DEFAULT_INTERVAL = "interval", 90 @@ -102,7 +100,7 @@ DOCS[CONF_SLEEP_COLOR_TEMP] = ( 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'). 🌈" + "RGB color in sleep mode (used when " '`sleep_rgb_or_color_temp` is "rgb_color"). 🌈' ) CONF_SLEEP_RGB_OR_COLOR_TEMP, DEFAULT_SLEEP_RGB_OR_COLOR_TEMP = ( @@ -110,7 +108,7 @@ CONF_SLEEP_RGB_OR_COLOR_TEMP, DEFAULT_SLEEP_RGB_OR_COLOR_TEMP = ( "color_temp", ) DOCS[CONF_SLEEP_RGB_OR_COLOR_TEMP] = ( - "Use either `'rgb_color'` or `'color_temp'` " "in sleep mode. 🌙" + 'Use either `"rgb_color"` or `"color_temp"` ' "in sleep mode. 🌙" ) CONF_SUNRISE_OFFSET, DEFAULT_SUNRISE_OFFSET = "sunrise_offset", 0 @@ -163,13 +161,13 @@ DOCS[CONF_ADAPT_UNTIL_SLEEP] = ( 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. Helps avoid flickering. ⏲️" + "changes. Might help to avoid flickering. ⏲️" ) CONF_SEND_SPLIT_DELAY, DEFAULT_SEND_SPLIT_DELAY = "send_split_delay", 0 DOCS[CONF_SEND_SPLIT_DELAY] = ( - "Wait time (milliseconds) between commands when using `separate_turn_on_commands`. " - "Helps ensure correct handling. ⏲️" + "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 @@ -197,7 +195,11 @@ 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] = "Whether to use default settings for the switches. ⚙️" +DOCS[CONF_USE_DEFAULTS] = ( + "Sets the default values not specified in this service call. Options: " + '"current" (default, retains current values), "factory" (resets to ' + 'documented defaults), or "configuration" (reverts to switch config defaults). ⚙️' +) TURNING_OFF_DELAY = 5 @@ -206,8 +208,8 @@ DOCS_MANUAL_CONTROL = { "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. 🔒", + CONF_MANUAL_CONTROL: 'Whether to add ("true") or remove ("false") the ' + 'light from the "manual_control" list. 🔒', } DOCS_APPLY = { diff --git a/custom_components/adaptive_lighting/services.yaml b/custom_components/adaptive_lighting/services.yaml old mode 100755 new mode 100644 index c22d1f76..cd25811b --- a/custom_components/adaptive_lighting/services.yaml +++ b/custom_components/adaptive_lighting/services.yaml @@ -1,187 +1,186 @@ +# This file is auto-generated by .github/update-services.py. apply: description: Applies the current Adaptive Lighting settings to lights. fields: entity_id: - description: entity_id of the Adaptive Lighting switch. If not specified, the current Adaptive Lighting switch will be used. + description: The `entity_id` of the switch with the settings to apply. 📝 selector: entity: integration: adaptive_lighting domain: switch multiple: false lights: - description: entity_id(s) of lights, if not specified, all lights in the switch are selected. + description: A light (or list of lights) to apply the settings to. 💡 selector: entity: domain: light multiple: true transition: - description: Transition of the lights. + description: Duration of transition when lights change, in seconds. 🕑 example: 10 selector: - text: + text: null adapt_brightness: - description: "Adapt the 'brightness', default: true" + description: Whether to adapt the brightness of the light. 🌞 example: true selector: - boolean: + boolean: null adapt_color: - description: "Adapt the color_temp/color_rgb, default: true" + description: Whether to adapt the color on supporting lights. 🌈 example: true selector: - boolean: + boolean: null prefer_rgb_color: - description: "Prefer to use color_rgb over color_temp if possible, default: false" + description: Whether to prefer RGB color adjustment over light color temperature when possible. 🌈 example: false selector: - boolean: + boolean: null turn_on_lights: - description: "Turn on the lights that are off, default: false" + description: Whether to turn on lights that are currently off. 🔆 example: false selector: - boolean: - + boolean: null set_manual_control: description: Mark whether a light is 'manually controlled'. fields: entity_id: - description: entity_id of the Adaptive Lighting switch. If not specified, the current Adaptive Lighting switch will be used. + description: The `entity_id` of the switch in which to (un)mark the light as being `manually controlled`. 📝 selector: entity: integration: adaptive_lighting domain: switch multiple: false lights: - description: entity_id(s) of lights, if not specified, all lights in the switch are selected. + description: entity_id(s) of lights, if not specified, all lights in the switch are selected. 💡 selector: entity: domain: light multiple: true manual_control: - description: "Whether to add ('true') or remove ('false') the light from the 'manual_control' list, default: true" + description: Whether to add ("true") or remove ("false") the light from the "manual_control" list. 🔒 example: true default: true selector: - boolean: - + boolean: null change_switch_settings: - description: "Change any settings you'd like in the switch. All options here are the same as in the config flow." + description: Change any settings you'd like in the switch. All options here are the same as in the config flow. fields: entity_id: - description: "entity_id of the Adaptive Lighting switch." + description: Entity ID of the switch. 📝 required: true selector: entity: domain: switch use_defaults: - description: "(default: 'current' for current settings) You can set this to 'factory', 'configuration', or 'current' to reset the variables not being set with this service call. 'current' leaves them as is, 'configuration' resets to whatever already initializes at startup, 'factory' resets to the default values listed in the documentation." - example: "current" + description: 'Sets the default values not specified in this service call. Options: "current" (default, retains current values), "factory" (resets to documented defaults), or "configuration" (reverts to switch config defaults). ⚙️' + example: current required: false - default: "current" + default: current selector: select: options: - - "current" - - "configuration" - - "factory" + - current + - configuration + - factory include_config_in_attributes: - description: "include_config_in_attributes: All config options will be listed as attributes under the adaptive-lighting switch this integration creates. (default: false)" + description: Show all options as attributes on the switch in Home Assistant when set to `true`. 📝 required: false selector: - boolean: + boolean: null turn_on_lights: - description: "Turn on the lights that are off, default: false" + description: Whether to turn on lights that are currently off. 🔆 example: false required: false selector: - boolean: + boolean: null initial_transition: - description: "initial_transition: When lights turn 'off' to 'on'. (seconds)" + description: Duration of the first transition when lights turn from `off` to `on` in seconds. ⏲️ example: 1 required: false selector: - text: + text: null sleep_transition: - description: "sleep_transition: When 'sleep_state' changes. (seconds)" + description: Duration of transition when "sleep mode" is toggled in seconds. 😴 example: 1 required: false selector: - text: + text: null max_brightness: - description: "max_brightness: Highest brightness of lights during a cycle. (%)" + description: Maximum brightness percentage. 💡 required: false example: 100 selector: - text: + text: null max_color_temp: - description: "max_color_temp: Coldest hue of the color temperature cycle. (Kelvin)" + description: Coldest color temperature in Kelvin. ❄️ required: false example: 5500 selector: - text: + text: null min_brightness: - description: "min_brightness: Lowest brightness of lights during a cycle. (%)" + description: Minimum brightness percentage. 💡 required: false example: 1 selector: - text: + text: null min_color_temp: - description: "min_color_temp, Warmest hue of the color temperature cycle. (Kelvin)" + description: Warmest color temperature in Kelvin. 🔥 required: false example: 2000 selector: - text: + text: null only_once: - description: "only_once: Only adapt the lights when turning them on." + description: Adapt lights only when they are turned on (`true`) or keep adapting them (`false`). 🔄 example: false required: false selector: - boolean: + boolean: null prefer_rgb_color: - description: "prefer_rgb_color: Use 'rgb_color' rather than 'color_temp' when possible." + description: Whether to prefer RGB color adjustment over light color temperature when possible. 🌈 required: false example: false selector: - boolean: + boolean: null separate_turn_on_commands: - description: "separate_turn_on_commands: Separate the commands for each attribute (color, brightness, etc.) in 'light.turn_on' (required for some lights)." + description: Use separate `light.turn_on` calls for color and brightness, needed for some light types. 🔀 required: false example: false selector: - boolean: + boolean: null send_split_delay: - description: "send_split_delay: wait between commands (milliseconds), when separate_turn_on_commands is used. May ensure that both commands are handled by the bulb correctly." + description: Delay (ms) between `separate_turn_on_commands` for lights that don't support simultaneous brightness and color setting. ⏲️ required: false example: 0 selector: - boolean: + boolean: null sleep_brightness: - description: "sleep_brightness, Brightness setting for Sleep Mode. (%)" + description: Brightness percentage of lights in sleep mode. 😴 required: false example: 1 selector: - text: + text: null sleep_rgb_or_color_temp: - description: "sleep_rgb_or_color_temp, use 'rgb_color' or 'color_temp'" + description: Use either `"rgb_color"` or `"color_temp"` in sleep mode. 🌙 required: false - example: "color_temp" + example: color_temp selector: select: options: - - "rgb_color" - - "color_temp" + - rgb_color + - color_temp sleep_rgb_color: - description: "sleep_rgb_color, in RGB" + description: RGB color in sleep mode (used when `sleep_rgb_or_color_temp` is "rgb_color"). 🌈 required: false selector: - color_rgb: + color_rgb: null sleep_color_temp: - description: "sleep_color_temp: Color temperature setting for Sleep Mode. (Kelvin)" + description: Color temperature in sleep mode (used when `sleep_rgb_or_color_temp` is `color_temp`) in Kelvin. 😴 required: false example: 1000 selector: - text: + text: null sunrise_offset: - description: sunrise_offset, in +/- seconds (integer) + description: Adjust sunrise time with a positive or negative offset in seconds. ⏰ required: false example: 0 selector: @@ -189,64 +188,64 @@ change_switch_settings: min: 0 max: 86300 sunrise_time: - description: sunrise_time, in 'HH:MM:SS' format (if 'None', it uses the actual sunrise time at your location) + description: Set a fixed time (HH:MM:SS) for sunrise. 🌅 required: false - example: "" + example: '' selector: - time: + time: null sunset_offset: - description: sunset_offset, in +/- seconds (integer) + description: Adjust sunset time with a positive or negative offset in seconds. ⏰ required: false - example: "" + example: '' selector: number: min: 0 max: 86300 sunset_time: - description: sunset_time, in 'HH:MM:SS' format (if 'None', it uses the actual sunset time at your location) - example: "" + description: Set a fixed time (HH:MM:SS) for sunset. 🌇 + example: '' required: false selector: - time: + time: null max_sunrise_time: - description: "max_sunrise_time: Manual override of the maximum sunrise time, if 'None', it uses the actual sunrise time at your location (HH:MM:SS)" - example: "" + description: Set the latest virtual sunrise time (HH:MM:SS), allowing for earlier real sunrises. 🌅 + example: '' required: false selector: - time: + time: null min_sunset_time: - description: "min_sunset_time: Manual override of the minimum sunset time, if 'None', it uses the actual sunset time at your location (HH:MM:SS)" - example: "" + description: Set the earliest virtual sunset time (HH:MM:SS), allowing for later real sunsets. 🌇 + example: '' required: false selector: - time: + time: null take_over_control: - description: "take_over_control: If anything but Adaptive Lighting calls 'light.turn_on' when a light is already on, stop adapting that light until it (or the switch) toggles off -> on." + description: 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`! 🔒 required: false example: true selector: - boolean: + boolean: null detect_non_ha_changes: - description: "detect_non_ha_changes: detects all >10% changes made to the lights (also outside of HA), requires 'take_over_control' to be enabled (calls 'homeassistant.update_entity' every 'interval'!)" + description: Detect non-`light.turn_on` state changes and stop adapting lights. Requires `take_over_control`. 🕵️ required: false example: false selector: - boolean: + boolean: null transition: - description: "Transition time when applying a change to the lights (seconds)" + description: Duration of transition when lights change, in seconds. 🕑 required: false example: 45 selector: - text: + text: null adapt_delay: - description: "adapt_delay: wait time between light turn on (seconds), and Adaptive Lights applying changes to the light state. May avoid flickering." + description: Wait time (seconds) between light turn on and Adaptive Lighting applying changes. Might help to avoid flickering. ⏲️ required: false example: 0 selector: - text: + text: null autoreset_control_seconds: - description: "autoreset_control_seconds: wait time (seconds) before Adaptive Lighting resets `manual_control` status of any light (default: 0)" + description: Automatically reset the manual control after a number of seconds. Set to 0 to disable. ⏲️ required: false example: 0 selector: - text: + text: null diff --git a/custom_components/adaptive_lighting/strings.json b/custom_components/adaptive_lighting/strings.json index 2ebd96d0..54af5e11 100644 --- a/custom_components/adaptive_lighting/strings.json +++ b/custom_components/adaptive_lighting/strings.json @@ -2,7 +2,7 @@ "config": { "step": { "user": { - "title": "Choose a name for the Adaptive Lighting", + "title": "Choose a name for the Adaptive Lighting instance", "description": "Every instance can contain multiple lights!", "data": { "name": "Name" @@ -19,35 +19,35 @@ "title": "Adaptive Lighting options", "description": "All settings for a Adaptive Lighting component. The option names correspond with the YAML settings. No options are shown if you have this entry defined in YAML.", "data": { - "lights": "lights", - "initial_transition": "initial_transition: When lights turn 'off' to 'on'. (seconds)", - "include_config_in_attributes": "include_config_in_attributes: All config options will be listed as attributes under the adaptive-lighting switch this integration creates. (default: false)", - "adapt_until_sleep": "adapt_until_sleep: When checked, Adaptive Lighting will use the sleep settings as the minimum, and transition to these values past the sunset (default: false)", - "sleep_transition": "sleep_transition: When 'sleep_state' changes. (seconds)", - "interval": "interval: Time between switch updates. (seconds)", - "max_brightness": "max_brightness: Highest brightness of lights during a cycle. (%)", - "max_color_temp": "max_color_temp: Coldest hue of the color temperature cycle. (Kelvin)", - "min_brightness": "min_brightness: Lowest brightness of lights during a cycle. (%)", - "min_color_temp": "min_color_temp, Warmest hue of the color temperature cycle. (Kelvin)", - "only_once": "only_once: Only adapt the lights when turning them on.", - "prefer_rgb_color": "prefer_rgb_color: Use 'rgb_color' rather than 'color_temp' when possible.", - "separate_turn_on_commands": "separate_turn_on_commands: Separate the commands for each attribute (color, brightness, etc.) in 'light.turn_on' (required for some lights).", - "send_split_delay": "send_split_delay: wait between commands (milliseconds), when separate_turn_on_commands is used. May ensure that both commands are handled by the bulb correctly.", - "sleep_brightness": "sleep_brightness, Brightness setting for Sleep Mode. (%)", - "sleep_rgb_or_color_temp": "sleep_rgb_or_color_temp, use 'rgb_color' or 'color_temp'", - "sleep_rgb_color": "sleep_rgb_color, in RGB", - "sleep_color_temp": "sleep_color_temp: Color temperature setting for Sleep Mode. (Kelvin)", - "sunrise_offset": "sunrise_offset: How long before(-) or after(+) to define the sunrise point of the cycle (+/- seconds)", - "sunrise_time": "sunrise_time: Manual override of the sunrise time, if 'None', it uses the actual sunrise time at your location (HH:MM:SS)", - "max_sunrise_time": "max_sunrise_time: Manual override of the maximum sunrise time, if 'None', it uses the actual sunrise time at your location (HH:MM:SS)", - "sunset_offset": "sunset_offset: How long before(-) or after(+) to define the sunset point of the cycle (+/- seconds)", - "sunset_time": "sunset_time: Manual override of the sunset time, if 'None', it uses the actual sunset time at your location (HH:MM:SS)", - "min_sunset_time": "min_sunset_time: Manual override of the minimum sunset time, if 'None', it uses the actual sunset time at your location (HH:MM:SS)", - "take_over_control": "take_over_control: If anything but Adaptive Lighting calls 'light.turn_on' when a light is already on, stop adapting that light until it (or the switch) toggles off -> on.", - "detect_non_ha_changes": "detect_non_ha_changes: detects all >10% changes made to the lights (also outside of HA), requires 'take_over_control' to be enabled (calls 'homeassistant.update_entity' every 'interval'!)", - "transition": "Transition time when applying a change to the lights (seconds)", - "adapt_delay": "adapt_delay: wait time between light turn on (seconds), and Adaptive Lights applying changes to the light state. May avoid flickering.", - "autoreset_control_seconds": "autoreset_control_seconds: wait time (seconds) before Adaptive Lighting resets `manual_control` status of any light (default: 0)" + "lights": "lights: List of light entity_ids to be controlled (may be empty). 🌟", + "prefer_rgb_color": "prefer_rgb_color: Whether to prefer RGB color adjustment over light color temperature when possible. 🌈", + "include_config_in_attributes": "include_config_in_attributes: Show all options as attributes on the switch in Home Assistant when set to `true`. 📝", + "initial_transition": "initial_transition: Duration of the first transition when lights turn from `off` to `on` in seconds. ⏲️", + "sleep_transition": "sleep_transition: Duration of transition when \"sleep mode\" is toggled in seconds. 😴", + "transition": "transition: Duration of transition when lights change, in seconds. 🕑", + "transition_until_sleep": "transition_until_sleep: When enabled, Adaptive Lighting will treat sleep settings as the minimum, transitioning to these values after sunset. 🌙", + "interval": "interval: Frequency to adapt the lights, in seconds. 🔄", + "min_brightness": "min_brightness: Minimum brightness percentage. 💡", + "max_brightness": "max_brightness: Maximum brightness percentage. 💡", + "min_color_temp": "min_color_temp: Warmest color temperature in Kelvin. 🔥", + "max_color_temp": "max_color_temp: Coldest color temperature in Kelvin. ❄️", + "sleep_brightness": "sleep_brightness: Brightness percentage of lights in sleep mode. 😴", + "sleep_rgb_or_color_temp": "sleep_rgb_or_color_temp: Use either `\"rgb_color\"` or `\"color_temp\"` in sleep mode. 🌙", + "sleep_color_temp": "sleep_color_temp: Color temperature in sleep mode (used when `sleep_rgb_or_color_temp` is `color_temp`) in Kelvin. 😴", + "sleep_rgb_color": "sleep_rgb_color: RGB color in sleep mode (used when `sleep_rgb_or_color_temp` is \"rgb_color\"). 🌈", + "sunrise_time": "sunrise_time: Set a fixed time (HH:MM:SS) for sunrise. 🌅", + "max_sunrise_time": "max_sunrise_time: Set the latest virtual sunrise time (HH:MM:SS), allowing for earlier real sunrises. 🌅", + "sunrise_offset": "sunrise_offset: Adjust sunrise time with a positive or negative offset in seconds. ⏰", + "sunset_time": "sunset_time: Set a fixed time (HH:MM:SS) for sunset. 🌇", + "min_sunset_time": "min_sunset_time: Set the earliest virtual sunset time (HH:MM:SS), allowing for later real sunsets. 🌇", + "sunset_offset": "sunset_offset: Adjust sunset time with a positive or negative offset in seconds. ⏰", + "only_once": "only_once: Adapt lights only when they are turned on (`true`) or keep adapting them (`false`). 🔄", + "take_over_control": "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`! 🔒", + "detect_non_ha_changes": "detect_non_ha_changes: Detect non-`light.turn_on` state changes and stop adapting lights. Requires `take_over_control`. 🕵️", + "separate_turn_on_commands": "separate_turn_on_commands: Use separate `light.turn_on` calls for color and brightness, needed for some light types. 🔀", + "send_split_delay": "send_split_delay: Delay (ms) between `separate_turn_on_commands` for lights that don't support simultaneous brightness and color setting. ⏲️", + "adapt_delay": "adapt_delay: Wait time (seconds) between light turn on and Adaptive Lighting applying changes. Might help to avoid flickering. ⏲️", + "autoreset_control_seconds": "autoreset_control_seconds: Automatically reset the manual control after a number of seconds. Set to 0 to disable. ⏲️" } } }, diff --git a/custom_components/adaptive_lighting/translations/en.json b/custom_components/adaptive_lighting/translations/en.json index 51311d64..38fb7b0e 100644 --- a/custom_components/adaptive_lighting/translations/en.json +++ b/custom_components/adaptive_lighting/translations/en.json @@ -4,7 +4,7 @@ "step": { "user": { "title": "Choose a name for the Adaptive Lighting instance", - "description": "Pick a name for this instance. You can run several instances of Adaptive lighting, each of these can contain multiple lights!", + "description": "Every instance can contain multiple lights!", "data": { "name": "Name" } @@ -20,33 +20,35 @@ "title": "Adaptive Lighting options", "description": "All settings for a Adaptive Lighting component. The option names correspond with the YAML settings. No options are shown if you have the adaptive_lighting entry defined in your YAML configuration.", "data": { - "lights": "lights", - "initial_transition": "initial_transition: When lights turn 'off' to 'on'. (seconds)", - "include_config_in_attributes": "include_config_in_attributes: All config options will be listed as attributes under the adaptive-lighting switch this integration creates. (default: false)", - "sleep_transition": "sleep_transition: When 'sleep_state' changes. (seconds)", - "interval": "interval: Time between switch updates. (seconds)", - "max_brightness": "max_brightness: Highest brightness of lights during a cycle. (%)", - "max_color_temp": "max_color_temp: Coldest hue of the color temperature cycle. (Kelvin)", - "min_brightness": "min_brightness: Lowest brightness of lights during a cycle. (%)", - "min_color_temp": "min_color_temp, Warmest hue of the color temperature cycle. (Kelvin)", - "only_once": "only_once: Only adapt the lights when turning them on.", - "prefer_rgb_color": "prefer_rgb_color: Use 'rgb_color' rather than 'color_temp' when possible.", - "separate_turn_on_commands": "separate_turn_on_commands: Separate the commands for each attribute (color, brightness, etc.) in 'light.turn_on' (required for some lights).", - "send_split_delay": "send_split_delay: wait between commands (milliseconds), when separate_turn_on_commands is used. May ensure that both commands are handled by the bulb correctly.", - "sleep_brightness": "sleep_brightness, Brightness setting for Sleep Mode. (%)", - "sleep_rgb_or_color_temp": "sleep_rgb_or_color_temp, use 'rgb_color' or 'color_temp'", - "sleep_rgb_color": "sleep_rgb_color, in RGB", - "sleep_color_temp": "sleep_color_temp: Color temperature setting for Sleep Mode. (Kelvin)", - "sunrise_offset": "sunrise_offset: How long before(-) or after(+) to define the sunrise point of the cycle (+/- seconds)", - "sunrise_time": "sunrise_time: Manual override of the sunrise time, if 'None', it uses the actual sunrise time at your location (HH:MM:SS)", - "max_sunrise_time": "max_sunrise_time: Manual override of the maximum sunrise time, if 'None', it uses the actual sunrise time at your location (HH:MM:SS)", - "sunset_offset": "sunset_offset: How long before(-) or after(+) to define the sunset point of the cycle (+/- seconds)", - "sunset_time": "sunset_time: Manual override of the sunset time, if 'None', it uses the actual sunset time at your location (HH:MM:SS)", - "min_sunset_time": "min_sunset_time: Manual override of the minimum sunset time, if 'None', it uses the actual sunset time at your location (HH:MM:SS)", - "take_over_control": "take_over_control: If anything but Adaptive Lighting calls 'light.turn_on' when a light is already on, stop adapting that light until it (or the switch) toggles off -> on.", - "detect_non_ha_changes": "detect_non_ha_changes: detects all >10% changes made to the lights (also outside of HA), requires 'take_over_control' to be enabled (calls 'homeassistant.update_entity' every 'interval'!)", - "transition": "Transition time when applying a change to the lights (seconds)", - "adapt_delay": "adapt_delay: wait time between light turn on (seconds), and Adaptive Lights applying changes to the light state. May avoid flickering." + "lights": "lights: List of light entity_ids to be controlled (may be empty). 🌟", + "prefer_rgb_color": "prefer_rgb_color: Whether to prefer RGB color adjustment over light color temperature when possible. 🌈", + "include_config_in_attributes": "include_config_in_attributes: Show all options as attributes on the switch in Home Assistant when set to `true`. 📝", + "initial_transition": "initial_transition: Duration of the first transition when lights turn from `off` to `on` in seconds. ⏲️", + "sleep_transition": "sleep_transition: Duration of transition when \"sleep mode\" is toggled in seconds. 😴", + "transition": "transition: Duration of transition when lights change, in seconds. 🕑", + "transition_until_sleep": "transition_until_sleep: When enabled, Adaptive Lighting will treat sleep settings as the minimum, transitioning to these values after sunset. 🌙", + "interval": "interval: Frequency to adapt the lights, in seconds. 🔄", + "min_brightness": "min_brightness: Minimum brightness percentage. 💡", + "max_brightness": "max_brightness: Maximum brightness percentage. 💡", + "min_color_temp": "min_color_temp: Warmest color temperature in Kelvin. 🔥", + "max_color_temp": "max_color_temp: Coldest color temperature in Kelvin. ❄️", + "sleep_brightness": "sleep_brightness: Brightness percentage of lights in sleep mode. 😴", + "sleep_rgb_or_color_temp": "sleep_rgb_or_color_temp: Use either `\"rgb_color\"` or `\"color_temp\"` in sleep mode. 🌙", + "sleep_color_temp": "sleep_color_temp: Color temperature in sleep mode (used when `sleep_rgb_or_color_temp` is `color_temp`) in Kelvin. 😴", + "sleep_rgb_color": "sleep_rgb_color: RGB color in sleep mode (used when `sleep_rgb_or_color_temp` is \"rgb_color\"). 🌈", + "sunrise_time": "sunrise_time: Set a fixed time (HH:MM:SS) for sunrise. 🌅", + "max_sunrise_time": "max_sunrise_time: Set the latest virtual sunrise time (HH:MM:SS), allowing for earlier real sunrises. 🌅", + "sunrise_offset": "sunrise_offset: Adjust sunrise time with a positive or negative offset in seconds. ⏰", + "sunset_time": "sunset_time: Set a fixed time (HH:MM:SS) for sunset. 🌇", + "min_sunset_time": "min_sunset_time: Set the earliest virtual sunset time (HH:MM:SS), allowing for later real sunsets. 🌇", + "sunset_offset": "sunset_offset: Adjust sunset time with a positive or negative offset in seconds. ⏰", + "only_once": "only_once: Adapt lights only when they are turned on (`true`) or keep adapting them (`false`). 🔄", + "take_over_control": "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`! 🔒", + "detect_non_ha_changes": "detect_non_ha_changes: Detect non-`light.turn_on` state changes and stop adapting lights. Requires `take_over_control`. 🕵️", + "separate_turn_on_commands": "separate_turn_on_commands: Use separate `light.turn_on` calls for color and brightness, needed for some light types. 🔀", + "send_split_delay": "send_split_delay: Delay (ms) between `separate_turn_on_commands` for lights that don't support simultaneous brightness and color setting. ⏲️", + "adapt_delay": "adapt_delay: Wait time (seconds) between light turn on and Adaptive Lighting applying changes. Might help to avoid flickering. ⏲️", + "autoreset_control_seconds": "autoreset_control_seconds: Automatically reset the manual control after a number of seconds. Set to 0 to disable. ⏲️" } } },