mirror of
https://github.com/basnijholt/adaptive-lighting.git
synced 2026-09-16 16:54:04 +02:00
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.
6.3 KiB
6.3 KiB
| icon |
|---|
| lucide/bot |
Automation Examples
Real-world automation examples showing how to integrate Adaptive Lighting with your Home Assistant setup.
Reset the manual_control status of a light after an hour.
- 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
Toggle multiple Adaptive Lighting switches to "sleep mode" using an input_boolean.sleep_mode.
- 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.
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
Additional Examples
Enable Sleep Mode at Bedtime
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
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
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
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
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
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