Commit graph

1,028 commits

Author SHA1 Message Date
Bas Nijholt
4e27938381
Fix options flow hanging by refactoring _build_options_schema
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
2025-11-27 14:03:11 -08:00
github-actions[bot]
e2c5d22e87 Update README.md, strings.json, and services.yaml 2025-11-27 21:47:00 +00:00
Bas Nijholt
8b277156b1
Merge f94fb6a85e into 1968e1a9a6 2025-11-27 13:46:12 -08:00
Bas Nijholt
f94fb6a85e
Split options flow into Basic and Advanced steps
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.
2025-11-27 13:45:25 -08:00
Bas Nijholt
1968e1a9a6
Bump to v1.28.0 (#1310) v1.28.0 2025-11-27 12:42:20 -08:00
allcontributors[bot]
2391d99539 docs: update .all-contributorsrc 2025-11-27 12:03:04 -08:00
allcontributors[bot]
bba7bb8350 docs: update README.md 2025-11-27 12:03:04 -08:00
Dobby
19d30430bb
Friendly names (#1258) 2025-11-27 12:01:05 -08:00
Bas Nijholt
a982acb384
Stop pinning mypy-dev versions since old releases get deleted from PyPI (#1308) 2025-11-27 12:00:47 -08:00
Bas Nijholt
d95f0d4bc6
Fix xfail and skipped tests to properly pass (#1307) 2025-11-27 18:52:11 +00:00
Weblate (bot)
8ff3babae2
Translations update from Hosted Weblate (#1228)
* 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>
2025-11-27 10:15:06 -08:00
allcontributors[bot]
d7aa3439d5
docs: add therealmate as a contributor for translation (#1306) 2025-11-27 10:14:16 -08:00
allcontributors[bot]
d12394dc03
docs: add plageoj as a contributor for translation (#1305) 2025-11-27 10:13:53 -08:00
allcontributors[bot]
0ddb79b03f
docs: add maksim2005UKR as a contributor for translation (#1304) 2025-11-27 10:13:26 -08:00
allcontributors[bot]
ce16be20b5
docs: add Athishbalu as a contributor for translation (#1303) 2025-11-27 10:13:01 -08:00
allcontributors[bot]
c37e992be9
docs: add hhjuhl as a contributor for translation (#1302) 2025-11-27 10:12:38 -08:00
allcontributors[bot]
5274a3fefa
docs: add Rafael4A as a contributor for translation (#1301) 2025-11-27 10:11:53 -08:00
allcontributors[bot]
edefdbf3b8
docs: add Wijt as a contributor for translation (#1300)
* docs: update README.md

* docs: update .all-contributorsrc

---------

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2025-11-27 10:11:31 -08:00
Bas Nijholt
4feaf2c291
Add bidirectional color mode change detection (issue #1275) (#1299)
Extract _has_color_mode_changed() function that checks original attributes
BEFORE conversion, enabling detection of all mode switches:
- color_temp → RGB ✓
- color_temp → XY ✓
- RGB → color_temp ✓
- RGB → XY ✓
- XY → color_temp ✓
- XY → RGB ✓

This improves on PR #1282 by detecting mode changes in both directions.
2025-11-27 10:02:50 -08:00
allcontributors[bot]
41e13bc944
docs: add DataGhost as a contributor for code (#1298)
* docs: update README.md

* docs: update .all-contributorsrc

---------

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2025-11-27 09:57:41 -08:00
DataGhost
afd7b935d7
Check for external light mode (temperature vs rgb) switch (#1282) 2025-11-27 09:54:14 -08:00
allcontributors[bot]
3d3d246918
docs: add ams2990 as a contributor for code (#1297)
* docs: update README.md

* docs: update .all-contributorsrc

---------

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2025-11-27 09:36:04 -08:00
ams2990
32719eabae
Fix some type hint issues (#1280) 2025-11-27 09:35:09 -08:00
renovate[bot]
561749ac06
⬆️ Update actions/setup-python action to v6 (#1261)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-27 09:34:46 -08:00
renovate[bot]
f6321afeae
⬆️ Update actions/upload-pages-artifact action to v4 (#1259)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-27 09:30:26 -08:00
renovate[bot]
9244ff39fe
⬆️ Update astral-sh/setup-uv action to v7 (#1271)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-27 09:30:12 -08:00
Bas Nijholt
68e243c87e
Fix infinite loop when disabling SimpleSwitch entities (#1296)
* 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
2025-11-27 09:30:01 -08:00
renovate[bot]
1556de8c4f
⬆️ Update mcr.microsoft.com/devcontainers/python Docker tag to v3 (#1292)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-27 09:27:38 -08:00
renovate[bot]
b34cc1ffaa
⬆️ Update actions/checkout action to v6 (#1288)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-27 09:27:27 -08:00
Bas Nijholt
6f846c26ca
Fix race condition where timer.start_time is None while is_running() is True (#1295)
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
2025-11-27 09:27:13 -08:00
allcontributors[bot]
95a8f34000
docs: add Tommatheussen as a contributor for code (#1294) 2025-11-27 09:17:12 -08:00
Bas Nijholt
e8af7a485e
Bump to 1.27.0 for fixes in 2025.12 (#1293) v1.27.0 2025-11-27 09:06:41 -08:00
Tom Matheussen
af5a7151aa
Fix HA 2025.12 breaking (#1291) 2025-11-27 08:05:30 -08:00
Bas Nijholt
0a2d2e9fb5
Properly fix the webapp 2025-07-21 15:49:55 -07:00
Bas Nijholt
f45fa66390
Revert "Remove app requirements"
This reverts commit 3c86a6e28b.
2025-07-21 15:44:37 -07:00
Bas Nijholt
3c86a6e28b Remove app requirements 2025-07-21 15:38:56 -07:00
Bas Nijholt
8e75144e5d
Fix webapp Pyodide compatibility: pin matplotlib and contourpy versions (#1242)
* 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.
2025-07-21 15:22:11 -07:00
Zachary McCord
86460f6948
webapp: add missing requirements and instructions for local run (#1235) 2025-07-13 14:45:30 -07:00
Bas Nijholt
762900262f
Fix Docker build 2025-06-15 22:33:35 -07:00
Bas Nijholt
5d7599e33b
Revert "Fix Docker build"
This reverts commit ab29fb080c.
2025-06-15 22:28:12 -07:00
Bas Nijholt
ab29fb080c
Fix Docker build 2025-06-15 22:26:05 -07:00
Bas Nijholt
a8e35ae216
Release v1.26.0 (#1227) v1.26.0 2025-06-15 22:20:53 -07:00
Bas Nijholt
b1aca6408d
Skip broken test (#1226)
Also see https://github.com/basnijholt/adaptive-lighting/pull/1159
2025-06-15 22:16:31 -07:00
Bas Nijholt
cb67a4cb9c
Fix test_light_switch_in_specific_area (#1225) 2025-06-15 22:12:48 -07:00
Bas Nijholt
5f02e9de75
Bump min supported version to 2025.12 (#1224) 2025-06-15 21:57:08 -07:00
pre-commit-ci[bot]
8035ea3ed1
[pre-commit.ci] pre-commit autoupdate (#1163)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.8.4 → v0.11.13](https://github.com/astral-sh/ruff-pre-commit/compare/v0.8.4...v0.11.13)
- [github.com/psf/black: 24.10.0 → 25.1.0](https://github.com/psf/black/compare/24.10.0...25.1.0)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix pre-commit

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Bas Nijholt <bas@nijho.lt>
2025-06-15 21:55:36 -07:00
renovate[bot]
e08a752514
⬆️ Update actions/setup-python action to v5.6.0 (#1171)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-06-15 21:49:44 -07:00
renovate[bot]
106d4733fe
⬆️ Pin python to 3.13.5 (#1181)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-06-15 21:49:31 -07:00
allcontributors[bot]
33c1d2eb6b
docs: add TermeHansen as a contributor for code (#1223)
* docs: update README.md

* docs: update .all-contributorsrc

---------

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2025-06-15 21:48:37 -07:00
allcontributors[bot]
ab934b0d03
docs: add jawilson as a contributor for code (#1222)
* docs: update README.md

* docs: update .all-contributorsrc

---------

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2025-06-15 21:48:03 -07:00