Files
John Ogle 14fadbe44e Add custom mode tutorial and update docs for pure blueprint architecture
Add ADDING_MODES.md tutorial covering:
- UI-created modes (recommended) and package-defined modes
- Complete schema reference with nested al_config
- Behavior types (adaptive_lighting, scene, script)
- Manual control support and advanced examples

Update all documentation to reflect:
- Zero YAML editing for room setup (UI-driven workflow)
- Convention-based mode lookup pattern
- Pure blueprint architecture (3 core + 3 optional blueprints)
- Extensibility via helpers instead of template copying
2025-12-21 17:44:47 -08:00

15 KiB

Home Assistant Blueprints

Adaptive Lighting Mode System

A comprehensive mode-based lighting control system with pure blueprint architecture and zero YAML editing for room setup. Features convention-based mode lookup allowing unlimited custom modes with no code changes.

Features

  • Convention-based mode lookup: Add "Bowling" mode by creating one helper - no code changes needed
  • UI-driven room configuration: Setup entire rooms via Home Assistant UI - zero YAML editing required
  • Weekend mode blueprints: Automatic schedule adjustments for weekends (delayed sunrise, extended sunset)
  • Extensible behavior system: Supports Adaptive Lighting, scene-based, and script-based modes
  • Manual control support: Any mode can pause AL with manual_control attribute
  • Visual LED feedback: LED bar color indicates current mode (optional Inovelli integration)
  • 8 essential modes: Adaptive, Relaxing, Sleep, Theater, Party, Cooking, Dining, Cleanup

Architecture

Pure blueprint architecture with global mode definitions:

  • 3 core blueprints: Mode application + 2 weekend mode blueprints
  • 1 global package: 8 shipped modes with nested JSON schema
  • UI-created helpers: Room-specific dropdowns and toggles created via Settings → Helpers
  • UI-created automations: No package copying or YAML editing required

Key principle: Convention over configuration - modes are discovered by naming convention, not hardcoded logic.

Quick Start

Step 1: Install Adaptive Lighting integration via HACS

Step 2: Import blueprints

Settings → Automations & Scenes → Blueprints → Import Blueprint

Import URLs (see below for full list)

Step 3: Install global package

Follow PACKAGE_SETUP_GUIDE.md to install adaptive_lighting_global.yaml

Step 4: Create helpers and automations via UI

Follow ROOM_CONFIGURATION_GUIDE.md for complete UI workflow

Step 5: (Optional) Add custom modes

Follow ADDING_MODES.md to create "Reading" mode or any custom mode

Documentation

File Inventory

Blueprints (3 core + 3 optional):

Core blueprints (required for mode system):

  • blueprints/automation/apply_lighting_mode.yaml - Data-driven mode application with convention-based entity lookup
  • blueprints/automation/weekend_mode_schedule.yaml - Auto-enable/disable weekend mode based on day of week
  • blueprints/automation/weekend_mode_apply_settings.yaml - Apply AL adjustments when weekend mode toggles

Optional blueprints (for Inovelli switches and presence-based automation):

  • blueprints/automation/inovelli_mode_cycling.yaml - Config button cycles modes with LED feedback
  • blueprints/automation/inovelli_button_actions.yaml - Multi-tap brightness controls
  • blueprints/automation/presence_mode_reset.yaml - Auto-reset mode on room exit

Packages (1 file):

  • packages/adaptive_lighting_global.yaml - Global mode definitions (8 modes with nested schema)

Documentation (6 files):

  • README.md - Main documentation (this file)
  • PACKAGE_SETUP_GUIDE.md - Global package installation
  • ROOM_CONFIGURATION_GUIDE.md - UI-driven room setup
  • ADDING_MODES.md - Custom mode creation tutorial
  • CLAUDE.md - Claude Code instructions
  • ADAPTIVE_LIGHTING_CONTROL_SYSTEM_DESIGN.md - Architecture design doc

Import URLs

Core mode system blueprints:

https://git.johnogle.info/johno/home-assistant-blueprints/raw/branch/main/blueprints/automation/apply_lighting_mode.yaml
https://git.johnogle.info/johno/home-assistant-blueprints/raw/branch/main/blueprints/automation/weekend_mode_schedule.yaml
https://git.johnogle.info/johno/home-assistant-blueprints/raw/branch/main/blueprints/automation/weekend_mode_apply_settings.yaml

Optional Inovelli and presence blueprints:

https://git.johnogle.info/johno/home-assistant-blueprints/raw/branch/main/blueprints/automation/inovelli_mode_cycling.yaml
https://git.johnogle.info/johno/home-assistant-blueprints/raw/branch/main/blueprints/automation/inovelli_button_actions.yaml
https://git.johnogle.info/johno/home-assistant-blueprints/raw/branch/main/blueprints/automation/presence_mode_reset.yaml

