LightScene is a custom Home Assistant integration that enhances your lighting control by managing scenes with dynamic brightness scaling and context tracking. Enable brightness scaling and context tracking for Home Assistant scene entities, allowing dynamic control over lighting environments in your smart home.
This component introduces sceneoff functionality and proportional brightness control for lights defined in your Home Assistant scene.
- Automatic discovery: Automatically detects scenes and creates a corresponding
lightentity for every Home Assistant scene. - Scene state tracking: Listens for
sceneactivation events to turn on LightScene entities. Tracks scene entity changes to determine if scene has been turned off. - Togglable: Regular scenes only support being turned on. LightScene lights can be turned on or off.
- Proportional brightness control: Scale brightness of all
scenelights in proportion toscenepresets.
No manual configuration is needed. The component automatically discovers scene entities and creates corresponding LightScene entities.
For example, a scene named Evening Lights with several lights with brightness controls will automatically have a LightScene light entity created with brightness scaling enabled.
Light scenes can be turned on via the Home Assistant UI or through a service call, as usual:
service: light.turn_on
data:
entity_id: light.evening_lights
brightness: 150Turn off the light scene with:
service: light.turn_off
data:
entity_id: light.evening_lightsThe component scales brightness based on the baseline brightness of the scene. For example:
- A light with brightness 255 in the scene will scale proportionally to match the specified brightness.
- Scene reload: Automatically updates all
LightSceneentities when scenes are reloaded. - Scene activation: Handles external activations of scenes and updates the corresponding
LightSceneentity.
To enable debug logging for this component, add the following to your configuration.yaml:
logger:
default: warning
logs:
custom_components.lightscene: debug-
Copy the
lightscenecomponent folder into your Home Assistantcustom_componentsdirectory. -
Restart Home Assistant to enable the component.
The component includes the following key classes:
- LightSceneManager: Manages discovery and lifecycle of
LightSceneentities. - LightScene: Represents a single light scene with brightness scaling and context management.
Contributions are welcome! Submit an issue or create a pull request on GitHub to propose improvements or report bugs.
This component is licensed under the MIT License. See the LICENSE file for more details.
Happy automating! 🎉