Commit graph

46 commits

Author SHA1 Message Date
Casey
1c56674379 Clean up all remaining ruff errors; lint is now fully green
Config:
- .ruff.toml target-version py310 -> py312, matching pyproject's
  requires-python (>=3.12) and the 3.12 'type' aliases switch.py
  already ships. Unblocks two false invalid-syntax errors.
- Ignore D102 in tests (test-class methods), consistent with the
  existing D100/D103 test ignores.

Code (no behavior changes):
- COM812 trailing commas + UP017 dt.UTC via ruff --fix, black re-wrap
- RUF002: unicode minus/en-dash -> ASCII hyphen in docstrings
- SIM105: contextlib.suppress for the lux-reading parse in config_flow
- TRY300: move return out of try in _read_lux_sensor
- PLC0415: hoist inline asyncio/logging imports to module top
- E741: rename ambiguous 'l' comprehension variable to light_id
- PT006/PT018: parametrize tuple + split compound assertion
- D102: docstring for OptionsFlow.async_step_init
- ARG001/ARG002: noqa with justification on HA-required signatures
- PLR0912/PLR0915: noqa on prepare_adaptation_data and
  _update_attrs_and_maybe_adapt_lights (upstream-inherited complexity;
  splitting would hurt readability more than it helps)

./scripts/lint passes clean; 148 tests pass.
2026-06-05 12:16:40 +02:00
Casey
bba0ef31d8 Delete upstream docs apparatus; rewrite README for the fork
The CDiT fork is single-household and was carrying an entire upstream
docs/ mkdocs site documenting features the fork has removed (sleep mode,
take-over-control, brightness_mode selector, YAML config). The README
mostly auto-generated from those pages via markdown-code-runner.

What's gone:

- docs/ — all 11 pages + assets + run_markdown_code_runner.py
- .github/workflows/docs.yml — zensical+shinylive GitHub Pages build
- .github/workflows/markdown-code-runner.yml — auto-edit of README from docs/
- .github/update-services.py / update-strings.py — would clobber the
  hand-edited services.yaml / strings.json
- scripts/update-generated-content — orchestrator for the above
- custom_components/adaptive_lighting/_docs_helpers.py + docs_gen.py —
  only used by the deleted markdown-code-runner
- zensical.toml — docs-site config
- "docs" dependency group in pyproject.toml (markdown-code-runner,
  shinylive, zensical, etc.) + lock regenerated

What's new:

- README.md rewritten to describe the fork's actual surface — 3 switches,
  4 number entities, 3 sensor entities per profile, 2 services (apply +
  change_switch_settings), entry-only setup, UI tuning, sun source.
  Preserves the existing "What's new in 2.1" / "2.2" block quotes.
- webapp/README.md annotated to flag the Shiny simulator models the
  upstream curve (with brightness_mode, sleep mode, etc.) and does not
  reflect the fork.
- CLAUDE.md command table no longer references update-generated-content.

Sensor.py + test_sensor_platform.py: incidental black reformat from the
lint pass (multi-arg function calls split per line).

