From 92b096a2872339867ff5a02e39ce94e62888c98a Mon Sep 17 00:00:00 2001 From: Mathias Berglund Date: Thu, 24 Sep 2026 21:17:09 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20Document=20the=20`apply`=20`time?= =?UTF-8?q?`=20as=20a=20string=20that=20must=20be=20quoted=20in=20YAML?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Unquoted, `22:00:00` is loaded as the integer 79200 (YAML 1.1 base 60), which fails validation with an unhelpful "Invalid time specified". Co-Authored-By: Claude Opus 5.5 --- README.md | 4 +++- custom_components/adaptive_lighting/_docs_helpers.py | 2 +- docs/services.md | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 176151d9..1e7c440f 100644 --- a/README.md +++ b/README.md @@ -227,7 +227,7 @@ Provide a switch in `entity_id`, a list of `lights`, or both. | `adapt_color` | Whether to adapt the color on supporting lights. 🌈 | ❌ | bool | | `prefer_rgb_color` | Whether to prefer RGB color adjustment over light color temperature when possible. 🌈 | ❌ | bool | | `turn_on_lights` | Whether to turn on lights that are currently off. 🔆 | ❌ | bool | -| `time` | Manually apply the settings for this time of day (HH:MM:SS) instead of now. 🕰️ | ❌ | time (HH:MM:SS) | +| `time` | Manually apply the settings for this time of day (HH:MM:SS) instead of now. 🕰️ | ❌ | `str` (HH:MM:SS) | @@ -245,6 +245,8 @@ data: time: "22:00:00" ``` +Quote the time in YAML (`"22:00:00"`), since an unquoted `22:00:00` is read as a number. + #### `adaptive_lighting.set_manual_control` `adaptive_lighting.set_manual_control` can mark (or unmark) whether a light is "manually controlled", meaning that when a light has `manual_control`, the light is not adapted. diff --git a/custom_components/adaptive_lighting/_docs_helpers.py b/custom_components/adaptive_lighting/_docs_helpers.py index bf966c46..cd529c12 100644 --- a/custom_components/adaptive_lighting/_docs_helpers.py +++ b/custom_components/adaptive_lighting/_docs_helpers.py @@ -45,7 +45,7 @@ def _type_to_str(type_: Any) -> str: # noqa: PLR0911 if type_ == cv.boolean: return "bool" if type_ == cv.time: - return "time (HH:MM:SS)" + return "`str` (HH:MM:SS)" if isinstance(type_, vol.All): return _format_voluptuous_instance(type_) if isinstance(type_, vol.Any): diff --git a/docs/services.md b/docs/services.md index b065ce71..8b1b0fc0 100644 --- a/docs/services.md +++ b/docs/services.md @@ -28,7 +28,7 @@ Provide a switch in `entity_id`, a list of `lights`, or both. | `adapt_color` | Whether to adapt the color on supporting lights. 🌈 | ❌ | bool | | `prefer_rgb_color` | Whether to prefer RGB color adjustment over light color temperature when possible. 🌈 | ❌ | bool | | `turn_on_lights` | Whether to turn on lights that are currently off. 🔆 | ❌ | bool | -| `time` | Manually apply the settings for this time of day (HH:MM:SS) instead of now. 🕰️ | ❌ | time (HH:MM:SS) | +| `time` | Manually apply the settings for this time of day (HH:MM:SS) instead of now. 🕰️ | ❌ | `str` (HH:MM:SS) | @@ -66,6 +66,8 @@ data: time: "22:00:00" ``` +Quote the time in YAML (`"22:00:00"`), since an unquoted `22:00:00` is read as a number. + With `time`, the lights get the values Adaptive Lighting would use at that time today. The adapted attributes are then marked as manually controlled, exactly as if you had changed them yourself: the regular adaptation leaves them alone until manual control is reset (for example by `autoreset_control_seconds` or `adaptive_lighting.set_manual_control`), and an `adaptive_lighting.manual_control` event is fired. When sleep mode is on, the sleep settings are applied instead, whatever the time. Unless `adapt_brightness` or `adapt_color` is given, only what the profile adapts (its Adapt Brightness and Adapt Color switches) is applied. ---