adaptive-lighting/docs/services.md

203 lines
9.6 KiB
Markdown
Raw Permalink Normal View History

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 c56869483760051599234b820b3cf44de128901f. * 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
---
icon: lucide/zap
---
# Services
Adaptive Lighting provides three services for programmatic control, allowing you to integrate with automations and scripts.
## adaptive_lighting.apply
Applies the current Adaptive Lighting settings to lights on demand. Useful for forcing an immediate update or applying settings to lights that aren't in the regular adaptation cycle.
Provide a switch in `entity_id`, a list of `lights`, or both.
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 c56869483760051599234b820b3cf44de128901f. * 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
### Parameters
<!-- CODE:START -->
<!-- from adaptive_lighting._docs_helpers import generate_apply_markdown_table -->
<!-- print(generate_apply_markdown_table()) -->
<!-- CODE:END -->
<!-- OUTPUT:START -->
<!-- ⚠️ This content is auto-generated by `markdown-code-runner`. -->
| Service data attribute | Description | Required | Type |
|:-------------------------|:--------------------------------------------------------------------------------------|:-----------|:---------------------|
| `entity_id` | The `entity_id` of the switch with the settings to apply. 📝 | ❌ | list of `entity_id`s |
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 c56869483760051599234b820b3cf44de128901f. * 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
| `lights` | A light (or list of lights) to apply the settings to. 💡 | ❌ | list of `entity_id`s |
| `transition` | Duration of transition when lights change, in seconds. 🕑 | ❌ | `float` 0-6553 |
| `adapt_brightness` | Whether to adapt the brightness of the light. 🌞 | ❌ | bool |
| `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 |
<!-- OUTPUT:END -->
### Example Usage
```yaml
# Apply current settings to specific lights
service: adaptive_lighting.apply
data:
entity_id: switch.adaptive_lighting_living_room
lights:
- light.floor_lamp
- light.desk_lamp
turn_on_lights: false
```
```yaml
# Force apply with custom transition
service: adaptive_lighting.apply
data:
entity_id: switch.adaptive_lighting_bedroom
transition: 5
adapt_brightness: true
adapt_color: true
```
---
## adaptive_lighting.set_manual_control
Marks or unmarks a light as "manually controlled". When a light is marked as manually controlled, Adaptive Lighting will not adjust it until the manual control flag is cleared.
Provide a switch in `entity_id`, a list of `lights`, or both.
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 c56869483760051599234b820b3cf44de128901f. * 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
### Parameters
<!-- CODE:START -->
<!-- from adaptive_lighting._docs_helpers import generate_set_manual_control_markdown_table -->
<!-- print(generate_set_manual_control_markdown_table()) -->
<!-- CODE:END -->
<!-- OUTPUT:START -->
<!-- ⚠️ This content is auto-generated by `markdown-code-runner`. -->
| Service data attribute | Description | Required | Type |
|:-------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-----------|:-----------------------------------------|
| `entity_id` | The `entity_id` of the switch in which to (un)mark the light as being `manually controlled`. 📝 | ❌ | list of `entity_id`s |
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 c56869483760051599234b820b3cf44de128901f. * 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
| `lights` | entity_id(s) of lights, if not specified, all lights in the switch are selected. 💡 | ❌ | list of `entity_id`s |
| `manual_control` | Whether to add ("true") or remove ("false") all adapted attributes of the light from the "manual_control" list, or the name of an attribute for selective addition. 🔒 | ❌ | bool or one of `['brightness', 'color']` |
<!-- OUTPUT:END -->
### Example Usage
```yaml
# Remove manual control from a light (resume adaptation)
service: adaptive_lighting.set_manual_control
data:
entity_id: switch.adaptive_lighting_living_room
lights:
- light.floor_lamp
manual_control: false
```
```yaml
# Mark a light as manually controlled (pause adaptation)
service: adaptive_lighting.set_manual_control
data:
entity_id: switch.adaptive_lighting_living_room
lights:
- light.floor_lamp
manual_control: true
```
```yaml
# Only pause brightness adaptation, continue color adaptation
service: adaptive_lighting.set_manual_control
data:
entity_id: switch.adaptive_lighting_living_room
lights:
- light.floor_lamp
manual_control: brightness
```
---
## adaptive_lighting.change_switch_settings
<!-- CODE:START -->
<!-- from adaptive_lighting.docs_gen import _transform_readme_links -->
<!-- print(_transform_readme_links(include_section("../README.md", "change-switch-settings", strip_heading=True))) -->
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 c56869483760051599234b820b3cf44de128901f. * 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
<!-- CODE:END -->
<!-- OUTPUT:START -->
<!-- ⚠️ This content is auto-generated by `markdown-code-runner`. -->
`adaptive_lighting.change_switch_settings` (new in 1.7.0) Change any of the above configuration options of Adaptive Lighting (such as `sunrise_time` or `prefer_rgb_color`) with a service call directly from your script/automation.
> [!WARNING]
> These settings will **not** be written to your config and will be reset on restart of Home Assistant! You can see the current settings in the `switch.adaptive_lighting_XXX` attributes if `include_config_in_attributes` is enabled.
| Service data attribute | Required | Description |
| --------------------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `use_defaults` | ❌ | (default: `current` for current settings) Choose from `factory`, `configuration`, or `current` to reset variables not being set with this service call. `current` leaves them as they are, `configuration` resets to initial startup values, `factory` resets to default values listed in the documentation. |
| **all other keys** (except the ones in the table below ⚠️) | ❌ | See the table below for disallowed keys. |
The following keys are disallowed:
| **DISALLOWED** service data | Description |
| --------------------------- | ----------------------------------------------------------------------------------------------- |
| `entity_id` | You cannot change the switch's `entity_id`, as it has already been registered. |
| `lights` | You may call `adaptive_lighting.apply` with your lights or create a new config instead. |
| `name` | You can rename your switch's display name in Home Assistant's UI. |
| `interval` | The interval is used only once when the config loads. A config change and restart are required. |
<!-- OUTPUT:END -->
### Example Usage
```yaml
# Temporarily change color temperature range
service: adaptive_lighting.change_switch_settings
data:
entity_id: switch.adaptive_lighting_living_room
min_color_temp: 2500
max_color_temp: 4000
```
```yaml
# Override sunrise time for the day
service: adaptive_lighting.change_switch_settings
data:
entity_id: switch.adaptive_lighting_bedroom
sunrise_time: "07:00:00"
use_defaults: current
```
```yaml
# Reset to configuration defaults
service: adaptive_lighting.change_switch_settings
data:
entity_id: switch.adaptive_lighting_living_room
use_defaults: configuration
```
---
## Events
Adaptive Lighting also fires events that you can use in automations.
### adaptive_lighting.manual_control
Fired when a light is marked as "manually controlled" due to a detected manual change.
**Event Data:**
| Attribute | Description |
|-----------|-------------|
| `entity_id` | The light that was marked as manually controlled |
| `switch` | The Adaptive Lighting switch entity |
### Example Automation
```yaml
automation:
- alias: "Log manual control events"
trigger:
platform: event
event_type: adaptive_lighting.manual_control
action:
- service: notify.mobile_app
data:
title: "Adaptive Lighting"
message: "{{ trigger.event.data.entity_id }} was manually controlled"
```
See [Automation Examples](automation-examples.md) for more use cases.