The _build_options_schema method was calling _get_lights_schema internally,
causing it to be called multiple times redundantly. This refactoring:
- Renames _get_lights_schema to _prepare_lights_schema for clarity
- Changes _build_options_schema to accept to_replace as a parameter
- Updates all callers to prepare lights schema first and pass it
- Fixes async_step_advanced which was broken due to missing parameter
Users have complained about the overwhelming number of options (28+)
in the configuration UI. This change splits the options into two steps:
**Basic Settings (9 options):**
- lights, min/max brightness, min/max color temp
- sleep brightness, sleep color temp, transition, interval
**Advanced Settings (20+ options):**
- All other options (sunrise/sunset times, offsets, brightness modes,
take_over_control, detect_non_ha_changes, etc.)
The flow now works as:
1. User configures basic options
2. Menu appears: "Configure advanced options" or "Save and finish"
3. If advanced chosen, show advanced options form
4. Save combined options
Changes:
- Add BASIC_OPTIONS constant to const.py
- Refactor OptionsFlowHandler with async_step_init, async_step_advanced,
async_step_finish methods
- Update strings.json with menu_options and advanced step
- Update all 34 translation files with translated menu/titles
- Update tests for multi-step flow
Note for Weblate: After merging, run "Rescan all translation files"
to pick up the new structure. Existing translations are preserved.
* Translated using Weblate (Galician)
Currently translated at 50.3% (77 of 153 strings)
Translated using Weblate (Galician)
Currently translated at 49.0% (75 of 153 strings)
Translated using Weblate (Galician)
Currently translated at 46.4% (71 of 153 strings)
Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: Yago Raña Gayoso <yago.rana.gayoso@gmail.com>
Translate-URL: https://hosted.weblate.org/projects/adaptive-lighting/adaptive-lighting/gl/
Translation: Adaptive Lighting/Adaptive Lighting
* Translated using Weblate (Turkish)
Currently translated at 100.0% (153 of 153 strings)
Added translation using Weblate (Turkish)
Co-authored-by: Furkan Kaya <fkaya.personal@gmail.com>
Co-authored-by: Hosted Weblate <hosted@weblate.org>
Translate-URL: https://hosted.weblate.org/projects/adaptive-lighting/adaptive-lighting/tr/
Translation: Adaptive Lighting/Adaptive Lighting
* Translated using Weblate (Portuguese (Brazil))
Currently translated at 56.8% (87 of 153 strings)
Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: Rafael do Amaral Porciuncula <rafael.do.amaralp@gmail.com>
Translate-URL: https://hosted.weblate.org/projects/adaptive-lighting/adaptive-lighting/pt_BR/
Translation: Adaptive Lighting/Adaptive Lighting
* Translated using Weblate (Danish)
Currently translated at 90.1% (138 of 153 strings)
Translated using Weblate (Danish)
Currently translated at 88.8% (136 of 153 strings)
Translated using Weblate (Danish)
Currently translated at 88.8% (136 of 153 strings)
Translated using Weblate (Danish)
Currently translated at 88.8% (136 of 153 strings)
Co-authored-by: Emil Friis Osmann <Emilfriisosmann@gmail.com>
Co-authored-by: Hans Henrik Juhl <hans@kopula.dk>
Co-authored-by: Hosted Weblate <hosted@weblate.org>
Translate-URL: https://hosted.weblate.org/projects/adaptive-lighting/adaptive-lighting/da/
Translation: Adaptive Lighting/Adaptive Lighting
* Translated using Weblate (Russian)
Currently translated at 99.3% (152 of 153 strings)
Co-authored-by: Athish Athish <athisha660@gmail.com>
Translate-URL: https://hosted.weblate.org/projects/adaptive-lighting/adaptive-lighting/ru/
Translation: Adaptive Lighting/Adaptive Lighting
* Translated using Weblate (Ukrainian)
Currently translated at 100.0% (153 of 153 strings)
Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: Максим Горпиніч <gorpinicmaksim0@gmail.com>
Translate-URL: https://hosted.weblate.org/projects/adaptive-lighting/adaptive-lighting/uk/
Translation: Adaptive Lighting/Adaptive Lighting
* Translated using Weblate (Japanese)
Currently translated at 48.3% (74 of 153 strings)
Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: M.Sugahara <equaaqua@hotmail.com>
Translate-URL: https://hosted.weblate.org/projects/adaptive-lighting/adaptive-lighting/ja/
Translation: Adaptive Lighting/Adaptive Lighting
* Translated using Weblate (Hungarian)
Currently translated at 100.0% (153 of 153 strings)
Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: therealmate <hellogaming91@gmail.com>
Translate-URL: https://hosted.weblate.org/projects/adaptive-lighting/adaptive-lighting/hu/
Translation: Adaptive Lighting/Adaptive Lighting
* Translated using Weblate (Slovenian)
Currently translated at 71.2% (109 of 153 strings)
Added translation using Weblate (Slovenian)
Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: Tim Music <tim.music98@gmail.com>
Translate-URL: https://hosted.weblate.org/projects/adaptive-lighting/adaptive-lighting/sl/
Translation: Adaptive Lighting/Adaptive Lighting
---------
Co-authored-by: Yago Raña Gayoso <yago.rana.gayoso@gmail.com>
Co-authored-by: Furkan Kaya <fkaya.personal@gmail.com>
Co-authored-by: Rafael do Amaral Porciuncula <rafael.do.amaralp@gmail.com>
Co-authored-by: Emil Friis Osmann <Emilfriisosmann@gmail.com>
Co-authored-by: Hans Henrik Juhl <hans@kopula.dk>
Co-authored-by: Athish Athish <athisha660@gmail.com>
Co-authored-by: Максим Горпиніч <gorpinicmaksim0@gmail.com>
Co-authored-by: M.Sugahara <equaaqua@hotmail.com>
Co-authored-by: therealmate <hellogaming91@gmail.com>
Co-authored-by: Tim Music <tim.music98@gmail.com>
* Add regression tests for SimpleSwitch initial state bug
Adds tests that verify SimpleSwitch._state is set immediately in __init__
rather than waiting for async_added_to_hass(). These tests currently FAIL
because _state is None after __init__, which causes an infinite loop in
_setup_listeners when the entity is disabled (since async_added_to_hass
is never called for disabled entities).
Regression tests for: https://github.com/basnijholt/adaptive-lighting/issues/1264
* Fix infinite loop when disabling SimpleSwitch entities
The issue was that SimpleSwitch._state was initialized to None in __init__,
but only set to a boolean value in async_added_to_hass(). When an entity
is disabled, async_added_to_hass() is never called, so _state stayed None.
The _setup_listeners() method has a while loop that waits for
_state is not None for all SimpleSwitch children (sleep_mode_switch,
adapt_brightness_switch, adapt_color_switch). With _state stuck at None,
this created an infinite loop.
The fix sets _state to initial_state directly in __init__ instead of
waiting for async_added_to_hass() to set it. The async_added_to_hass()
will still properly restore state from the last session or set based
on initial_state as before.
Fixes: https://github.com/basnijholt/adaptive-lighting/issues/1264
When start() creates a task with asyncio.create_task(), the task is scheduled
but not immediately executed. This means is_running() returns True (task exists
and not done), but start_time is still None because _run() hasn't executed yet.
This causes a TypeError when comparing event.time_fired > timer.start_time.
Fix by setting start_time in start() before creating the task.
Fixes#1272
* Fix webapp README: correct pip install command
The README had incorrect syntax for pip install. Changed from
`pip install requirements.txt` to `pip install -r requirements.txt`.
* Fix webapp Pyodide compatibility: pin matplotlib and contourpy versions
The webapp uses Shinylive which runs Python in the browser via Pyodide.
Pyodide only supports specific versions of packages that have C extensions.
Pin matplotlib to 3.8.4 and contourpy to 1.3.1 to match Pyodide's available versions.
This fixes the "Can't find a pure Python 3 wheel for 'contourpy==1.3.2'" error
when loading the webapp.