John Ogle b612412470 Fix trigger to use event-based state monitoring
Replaces unsupported domain/device_class trigger with event-based approach that listens to state_changed events and filters for selected occupancy sensors.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-05 17:25:58 -08:00
2025-10-25 21:51:01 -07:00
2025-10-27 14:55:37 -07:00

Home Assistant Blueprints

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 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: Multiple Lights without Adaptive Lighting

Configuration:

  • Occupancy Sensor: binary_sensor.kitchen_motion
  • Lights: light.kitchen_ceiling, light.kitchen_under_cabinet
  • Adaptive Lighting Switch: Leave empty
  • Turn On Transition: 1 second
  • Turn Off Transition: 5 seconds

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 adaptive lighting is configured, applies adaptive lighting settings
    • If no adaptive lighting, turns lights on with specified transition
  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!

Description
No description provided
Readme 193 KiB
Languages
Markdown 100%