Add occupancy controlled lights

This commit is contained in:
2025-10-27 14:55:37 -07:00
parent d5034210ed
commit 9e4de90676
2 changed files with 203 additions and 0 deletions

103
README.md
View File

@@ -1,5 +1,108 @@
# 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.

View File

@@ -0,0 +1,100 @@
blueprint:
name: Occupancy Controlled Lights with Adaptive Lighting
description: Automatically turn lights on/off based on occupancy sensor with adaptive lighting support
domain: automation
input:
occupancy_sensor:
name: Occupancy Sensor
description: Binary sensor that detects occupancy/presence
selector:
entity:
domain: binary_sensor
device_class: occupancy
lights:
name: Lights
description: Light entities to control
selector:
target:
entity:
domain: light
adaptive_lighting_switch:
name: Adaptive Lighting Switch
description: Adaptive lighting switch entity for this room
default: {}
selector:
entity:
domain: switch
integration: adaptive_lighting
turn_on_transition:
name: Turn On Transition
description: Transition time in seconds when turning lights on
default: 5
selector:
number:
min: 0
max: 300
step: 1
unit_of_measurement: seconds
turn_off_transition:
name: Turn Off Transition
description: Transition time in seconds when turning lights off
default: 15
selector:
number:
min: 0
max: 300
step: 1
unit_of_measurement: seconds
adapt_brightness:
name: Adapt Brightness
description: Whether to adapt brightness when turning on lights
default: true
selector:
boolean:
adapt_color:
name: Adapt Color
description: Whether to adapt color when turning on lights
default: true
selector:
boolean:
trigger:
- trigger: state
entity_id: !input occupancy_sensor
condition: []
action:
- choose:
- conditions:
- condition: state
entity_id: !input occupancy_sensor
state: "on"
sequence:
- if:
- condition: template
value_template: "{{ adaptive_lighting_switch != none }}"
then:
- action: adaptive_lighting.apply
data:
entity_id: !input adaptive_lighting_switch
turn_on_lights: true
transition: !input turn_on_transition
adapt_brightness: !input adapt_brightness
adapt_color: !input adapt_color
else:
- action: light.turn_on
target: !input lights
data:
transition: !input turn_on_transition
- conditions:
- condition: state
entity_id: !input occupancy_sensor
state: "off"
sequence:
- action: light.turn_off
target: !input lights
data:
transition: !input turn_off_transition
mode: single