Tests still pass (123/123). Lint clean. Sensors implementation
unchanged.
2026-05-21 10:23:04 +02:00
Bas Nijholt
80fb93b9f6
Fix propcache dependency (revert to functools) (#1314) 2025-11-28 16:43:52 -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
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
pre-commit-ci[bot]
9aee234955
[pre-commit.ci] pre-commit autoupdate (#972)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/pre-commit/pre-commit-hooks: v4.5.0 → v5.0.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.5.0...v5.0.0)
- [github.com/astral-sh/ruff-pre-commit: v0.3.5 → v0.8.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.3.5...v0.8.4)
- [github.com/psf/black: 24.3.0 → 24.10.0](https://github.com/psf/black/compare/24.3.0...24.10.0)

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

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

* Fix issues

---------

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-01-01 23:28:15 -08:00
Bas Nijholt
b3e4d09b6b
Include core 2024.9.3 until 2024.12.0 in the tests (#1130) 2024-12-07 11:29:05 -08:00
Bas Nijholt
66b93eb3de
Add webapp/__init__.py (#1129) 2024-12-05 14:55:25 -08:00
Bas Nijholt
8fb9493a40
Fix Shiny WebApp (#1127)
* Use requirements.txt.in

* Include webapp/color_and_brightness.py

* Fix Shiny WebApp

* Install shinylive in CI
2024-12-05 14:35:19 -08:00
renovate[bot]
6b567565ab
⬆️ Update linkify-it-py to v2.0.3 (#1082)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-05 21:48:51 +02:00
renovate[bot]
5bd1adf3d2
⬆️ Update mdit-py-plugins to v0.4.2 (#1083)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-05 21:48:45 +02:00
renovate[bot]
32e3bbdeba
⬆️ Update python-multipart to v0.0.19 (#1085)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-05 21:48:26 +02:00
renovate[bot]
cee0ae56c4
⬆️ Update sniffio to v1.3.1 (#1086)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-05 21:48:19 +02:00
renovate[bot]
c2d699555e
⬆️ Update uc-micro-py to v1.0.3 (#1087)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-05 21:48:13 +02:00
renovate[bot]
56497176df
⬆️ Update shinyswatch to v0.8.0 (#1100)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-05 21:48:06 +02:00
renovate[bot]
ed434e6b48
⬆️ Update anyio to v4.7.0 (#1091)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-05 21:46:57 +02:00
renovate[bot]
0c8feba1cf
⬆️ Update asgiref to v3.8.1 (#1092)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-05 21:46:51 +02:00
renovate[bot]
af09a6f3a3
⬆️ Update htmltools to v0.6.0 (#1093)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-05 21:46:46 +02:00
renovate[bot]
8c5d65f955
⬆️ Update idna to v3.10 (#1094)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-05 21:46:38 +02:00
renovate[bot]
5450e0d3ad
⬆️ Update shinylive to v0.7.1 (#1099)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-05 21:46:17 +02:00
renovate[bot]
186da900aa
⬆️ Update starlette to v0.41.3 (#1101)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-05 21:45:39 +02:00
renovate[bot]
d5f992a12d
⬆️ Update typing-extensions to v4.12.2 (#1102)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-05 21:45:31 +02:00
renovate[bot]
dfac56ca89
⬆️ Update uvicorn to v0.32.1 (#1103)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-05 21:44:52 +02:00
renovate[bot]
0d29b1d60c
⬆️ Update packaging to v24 (#1117)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-05 21:41:41 +02:00
renovate[bot]
7d418be392
⬆️ Update pytz to v2024 (#1118)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-05 21:41:34 +02:00
renovate[bot]
8855f3313e
⬆️ Update shiny to v1 (#1121)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-05 21:41:15 +02:00
renovate[bot]
3811df7c57
⬆️ Update watchfiles to v1 (#1123)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-05 21:40:26 +02:00
renovate[bot]
7e98bdd46a
⬆️ Update websockets to v14 (#1124)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-05 21:31:36 +02:00
renovate[bot]
43015d1df1
⬆️ Update starlette to v0.40.0 [SECURITY] (#1080)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-05 11:20:12 -08:00
renovate[bot]
9a190e625a
⬆️ Update idna to v3.7 [SECURITY] (#1079)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-05 11:20:07 -08:00
renovate[bot]
09e0473457
⬆️ Update python-multipart to v0.0.18 [SECURITY] (#1078)
* ⬆️ Update python-multipart to v0.0.18 [SECURITY]

* Update README.md, strings.json, and services.yaml

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-12-05 11:20:00 -08:00
pre-commit-ci[bot]
95a59438b6
[pre-commit.ci] pre-commit autoupdate (#882)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.1.6 → v0.2.0](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.6...v0.2.0)
- [github.com/psf/black: 23.11.0 → 24.1.1](https://github.com/psf/black/compare/23.11.0...24.1.1)

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

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

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-02-05 14:13:13 -08:00
Bas Nijholt
a47f7ce49f
Add requirements-locked.txt for WebApp (#897) 2024-01-05 17:51:10 -08:00
Bas Nijholt
99cbe75f30
Pin compatible requirements (#896) 2024-01-05 17:38:29 -08:00
Nilesh
9f8eb97cfc
Fix webapp not loading (#895) 2024-01-05 17:20:19 -08:00
Bas Nijholt
3118e6f308
pin click in requirements.txt 2023-12-20 07:15:20 -08:00
Bas Nijholt
88a8a6d00e
pin shiny in requirements.txt (#887) 2023-12-20 07:12:52 -08:00
Bas Nijholt
0723280a89
Fix sleep_mode + sleep_rgb_or_color_temp == "color_temp" in webapp (#740)
Thanks to @danielbrunt57 for reporting here
2023-08-11 00:00:16 +00:00
Bas Nijholt
db5f9d623c
Mention app more prominently and improve style (#725)
* Mention app more prominently

* Use dark-mode

* add setuptools

* no cyber

* no not run on PR

* Ruff fixes

* Add link

* remove unused deps
2023-08-08 17:34:35 -07:00
Bas Nijholt
f8e7880a96
Split up SunLightSettings and improve https://basnijholt.github.io/adaptive-lighting/ (#719)
* Split up SunLightSettings

* Renames

* factor out SunEvents

* more renames

* rewrite

* rewrite more

* simpler

* refactor

* refact

* raise

* refact

* rename

* move method

* clean

* Move to new module 'sun.py'

* make sun independent of HA

* rename

* Move to webapp/homeassistant_util_color.py

* Rework app

* Add link

* new plotting

* app changes

* fix tests

* test clean

* tz fixes

* fix

* use sed

* verbose

* fix tz

* fix

* tiem
2023-08-08 21:31:17 +00:00
Bas Nijholt
69355b8c3a
Small WebApp improvements (#716)
* Small WebApp improvements

* Add link
2023-08-07 00:20:58 +00:00
Bas Nijholt
943a6360c7
Add simple webapp to play with different parameters (#715)
* Add simple webapp to play with different parameters

* ignore
2023-08-06 16:42:56 -07:00