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.
This commit is contained in:
Bas Nijholt 2026-01-12 10:04:07 -08:00
commit 0fbab0a1fe
5 changed files with 18 additions and 594 deletions

View file

@ -104,11 +104,6 @@ def get_automation_examples() -> str:
return readme_section("automation-examples", strip_heading=True)
def get_troubleshooting() -> str:
"""Get the troubleshooting section."""
return readme_section("troubleshooting", strip_heading=True)
def get_troubleshooting_intro() -> str:
"""Get just the troubleshooting intro (debug logging)."""
return readme_section("troubleshooting-intro", strip_heading=True)
@ -129,11 +124,6 @@ def get_graphs() -> str:
return readme_section("graphs", strip_heading=True)
def get_sleep_mode_intro() -> str:
"""Get the sleep mode introduction."""
return readme_section("sleep-mode", strip_heading=True)
def get_see_also() -> str:
"""Get the see also section."""
return readme_section("see-also", strip_heading=True)

View file

@ -6,17 +6,6 @@ icon: lucide/moon
Sleep mode is a special operating mode that sets your lights to minimal brightness and very warm color, perfect for winding down at night without disrupting your circadian rhythm.
## Overview
When sleep mode is activated, Adaptive Lighting overrides normal sun-based calculations with fixed sleep settings:
| Setting | Default | Description |
|---------|---------|-------------|
| `sleep_brightness` | 1% | Very dim lighting |
| `sleep_color_temp` | 1000K | Very warm (candlelight) |
| `sleep_rgb_color` | `[255, 56, 0]` | Deep orange/red |
| `sleep_transition` | 1 second | Quick transition |
## Activating Sleep Mode
Each Adaptive Lighting configuration creates a sleep mode switch:
@ -35,168 +24,20 @@ target:
## Configuration Options
### sleep_brightness
Sleep mode is configured through the main Adaptive Lighting configuration. See the [Configuration](../configuration.md) page for the full options table. The sleep-related options are:
Sets the brightness level during sleep mode (1-100%).
```yaml
adaptive_lighting:
- name: "Bedroom"
lights:
- light.bedroom
sleep_brightness: 1 # Barely visible
```
### sleep_rgb_or_color_temp
Choose whether to use color temperature or RGB color in sleep mode:
| Value | Description |
|-------|-------------|
| `color_temp` | Use `sleep_color_temp` (default) |
| `rgb_color` | Use `sleep_rgb_color` |
### sleep_color_temp
The color temperature in Kelvin during sleep mode (when using `color_temp` mode).
```yaml
adaptive_lighting:
- name: "Bedroom"
lights:
- light.bedroom
sleep_rgb_or_color_temp: color_temp
sleep_color_temp: 1000 # Very warm
```
### sleep_rgb_color
The RGB color during sleep mode (when using `rgb_color` mode). Useful for bulbs that don't support very low color temperatures.
```yaml
adaptive_lighting:
- name: "Bedroom"
lights:
- light.bedroom
sleep_rgb_or_color_temp: rgb_color
sleep_rgb_color: [255, 56, 0] # Deep orange/red
```
### sleep_transition
The transition duration when entering or exiting sleep mode.
```yaml
adaptive_lighting:
- name: "Bedroom"
lights:
- light.bedroom
sleep_transition: 10 # Slow 10-second transition
```
### transition_until_sleep
When enabled, Adaptive Lighting treats sleep settings as the minimum values and gradually transitions to them after sunset. This creates a natural wind-down effect.
```yaml
adaptive_lighting:
- name: "Evening wind-down"
lights:
- light.living_room
transition_until_sleep: true
sleep_brightness: 10
sleep_color_temp: 2000
```
| Option | Default | Description |
|--------|---------|-------------|
| `sleep_brightness` | 1 | Brightness percentage in sleep mode |
| `sleep_rgb_or_color_temp` | `color_temp` | Use `rgb_color` or `color_temp` in sleep mode |
| `sleep_color_temp` | 1000 | Color temperature in Kelvin for sleep mode |
| `sleep_rgb_color` | `[255, 56, 0]` | RGB color for sleep mode |
| `sleep_transition` | 1 | Transition duration in seconds |
| `transition_until_sleep` | false | Gradually transition to sleep settings after sunset |
## Automation Examples
### Enable Sleep Mode at Bedtime
See [Automation Examples](../automation-examples.md) for sleep mode automation recipes, including:
```yaml
automation:
- alias: "Bedtime - enable sleep mode"
trigger:
- platform: time
at: "22:00:00"
action:
- service: switch.turn_on
target:
entity_id:
- switch.adaptive_lighting_sleep_mode_bedroom
- switch.adaptive_lighting_sleep_mode_hallway
```
### Sync with Input Boolean
```yaml
input_boolean:
sleep_mode:
name: "Sleep Mode"
icon: mdi:sleep
automation:
- alias: "Toggle sleep mode switches"
trigger:
- platform: state
entity_id: input_boolean.sleep_mode
action:
- service: "switch.turn_{{ states('input_boolean.sleep_mode') }}"
target:
entity_id:
- switch.adaptive_lighting_sleep_mode_bedroom
- switch.adaptive_lighting_sleep_mode_living_room
```
### Disable Sleep Mode at Wake Time
```yaml
automation:
- alias: "Morning - disable sleep mode"
trigger:
- platform: time
at: "07:00:00"
action:
- service: switch.turn_off
target:
entity_id:
- switch.adaptive_lighting_sleep_mode_bedroom
- switch.adaptive_lighting_sleep_mode_living_room
```
### Motion-Activated Night Light
```yaml
automation:
- alias: "Hallway night light"
trigger:
- platform: state
entity_id: binary_sensor.hallway_motion
to: "on"
condition:
- condition: time
after: "22:00:00"
before: "06:00:00"
action:
- service: switch.turn_on
target:
entity_id: switch.adaptive_lighting_sleep_mode_hallway
- service: light.turn_on
target:
entity_id: light.hallway
- wait_for_trigger:
- platform: state
entity_id: binary_sensor.hallway_motion
to: "off"
for: "00:02:00"
- service: light.turn_off
target:
entity_id: light.hallway
```
## Best Practices
1. **Use very low brightness** (1-5%) for true sleep mode
2. **Use warm colors** (1000-2000K) to minimize blue light exposure
3. **Consider RGB mode** if your bulbs can't achieve very warm temperatures
4. **Set up automations** to automatically enable/disable sleep mode
5. **Use `transition_until_sleep`** for a gradual evening wind-down
- Toggle sleep mode using an `input_boolean`
- Set sunrise/sunset based on alarm time