Extensibility Example

Traditional approach (hardcoded): Adding "Bowling" mode requires editing blueprint code, modifying choose blocks, updating all rooms.

Convention-based approach (this system): Create ONE helper via UI:

  1. Settings → Helpers → Create Text input
  2. Name: input_text.adaptive_lighting_settings_bowling
  3. Value: {"behavior":"adaptive_lighting","manual_control":false,"led_color":148,"al_config":{...}}
  4. Add "Bowling" to your room's mode dropdown
  5. Done! No blueprint changes, works immediately in all rooms.

Occupancy Controlled Lights Blueprint

Automatically control lights based on occupancy sensors with adaptive lighting support. Perfect for any room where you want lights to turn on when someone enters and turn off when they leave.

Import URL

https://git.johnogle.info/johno/home-assistant-blueprints/raw/branch/main/occupancy_controlled_lights.yaml

Installation

Method 1: Import via UI

  1. Go to Settings → Automations & Scenes → Blueprints
  2. Click "Import Blueprint" (blue button, bottom right)
  3. Paste the import URL above
  4. Click "Preview" then "Import"

Method 2: Manual Installation

  1. Download the blueprint file
  2. Place it in /config/blueprints/automation/occupancy_controlled_lights.yaml
  3. Restart Home Assistant or reload automations

Features

  • Occupancy-based control: Automatically turns lights on/off based on presence
  • Adaptive lighting support: Optional integration with Adaptive Lighting component
  • Configurable transitions: Set different fade times for on/off
  • Fallback support: Works with or without adaptive lighting
  • Multiple light support: Control single lights or groups

Configuration Options

Input Description Default
Occupancy Sensor Binary sensor that detects occupancy/presence Required
Lights Light entities to control Required
Adaptive Lighting Switch Adaptive lighting switch for this room. Leave empty to use simple on/off without adaptive lighting. Optional
Turn On Transition Transition time when turning lights on (seconds) 5
Turn Off Transition Transition time when turning lights off (seconds) 15
Adapt Brightness Whether to adapt brightness with adaptive lighting Yes
Adapt Color Whether to adapt color with adaptive lighting Yes

Usage Examples

Example 1: Basic Room with Adaptive Lighting

Configuration:

  • Occupancy Sensor: binary_sensor.living_room_occupancy
  • Lights: light.living_room_lights
  • Adaptive Lighting Switch: switch.adaptive_lighting_living_room
  • Turn On Transition: 3 seconds
  • Turn Off Transition: 10 seconds

Example 2: Simple On/Off Mode (without Adaptive Lighting)

Use Case: Control lights with simple on/off without adaptive lighting adjustments.

Configuration:

  • Occupancy Sensor: binary_sensor.kitchen_motion
  • Lights: light.kitchen_ceiling, light.kitchen_under_cabinet
  • Adaptive Lighting Switch: Leave empty (default)
  • Turn On Transition: 1 second
  • Turn Off Transition: 5 seconds
  • Adapt Brightness: Not applicable (no adaptive lighting switch)
  • Adapt Color: Not applicable (no adaptive lighting switch)

Example 3: Bedroom with Gentle Transitions

Configuration:

  • Occupancy Sensor: binary_sensor.bedroom_presence
  • Lights: light.bedroom_lights
  • Adaptive Lighting Switch: switch.adaptive_lighting_bedroom
  • Turn On Transition: 10 seconds (gentle wake-up)
  • Turn Off Transition: 30 seconds (gradual fade)

How It Works

  1. Occupancy Detected: When the sensor state changes to "on" (occupied):

    • If an Adaptive Lighting switch is configured AND enabled, applies adaptive lighting settings
    • If the Adaptive Lighting switch is left empty OR is disabled, turns lights on with simple on/off using the specified transition time
  2. No Occupancy: When the sensor state changes to "off" (not occupied):

    • Turns off all specified lights with configured transition time

Tips

  • Sensor Selection: Works best with presence sensors (mmWave) for continuous detection
  • Transition Times: Longer transitions feel more natural but may delay response
  • Adaptive Lighting: Requires the Adaptive Lighting integration to be installed
  • Light Groups: You can target light groups for easier management

Troubleshooting

Lights not turning on:

  • Verify occupancy sensor is working and changing state
  • Check that light entities are correct and responsive
  • Ensure adaptive lighting switch exists if specified

Lights turning off too quickly:

  • Check occupancy sensor timeout settings
  • Some PIR sensors have short detection windows

Adaptive lighting not working:

  • Verify Adaptive Lighting integration is installed
  • Check that the switch entity exists and is enabled
  • Make sure the switch covers the target lights

Multi-Press Action Blueprint

Trigger different actions based on how many times an entity changes state rapidly. Perfect for light switches, buttons, or any entity where you want single, double, triple, or quad-press actions.

Import URL

https://git.johnogle.info/johno/home-assistant-blueprints/raw/branch/main/multi_press_action.yaml

Installation

Method 1: Import via UI

  1. Go to Settings → Automations & Scenes → Blueprints
  2. Click "Import Blueprint" (blue button, bottom right)
  3. Paste the import URL above
  4. Click "Preview" then "Import"

Method 2: Manual Installation

  1. Download the blueprint file
  2. Place it in /config/blueprints/automation/multi_press_action.yaml
  3. Restart Home Assistant or reload automations

Features

  • Configurable time window: Set how quickly presses must occur (default 1.5s)
  • Immediate or delayed single-press: Choose whether single press acts instantly or waits
  • Up to 4 press levels: Single, double, triple, and quad press actions
  • Complex action support: Each action can include conditions, scenes, scripts, and more

Configuration Options

Input Description Default
Trigger Entity The entity to monitor for state changes Required
Time Window Maximum time between presses (seconds) 1.5
Execute Single Press Immediately Run single press action without waiting Yes
Single Press Action Action(s) to run on single press None
Double Press Action Action(s) to run on double press None
Triple Press Action Action(s) to run on triple press None
Quad Press Action Action(s) to run on quad press (4 times) None

Usage Examples

Example 1: Light Switch with Scene Control

Use Case: Normal switch operation, but double-press for bright scene

Configuration:

  • Trigger Entity: light.bedroom
  • Immediate Single Press: Enabled
  • Single Press Action: Leave empty (light toggles naturally)
  • Double Press Action:
  - choose:
      - conditions:
          - condition: sun
            after: sunset
        sequence:
          - service: scene.turn_on
            target:
              entity_id: scene.bedroom_bright_night
      - conditions:
          - condition: sun
            before: sunset
        sequence:
          - service: scene.turn_on
            target:
              entity_id: scene.bedroom_bright_day

Example 2: Button with Escalating Actions

Use Case: Button that does more based on number of presses

Configuration:

  • Trigger Entity: binary_sensor.my_button
  • Immediate Single Press: Disabled (wait to see if multi-press)
  • Single Press Action: Turn on TV
  • Double Press Action: Turn on TV + soundbar + dim lights
  • Triple Press Action: Full movie mode (TV + soundbar + lights off + close blinds)
  • Quad Press Action: Party mode

Example 3: Bathroom Light with Time-Based Logic

Configuration:

  • Trigger Entity: light.bathroom
  • Immediate Single Press: Enabled
  • Triple Press Action:
  - choose:
      - conditions:
          - condition: time
            after: "22:00:00"
            before: "06:00:00"
        sequence:
          - service: light.turn_on
            target:
              entity_id: light.bathroom
            data:
              brightness_pct: 10
              color_temp: 454
      default:
        - service: light.turn_on
          target:
            entity_id: light.bathroom
          data:
            brightness_pct: 100

Updates

To get the latest version of this blueprint:

  1. Go to Settings → Automations & Scenes → Blueprints
  2. Find "Multi-Press Action" in your list
  3. Click the menu (three dots)
  4. Select "Re-import Blueprint"
  5. Your existing automations will automatically use the updated version

Changelog

v1.0.0 (2025-10-25)

  • Initial release
  • Support for single, double, triple, and quad press actions
  • Configurable time window
  • Optional immediate single-press mode
  • Full action sequence support with conditions

Tips

  • Immediate mode (default): Best for switches that control things directly (like lights). No delay on single press.
  • Delayed mode: Best for buttons that only trigger automations. Waits to see if you're doing a multi-press.
  • Time window: Start with 1.5s. Increase if you have trouble with multi-press detection, decrease for faster response.
  • Action complexity: Each action input supports full Home Assistant action sequences - use conditions, choose blocks, multiple services, etc.

Troubleshooting

Multi-press not detecting:

  • Increase the time window
  • Check that your entity is actually changing state rapidly
  • Look at Developer Tools → Events to watch state_changed events

Single press delayed even in immediate mode:

  • Make sure "Execute Single Press Immediately" is enabled
  • Check that your single press action isn't empty (unless you want the natural entity behavior)

Automation not working:

  • Check the automation trace (Settings → Automations → your automation → ⋮ → Traces)
  • Verify your trigger entity is the correct one
  • Test with simple actions first (like notifications)

Support

Found a bug or have a feature request? Open an issue on the repository!

License

Feel free to use, modify, and share this blueprint!