Commit graph

143 commits

Author SHA1 Message Date
Bas Nijholt
87486f9eb3
Set conservative line and branch coverage floors for stable HA versions (#1566) 2026-09-06 17:18:47 +02:00
Bas Nijholt
472796215b
Implement collapsible sections for options flow (#1313)
* Implement collapsible sections for options flow

Replace single-form options flow with collapsible sections:
- Basic options always visible (9 fields)
- Advanced options in collapsed section (collapsed by default)
- Single form, no multi-step navigation needed

Changes:
- const.py: Add BASIC_OPTIONS set defining which options are basic
- config_flow.py: Use section() from data_entry_flow to wrap advanced options
- strings.json: Restructure with sections.advanced for section translations
- tests: Update to handle nested section input format

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

* Fix: Use vol.Required for section to render properly

* Fix section structure: separate basic and advanced fields in strings.json

* Remove accidentally added files

* Add local directories to gitignore

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

* Preserve options behavior with collapsible sections

* Test serialized advanced options section

* fix: preserve config metadata when retrying options

* fix: keep options form defaults serializable

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-09-06 17:18:42 +02:00
Bas Nijholt
c19715dadd
Publish line and branch coverage reports in CI (#1564)
* Report line and branch coverage in CI

* docs: explain coverage reports and behavioral tests

* Calculate coverage percentages from counts for older versions
2026-09-06 17:09:35 +02:00
Bas Nijholt
a04a533f45
ci: support one year of Home Assistant releases (#1546) 2026-09-06 12:17:22 +02:00
Adam DeMuri
4b0638a4d8
Only run the validate_hacs CI action on the upstream repo. (#1423)
This avoids running this action on forks, since they likely won't have
issues or topics enabled, and shouldn't need them.

Co-authored-by: Bas Nijholt <basnijholt@users.noreply.github.com>
Co-authored-by: Bas Nijholt <bas@nijho.lt>
2026-09-06 11:35:02 +02:00
renovate[bot]
548e5048ec
⬆️ Pin dependencies (#1475)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-09-06 11:34:59 +02:00
Bas Nijholt
c7339678a6
ci: check out the workflow commit during test setup (#1522) 2026-09-06 10:32:01 +02:00
renovate[bot]
5df9b30d32
⬆️ Update actions/checkout action to v7 (#1479)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Bas Nijholt <bas@nijho.lt>
2026-09-06 08:45:48 +02:00
renovate[bot]
19dd9723a3
⬆️ Update python to v3.14.7 (#1419) 2026-09-06 08:30:13 +02:00
renovate[bot]
928d57f8be
⬆️ Update actions/setup-python action to v7 (#1493) 2026-09-06 08:28:58 +02:00
renovate[bot]
f3af35f95e
⬆️ Update astral-sh/setup-uv action to v10 (#1501) 2026-09-06 08:28:48 +02:00
renovate[bot]
4a87b5ef54
⬆️ Update astral-sh/setup-uv action to v9 (#1496)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-07-29 14:02:37 -07:00
renovate[bot]
ddaf851be3
⬆️ Update release-drafter/release-drafter action to v7
Squash merge Renovate GitHub Actions update.

Validation:
- Fixed PR-time Release Drafter v7 execution by using dry-run for pull_request events.
- GitHub Actions checks for PR #1445 passed before merge.
2026-04-24 14:55:04 -07:00
renovate[bot]
89b5e9a14f
⬆️ Update docker/setup-qemu-action action to v4
Squash merge Renovate GitHub Actions update.

Validation:
- GitHub Actions checks for PR #1438 passed before merge.
2026-04-24 14:23:26 -07:00
renovate[bot]
7dcad99d81
⬆️ Update docker/setup-buildx-action action to v4 (#1439)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-04-24 13:13:53 -07:00
renovate[bot]
cb4eb7ef49
⬆️ Update actions/deploy-pages action to v5 (#1453)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-04-24 13:13:34 -07:00
renovate[bot]
17e43e0427
⬆️ Update astral-sh/setup-uv action to v8 (#1468)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-04-24 13:13:15 -07:00
renovate[bot]
c8c31be573
⬆️ Update actions/upload-pages-artifact action to v5 (#1467)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-04-24 13:12:01 -07:00
renovate[bot]
86091de0e7
⬆️ Update docker/login-action action to v4 (#1437)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-04-24 12:00:21 -07:00
renovate[bot]
31762ba78d
⬆️ Update docker/metadata-action action to v6 (#1440)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-04-24 12:00:10 -07:00
renovate[bot]
0a305a7a4c
⬆️ Update docker/build-push-action action to v7 (#1441)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-04-24 11:59:38 -07:00
Bas Nijholt
c4b8e28ea8
fix: restore hassfest and Home Assistant CI
## Summary
- fix hassfest validation by replacing raw options-description URLs with Home Assistant translation placeholders
- extend the pytest CI matrix to cover the latest patch release for each Home Assistant month, plus dev
- align CI/dev container Python versions and tests with newer Home Assistant behavior

## Validation
- GitHub Actions pytest matrix passed for 2024.12.5 through 2026.4.3 plus dev
- Docker passed for linux/amd64 and linux/arm64
- hassfest, HACS validation, pre-commit, pre-commit.ci, markdown-code-runner, docs build, and Release Drafter passed
2026-04-24 11:31:53 -07:00
renovate[bot]
74a795d907
⬆️ Update actions/checkout action to v6.0.2 (#1411)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-01-22 23:02:25 +00:00
Adam DeMuri
d964c861d5 Fix the markdown-code-runner workflow.
This fixes the workflow to work for pull requests in addition to pushes:
- Correctly determines the repository and branch
- For pull requests, if there are changes, fails with a message to make
  the changes locally
- Extracts the commands to update generated files into a script
2026-01-20 01:10:17 +00:00
Adam DeMuri
e656dd31b0
Fix coverage. (#1404) 2026-01-19 17:03:20 +00:00
renovate[bot]
fcff6d48ec
⬆️ Update astral-sh/setup-uv action to v7 (#1392) 2026-01-13 09:07:28 +01:00
renovate[bot]
093376dbed
⬆️ Update actions/setup-python action to v6 (#1390) 2026-01-13 09:06:58 +01:00
renovate[bot]
455040e532
⬆️ Update actions/checkout action to v6 (#1389) 2026-01-13 09:06:42 +01:00
renovate[bot]
9480211e1b ⬆️ Update python to v3.14.2 2026-01-12 23:49:27 +01:00
renovate[bot]
a1ddbc000f ⬆️ Pin dependencies 2026-01-12 23:46:08 +01:00
Bas Nijholt
cbbcabdd1f
Add documentation site with Zensical framework (#1385)
* Add documentation site with Zensical framework

Create comprehensive documentation site for adaptive-lighting.nijho.lt:

- Add zensical.toml configuration with Material theme (amber/orange)
- Create docs_gen.py module for extracting README sections via markers
- Add section markers to README.md for content reuse
- Create documentation pages:
  - index.md: Home with features overview
  - getting-started.md: Installation and quick setup
  - configuration.md: Auto-generated config options table
  - services.md: Auto-generated service documentation
  - automation-examples.md: Real-world automation recipes
  - troubleshooting.md: Common issues and solutions
  - see-also.md: External resources and links
  - advanced/brightness-modes.md: Brightness mode deep dive
  - advanced/manual-control.md: Manual control system docs
  - advanced/sleep-mode.md: Sleep mode configuration
- Add GitHub Actions workflow for building and deploying to Pages
- Add custom CSS with sun-themed styling
- Add CNAME for custom domain

Uses markdown-code-runner to auto-generate content from code schemas
and extract README sections for single-source documentation.

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

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

* Remove duplicated content from docs, make pages thin wrappers

- troubleshooting.md: Remove manually written "Additional Tips" section
- automation-examples.md: Remove duplicate "Additional Examples" section
- configuration.md: Remove duplicate "Option Categories" tables
- sleep-mode.md: Simplify to reference main config, remove duplicate examples
- docs_gen.py: Remove unused get_troubleshooting() and get_sleep_mode_intro()

This reduces duplication risk by keeping README as single source of truth.
Docs pages now primarily pull content via markdown-code-runner.

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

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

* Integrate webapp (simulator) into docs workflow

- Merge deploy-webapp.yml into docs.yml workflow
- Build simulator and place at /simulator/ subdirectory
- Update docs links to use relative paths to simulator
- Remove separate deploy-webapp.yml to avoid conflicts

The combined workflow now:
1. Builds docs with zensical
2. Builds webapp with shinylive
3. Copies webapp to site/simulator/
4. Deploys everything to GitHub Pages

Simulator will be at adaptive-lighting.nijho.lt/simulator/

* Fix pre-commit and CI issues

- Add site_name to zensical.toml (required by MkDocs)
- Fix RET504 in docs_gen.py (unnecessary assignment before return)
- Remove docs/run_markdown_code_runner.py (lint issues, not needed for CI)

* Fix _docs_helpers.py import error in CI

- Add try/except for relative vs absolute imports in _docs_helpers.py
- Remove silent error handling in docs workflow (fail on error)

The relative import fails when markdown-code-runner executes the code
directly via sys.path.insert. The fallback to absolute import fixes this.

* Temporarily enable deployment from feature branch

* Add tabulate dependency for pandas to_markdown()

* Fix theme configuration for proper light/dark mode

- Restructure zensical.toml to match working agent-cli config
- Add three-way palette toggle (system/light/dark)
- Use proper [project.theme] structure
- Simplify extra.css to not override theme colors
- Add Inter font for text, JetBrains Mono for code

* Add Plausible analytics and fix homepage navigation

- Add custom analytics override for plausible.nijho.lt tracking
- Remove hide:navigation from index.md to show menu on homepage

* Remove temporary feature branch deployment settings

Revert to main-only deployment for docs workflow before merging.

* Revert "Remove temporary feature branch deployment settings"

This reverts commit c568694837.

* Add markdown-gfm-admonition for GitHub-style admonitions

The zensical build was failing silently because gfm_admonition extension
was not installed. Add the dependency to pyproject.toml and docs workflow.

* Use uv sync for documentation dependencies

Switch from manual pip installs to uv sync with pyproject.toml for cleaner
dependency management and reproducible builds.

* Fix markdown rendering inside details blocks

Enable md_in_html extension and add markdown="1" attribute to <details>
tags so markdown content inside them is properly rendered.

* Remove emojis from manually written documentation

Keep emojis in auto-generated content from README, but remove from
manually maintained docs in favor of clean text and Material icons.

* Enable attr_list extension for button styling

* Improve pyproject.toml and use GitHub-style admonitions

- Add accurate project metadata (version, authors, classifiers, URLs)
- Organize dependency groups: docs, dev, test
- Add tool configs for ruff, mypy, pytest
- Convert MkDocs-style admonitions (!!! tip) to GitHub-style (> [!TIP])
- Use docs group in CI workflow

* Add homeassistant and ulid-transform as runtime dependencies

Remove speculative test dependencies since tests run inside HA core.

* Simplify docs_gen.py - remove wrapper functions

Use readme_section() directly in docs instead of 10 one-liner wrappers.
Changed default strip_heading to True since that's the common case.

* Populate empty OUTPUT sections with markdown-code-runner

* Add markdown-code-runner workflow for auto-updating docs

- Add docs/run_markdown_code_runner.py script to process all docs
- Add GitHub workflow to run on push/PR and auto-commit changes

* Exclude README.md from markdown-code-runner workflow

README.md contains code blocks that import from
homeassistant.components.adaptive_lighting, which only exists
when running inside Home Assistant core, not in a regular venv.

* Update auto-generated docs

* Use editable install for markdown-code-runner workflow

- Add setuptools.packages.find config pointing to custom_components
- Remove sys.path.insert manipulation from all docs files
- Update imports to use adaptive_lighting.* package paths
- Install package with `uv pip install -e .` in workflow
- Remove deprecated license classifier (PEP 639)

* Consolidate markdown-code-runner into single workflow

- Remove separate markdown-code-runner.yml workflow
- Update update-readme.yml to handle all markdown files (docs + README)
- Rename workflow to "Update auto-generated content"
- Update README imports to use adaptive_lighting package path

* Rename workflow to markdown-code-runner

* Remove accidentally committed files

* Remove redundant markdown-code-runner from docs workflow

* Fix: use uv pip install instead of uv add in CI

* Add webapp deps (astral, shinylive) to docs group

* Remove unused install_dependencies action

* Update to latest action versions (uv@v5, upload-pages-artifact@v4)

* Remove try/except import fallback in _docs_helpers.py

* Restore install_dependencies action (used by pytest)

* Simplify docs workflow: run on all pushes/PRs

* Simplify mcr workflow paths; revert install_dependencies to main

* Remove redundant cp+sed for webapp (file already in repo)

* Fix mcr push: pull --rebase before push

* Fix mcr: checkout PR branch instead of detached HEAD

* Update auto-generated content

* Switch from setuptools to hatch build system

Replace [tool.setuptools.packages.find] with [tool.hatch.build.targets.wheel]
for hatchling compatibility.

* Update auto-generated content

* Move homeassistant deps to docs group

This is a HA custom component, not a pip package. The homeassistant
dependency is only needed for docs building, not as a project dependency.

* Update auto-generated content

* Remove PyPI-only metadata from pyproject.toml

* Remove arbitrary version constraints from dependency groups

* Update auto-generated content

* Remove unused troubleshooting section markers from README

* Remove temporary feature branch settings from docs workflow

* Use GitHub admonition syntax for warning in change_switch_settings section

* Update auto-generated content
2026-01-12 23:39:57 +01:00
renovate[bot]
828f73d481
⬆️ Update actions/checkout action to v6 (#1352)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-12 13:59:40 -08:00
lenucksi
9c7a95f696
fix(ci): fix broken Docker workflow and modernize (#1318)
* fix(ci): fix broken Docker workflow and modernize

## Critical Bug Fixes

1. **Fix broken push condition** (CRITICAL):
   - Old: `push: ${{ github.ref == 'refs/heads/master' }}`
   - Problem: Branch renamed to `main`, so images NEVER pushed
   - New: `push: ${{ github.event_name != 'pull_request' }}`
   - Result: Docker images will actually be published again

2. **Add missing checkout step**:
   - Build was failing because source code wasn't checked out
   - Required for Docker build context

## Modernization Improvements

3. **Migrate to GitHub Container Registry (GHCR)**:
   - Old: DockerHub with `DOCKERHUB_USERNAME` and `DOCKERHUB_TOKEN` secrets
   - New: GHCR with built-in `GITHUB_TOKEN`
   - Benefits: No external account required, better integration

4. **Add semantic versioning**:
   - Automatically tags releases: `v1.2.3`, `v1.2`, `v1`, `latest`
   - Supports version tags (v*), branches, and PRs
   - Uses docker/metadata-action for automatic tagging

5. **Add GitHub Actions caching**:
   - Uses `type=gha` cache for faster builds
   - Reduces build times and GitHub Actions minutes

6. **Security: Digest pinning**:
   - All actions pinned to commit SHAs
   - Prevents supply chain attacks via tag manipulation
   - Follows security best practices

7. **Add explicit permissions**:
   - Minimal required permissions (contents: read, packages: write)
   - Follows principle of least privilege

8. **Add workflow triggers**:
   - Tags (v*) for releases
   - Pull requests for testing
   - Manual dispatch for on-demand builds

## Testing

- Workflow syntax validated
- Push logic tested with different event types
- Compatible with existing Docker build process

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* refactor(ci): simplify docker workflow

- Use version tags instead of SHA pins for readability
- Remove verbose step names (action names are self-documenting)
- Compact YAML formatting
- Fix actions/checkout to v4 (v6 doesn't exist)

---------

Co-authored-by: Bas Nijholt <bas@nijho.lt>
2025-12-12 13:49:45 -08:00
renovate[bot]
37ef65586d
⬆️ Update python to v3.14.2 (#1251)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-09 23:31:41 -08:00
renovate[bot]
97ecbb17a0
⬆️ Update actions/checkout action to v6.0.1 (#1328)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-09 23:31:17 -08:00
renovate[bot]
ef15d5cd48
⬆️ Update peter-evans/create-pull-request action to v8 (#1334)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-09 23:31:05 -08:00
renovate[bot]
886c77bcc2
⬆️ Update actions/setup-python action to v6 (#1327)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-30 22:54:08 -08:00
lenucksi
077e086424
fix(ci): correct branch name and path in update-readme workflow (#1321) 2025-11-30 08:22:57 -08:00
renovate[bot]
1be701994b
⬆️ Pin python to 3.12.12 (#1323) 2025-11-30 08:16:24 -08:00
renovate[bot]
fb6e96c878
⬆️ Update actions/checkout action to v6 (#1324) 2025-11-30 08:16:05 -08:00
Lenucksi
cc25a50401 ci: add automated weekly test matrix updates
Add automation to keep the pytest test matrix up-to-date with latest
Home Assistant Core releases:

1. **Weekly Automation**: New workflow updates test matrix automatically
2. **Version Fetcher**: Python script queries GitHub API for latest HA Core releases
3. **PR Creation**: Automatically creates PRs when new versions are available

## Benefits
- No more manual updates when new HA Core versions are released
- Automatic tracking of new HA Core releases
- Reduces maintenance burden

## Background
This builds on commit a982acb which fixed mypy-dev pinning. While upstream
now installs latest mypy-dev automatically, the test matrix versions still
need manual updates. This automation solves that remaining manual task.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-30 08:09:19 -08:00
lenucksi
894d0025cd
fix(ci): add branch filter to TOC generator workflow (#1320) 2025-11-30 08:06:21 -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
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
e8af7a485e
Bump to 1.27.0 for fixes in 2025.12 (#1293) 2025-11-27 09:06:41 -08: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
Bas Nijholt
ded439e6f7
Fix Docker setup and CI installation (#1212) 2025-06-15 21:31:51 -07:00