View file

@ -12,225 +12,7 @@ Real-world automation examples showing how to integrate Adaptive Lighting with y
<!-- print(get_automation_examples()) -->
<!-- CODE:END -->
<!-- OUTPUT:START -->
<!-- ⚠️ This content is auto-generated by `markdown-code-runner`. -->
<details>
<summary>Reset the <code>manual_control</code> status of a light after an hour.</summary>
```yaml
- alias: "Adaptive lighting: reset manual_control after 1 hour"
mode: parallel
trigger:
platform: event
event_type: adaptive_lighting.manual_control
variables:
light: "{{ trigger.event.data.entity_id }}"
switch: "{{ trigger.event.data.switch }}"
action:
- delay: "01:00:00"
- condition: template
value_template: "{{ light in state_attr(switch, 'manual_control') }}"
- service: adaptive_lighting.set_manual_control
data:
entity_id: "{{ switch }}"
lights: "{{ light }}"
manual_control: false
```
</details>
<details>
<summary>Toggle multiple Adaptive Lighting switches to "sleep mode" using an <code>input_boolean.sleep_mode</code>.</summary>
```yaml
- alias: "Adaptive lighting: toggle 'sleep mode'"
trigger:
- platform: state
entity_id: input_boolean.sleep_mode
- platform: homeassistant
event: start # in case the states aren't properly restored
variables:
sleep_mode: "{{ states('input_boolean.sleep_mode') }}"
action:
service: "switch.turn_{{ sleep_mode }}"
entity_id:
- switch.adaptive_lighting_sleep_mode_living_room
- switch.adaptive_lighting_sleep_mode_bedroom
```
Set your sunrise and sunset time based on your alarm. The below script sets sunset_time exactly 12 hours after the custom sunrise time.
```yaml
iphone_carly_wakeup:
alias: iPhone Carly Wakeup
sequence:
- condition: state
entity_id: input_boolean.carly_iphone_wakeup
state: "off"
- service: input_datetime.set_datetime
target:
entity_id: input_datetime.carly_iphone_wakeup
data:
time: '{{ now().strftime("%H:%M:%S") }}'
- service: input_boolean.turn_on
target:
entity_id: input_boolean.carly_iphone_wakeup
- repeat:
count: >
{{ (states.switch
| map(attribute="entity_id")
| select(">","switch.adaptive_lighting_al_")
| select("<", "switch.adaptive_lighting_al_z")
| join(",")
).split(",") | length }}
sequence:
- service: adaptive_lighting.change_switch_settings
data:
entity_id: switch.adaptive_lighting_al_den_ceilingfan_lights
sunrise_time: '{{ now().strftime("%H:%M:%S") }}'
sunset_time: >
{{ (as_timestamp(now()) + 12*60*60) | timestamp_custom("%H:%M:%S") }}
- service: script.turn_on
target:
entity_id: script.run_wakeup_routine
- service: input_boolean.turn_off
target:
entity_id:
- input_boolean.carly_iphone_winddown
- input_boolean.carly_iphone_bedtime
- service: input_datetime.set_datetime
target:
entity_id: input_datetime.wakeup_time
data:
time: '{{ now().strftime("%H:%M:%S") }}'
- service: script.adaptive_lighting_disable_sleep_mode
mode: queued
icon: mdi:weather-sunset
max: 10
```
</details>
<!-- OUTPUT:END -->
---
## Additional Examples
### Enable Sleep Mode at Bedtime
```yaml
automation:
- alias: "Enable sleep mode at bedtime"
trigger:
- platform: time
at: "22:00:00"
action:
- service: switch.turn_on
target:
entity_id:
- switch.adaptive_lighting_sleep_mode_bedroom
- switch.adaptive_lighting_sleep_mode_living_room
```
### Disable Sleep Mode in the Morning
```yaml
automation:
- alias: "Disable sleep mode in the morning"
trigger:
- platform: time
at: "07:00:00"
action:
- service: switch.turn_off
target:
entity_id:
- switch.adaptive_lighting_sleep_mode_bedroom
- switch.adaptive_lighting_sleep_mode_living_room
```
### Pause Adaptation During Movie Mode
```yaml
automation:
- alias: "Movie mode - pause adaptation"
trigger:
- platform: state
entity_id: input_boolean.movie_mode
to: "on"
action:
- service: switch.turn_off
target:
entity_id: switch.adaptive_lighting_living_room
- service: light.turn_on
target:
entity_id: light.living_room
data:
brightness_pct: 10
color_temp_kelvin: 2200
- alias: "Movie mode - resume adaptation"
trigger:
- platform: state
entity_id: input_boolean.movie_mode
to: "off"
action:
- service: switch.turn_on
target:
entity_id: switch.adaptive_lighting_living_room
```
### Sync Sleep Mode with Bedtime Routine
```yaml
automation:
- alias: "Bedtime routine activates sleep mode"
trigger:
- platform: state
entity_id: input_boolean.bedtime
to: "on"
action:
- service: switch.turn_on
target:
entity_id:
- switch.adaptive_lighting_sleep_mode_bedroom
- switch.adaptive_lighting_sleep_mode_hallway
- service: light.turn_on
target:
entity_id: light.bedroom
```
### Reset Manual Control When Leaving Home
```yaml
automation:
- alias: "Reset manual control when leaving"
trigger:
- platform: state
entity_id: person.your_name
from: "home"
action:
- service: adaptive_lighting.set_manual_control
data:
entity_id: switch.adaptive_lighting_living_room
manual_control: false
```
### Adjust Settings Based on Weather
```yaml
automation:
- alias: "Cloudy day - increase brightness"
trigger:
- platform: state
entity_id: weather.home
condition:
- condition: state
entity_id: weather.home
state: "cloudy"
action:
- service: adaptive_lighting.change_switch_settings
data:
entity_id: switch.adaptive_lighting_living_room
min_brightness: 40
max_brightness: 100
```
!!! tip "Have a useful automation?"
Share your automation examples by [opening an issue](https://github.com/basnijholt/adaptive-lighting/issues) or submitting a pull request to the README.

View file

@ -72,74 +72,10 @@ adaptive_lighting:
max_brightness: 80
sleep_brightness: 1
sleep_color_temp: 1000
- name: "Night Lights"
lights:
- light.hallway_night
- light.bathroom_night
min_brightness: 1
max_brightness: 20
```
## Option Categories
## Related Topics
### Brightness Settings
| Option | Description |
|--------|-------------|
| `min_brightness` | Minimum brightness (1-100%) |
| `max_brightness` | Maximum brightness (1-100%) |
| `brightness_mode` | How brightness changes (`default`, `linear`, `tanh`) |
| `brightness_mode_time_dark` | Ramp duration before/after sunrise/sunset |
| `brightness_mode_time_light` | Ramp duration after/before sunrise/sunset |
See [Brightness Modes](advanced/brightness-modes.md) for detailed explanations.
### Color Temperature Settings
| Option | Description |
|--------|-------------|
| `min_color_temp` | Warmest temperature in Kelvin |
| `max_color_temp` | Coldest temperature in Kelvin |
| `prefer_rgb_color` | Use RGB instead of color temperature |
### Sleep Mode Settings
| Option | Description |
|--------|-------------|
| `sleep_brightness` | Brightness in sleep mode (1-100%) |
| `sleep_color_temp` | Color temperature in sleep mode |
| `sleep_rgb_color` | RGB color for sleep mode |
| `sleep_transition` | Transition duration for sleep mode |
| `transition_until_sleep` | Gradually transition to sleep settings after sunset |
See [Sleep Mode](advanced/sleep-mode.md) for more details.
### Manual Control Settings
| Option | Description |
|--------|-------------|
| `take_over_control` | Detect manual changes and pause adaptation |
| `detect_non_ha_changes` | Detect changes made outside Home Assistant |
| `autoreset_control_seconds` | Auto-reset manual control after this many seconds |
See [Manual Control](advanced/manual-control.md) for detailed behavior.
### Timing Settings
| Option | Description |
|--------|-------------|
| `sunrise_time` | Fixed sunrise time (overrides actual) |
| `sunset_time` | Fixed sunset time (overrides actual) |
| `sunrise_offset` | Offset from actual sunrise in seconds |
| `sunset_offset` | Offset from actual sunset in seconds |
| `min_sunrise_time` / `max_sunrise_time` | Constrain virtual sunrise |
| `min_sunset_time` / `max_sunset_time` | Constrain virtual sunset |
### Transition Settings
| Option | Description |
|--------|-------------|
| `transition` | Duration for regular transitions (seconds) |
| `initial_transition` | Duration when lights first turn on |
| `interval` | How often to adapt lights (seconds) |
- [Brightness Modes](advanced/brightness-modes.md) - Detailed explanation of brightness calculation modes
- [Sleep Mode](advanced/sleep-mode.md) - Sleep mode configuration
- [Manual Control](advanced/manual-control.md) - How manual control detection works

View file

@ -14,18 +14,6 @@ This guide covers common issues and their solutions when using Adaptive Lighting
<!-- print(get_troubleshooting_intro()) -->
<!-- CODE:END -->
<!-- OUTPUT:START -->
<!-- ⚠️ This content is auto-generated by `markdown-code-runner`. -->
Encountering issues? Enable debug logging in your `configuration.yaml`:
```yaml
logger:
default: warning
logs:
custom_components.adaptive_lighting: debug
```
After the issue occurs, create a new issue report with the log (`/config/home-assistant.log`).
<!-- OUTPUT:END -->
## Common Problems & Solutions
@ -36,121 +24,8 @@ After the issue occurs, create a new issue report with the log (`/config/home-as
<!-- print(get_common_problems()) -->
<!-- CODE:END -->
<!-- OUTPUT:START -->
<!-- ⚠️ This content is auto-generated by `markdown-code-runner`. -->
#### :bulb: Lights Not Responding or Turning On by Themselves
Adaptive Lighting sends more commands to lights than a typical human user would. If your light control network is unhealthy, you may experience:
- Laggy manual commands (e.g., turning lights on or off).
- Unresponsive lights.
- Home Assistant reporting incorrect light states, causing Adaptive Lighting to inadvertently turn lights back on.
Most issues that appear to be caused by Adaptive Lighting are actually due to unrelated problems.
Addressing these issues will significantly improve your Home Assistant experience.
In case lights are suddenly turning on by themselves, this is most likely due to the light incorrectly reporting an "on" state to Home Assistant, leading to an undesired Adaptive Lighting action.
To prevent adapting in cases *where the state of the light is suddenly "on" and only adapt if there is an associated `light.turn_on` service call*, set `detect_non_ha_changes: false`.
#### :signal_strength: WiFi Networks
Ensure your light bulbs have a strong WiFi connection. If the signal strength is less than -70dBm, the connection may be weak and prone to dropping messages.
#### :spider_web: Zigbee, Z-Wave, and Other Mesh Networks
Mesh networks typically require powered devices to act as routers, relaying messages back to the central coordinator (the radio connected to Home Assistant).
Philips lights usually function as routers, while Ikea, Sengled, and generic Tuya bulbs often do not.
If devices become unresponsive or fail to respond to commands, Adaptive Lighting can exacerbate the issue.
Use network maps (available in ZHA, zigbee2mqtt, deCONZ, and ZWaveJS UI) to evaluate your network health.
Smart plugs can be an affordable way to add more routers to your network.
For most Zigbee networks, **using groups is essential for optimal performance**.
For example, if you want to use Adaptive Lighting in a hallway with six bulbs, adding each bulb individually to the Adaptive Lighting configuration could overwhelm the network with commands.
Instead, create a group in your Zigbee software (not a regular Home Assistant group) and add that single group to the Adaptive Lighting configuration.
This sends a single broadcast command to adjust all bulbs, improving response times and keeping the bulbs in sync.
As a rule of thumb, if you always control lights together (e.g., bulbs in a ceiling fixture), they should be in a Zigbee group.
Expose only the group (not individual bulbs) in Home Assistant Dashboards and external systems like Google Home or Apple HomeKit.
> :warning: **If you control lights individually, `manual_control` cannot behave correctly! If you need to control lights individually as well, use a [Home Assistant Light Group](https://www.home-assistant.io/integrations/group/).**
#### :rainbow: Light Colors Not Matching
Bulbs from different manufacturers or models may have varying color temperature specifications. For instance, if you have two Adaptive Lighting configurations—one with only Philips Hue White Ambiance bulbs and another with a mix of Philips Hue White Ambiance and Sengled bulbs—the Philips Hue bulbs may appear to have different color temperatures despite having identical settings.
To resolve this:
1. Include only bulbs of the same make and model in a single Adaptive Lighting configuration.
2. Rearrange bulbs so that different color temperatures are not visible simultaneously.
#### :bulb: Bulb-Specific Issues
These lights are known to exhibit disadvantageous behaviour due to firmware bugs, insufficient functionality, or hardware limitations:
- [Sengled Z01-A19NAE26](https://www.zigbee2mqtt.io/devices/Z01-A19NAE26.html#sengled-z01-a19nae26)
- Unexpected turn-ons: If Adaptive Lighting sends a long transition time (like the default 45 seconds), and the bulb is turned off during that time, it may turn back on after approximately 10 seconds to continue the transition command. Since the bulb is turning itself on, there will be no obvious trigger in Home Assistant or other logs indicating the cause of the light turning on. To fix this, set a much shorter `transition` time, such as 1 second.
- Heat sensitivity: Additionally, these bulbs may perform poorly in enclosed "dome" style ceiling lights, particularly when hot. While most LEDs (even non-smart ones) state in the fine print that they do not support working in enclosed fixtures, in practice, more expensive bulbs like Philips Hue generally perform better. To resolve this issue, move the problematic bulbs to open-air fixtures.
- Ikea Tradfri bulbs/drivers (and related Ikea smart light products)
- Unsupported simultaneous transition of brightness and color: When receiving such a command, they switch the brightness instantly and only transition the color. To get smooth transitions of both brightness and color, enable `separate_turn_on_commands`.
- Unresponsiveness during color transitions: No other commands are processed during an ongoing color transition, e.g., turn-off commands are ignored and lights stay on despite being reported as off to Home Assistant. The default config with long transitions thus results in long periods of unresponsiveness. To work around this, disable transitions by setting `transition` to `0`, and increase the adaptation frequency by setting `interval` to a short time, e.g., `15` seconds, to retain the impression of smooth continuous adaptations. Keeping the `initial_transition` is recommended for a smooth fade-in (lights are usually not turned off momentarily after being turned on, in which case a short period of unresponsiveness is tolerable).
<!-- OUTPUT:END -->
---
## Additional Troubleshooting Tips
### Lights Flickering
If your lights flicker when Adaptive Lighting adjusts them:
1. **Increase transition time**: Set `transition: 60` or higher
2. **Reduce adaptation frequency**: Set `interval: 120` or higher
3. **Enable `skip_redundant_commands`**: This reduces unnecessary commands
```yaml
adaptive_lighting:
- name: "Anti-flicker"
lights:
- light.problem_light
transition: 60
interval: 120
skip_redundant_commands: true
```
### Lights Not Adapting
If lights aren't being adapted:
1. Check that the main switch is on: `switch.adaptive_lighting_<name>`
2. Check that the light isn't marked as manually controlled (check switch attributes)
3. Verify the light is in the configuration's `lights` list
4. Check debug logs for errors
### Color Temperature Looks Wrong
Different bulb manufacturers have varying color temperature implementations:
1. **Group similar bulbs**: Only include bulbs of the same make/model in one configuration
2. **Adjust the range**: Some bulbs may need narrower `min_color_temp`/`max_color_temp` ranges
3. **Use RGB instead**: Set `prefer_rgb_color: true` for more consistent colors
### Slow Response to Changes
If adaptation seems delayed:
1. **Reduce interval**: Set `interval: 30` for faster updates
2. **Enable intercept**: Set `intercept: true` for instant adaptation on turn-on
3. **Check network**: Ensure your light network is healthy (see WiFi/Zigbee sections above)
### Integration Not Loading
If Adaptive Lighting doesn't load:
1. Check that `adaptive_lighting:` is in your `configuration.yaml`
2. Verify the integration is installed correctly in `custom_components/`
3. Check the Home Assistant logs for errors
4. Ensure you're running a compatible Home Assistant version (2024.12.0+)
## Getting Help
If you're still having issues: