A Home Assistant custom integration that enables selective scene activation: apply scenes to only specific entities or areas instead of all entities in the scene.
Using built-in scenes with selective filtering provides several advantages:
- Scene Editor Integration: Create and modify scenes using Home Assistant's built-in scene editor UI
- Avoid Scene Duplication: Without filtering, you'd need separate scenes like
scene.evening_lights_all,scene.evening_lights_living_room,scene.evening_lights_kitchen, etc. With selective scenes, onescene.evening_lightscan serve multiple purposes - Dynamic Area-based Control: Apply the same scene to different areas based on context (motion sensors, time of day, etc.)
- Maintainability: Update lighting states in one place while using them in multiple automations with different scopes
This allows you to store and manage lighting states in built-in scenes but use them more expressively in automations.
This integration provides a drop-in replacement for the built-in scene.turn_on service with the ability to activate scenes selectively.
Instead of applying a scene to all entities, you can filter which entities are affected using entity IDs or areas.
The service accepts the same parameters as scene.turn_on plus additional filtering options:
| Parameter | Type | Description |
|---|---|---|
entity_id |
string/list | Scene(s) to activate |
transition |
number | Transition time in seconds |
entity_filter |
list | List of entity IDs to apply the scene to (only these entities will be affected) |
area_filter |
list | List of area names to apply the scene to (only entities in these areas will be affected) |
Apply scene only to specific entities:
action: selective_scene.turn_on
target:
entity_id: scene.evening_lights
data:
entity_filter:
- light.living_room
- light.kitchenApply scene only to specific areas:
action: selective_scene.turn_on
target:
entity_id: scene.evening_lights
data:
area_filter:
- living_room
- kitchenMotion-activated lighting automation:
automation:
- alias: "Motion activated lights"
triggers:
- trigger: state
entity_id: binary_sensor.motion_living_room
to: "on"
actions:
- action: selective_scene.turn_on
target:
entity_id: scene.evening_lights
data:
area_filter:
- living_roomQuick install (skip to step 5)
Manual steps
- Open HACS in your Home Assistant instance
- Click the three dots menu (⋮) and select "Custom repositories"
- Add
https://github.com/jpaju/selective-sceneas repository with categoryIntegration - Search and open "Selective Scene " from HACS repositories
- Click "Download"
- Restart Home Assistant
- Go to Settings → Devices & Services → Integrations and click "Add Integration"
- Search for "Selective Scene" and add it