LabelMate Scene provides a small integration that creates logical groups of switches or lights driven by Home Assistant "labels" or can be tied more specifically to scenes. It dynamically watches entities that have a given label and/or scene.
- A Switch or Light entity (depending on the selected group type) that controls all matched entities.
- Two sensors: active count (number of matched entities that are "on") and total count (number of matched entities).
This integration prefers scenes when turning the group on/off: if you add scenes that have the same label, the integration will attempt to activate a matching scene instead of directly toggling members ON or OFF. If there is no scene, it directly toggles the tagged members on or off. See Notes on Behavior below.
In Scene Mode, the integration creates one switch per label that aggregates all entities from multiple scenes sharing that label. Turning the switch ON activates the first scene alphabetically; turning it OFF deactivates all aggregated entities across all matching scenes.
Switch/Light:
- Scans for entities which are using the configured label
- Creates a switch or light which appears as a group in the UI
- In its default (no labeled scene found) state will turn on as soon as any labeled light or switch is ON and OFF when all are off
- Will search for a scene with the SAME label and if "off" is not found in the name, activate the scene, even if that means not all devices are in that scene or label.
- When turning it OFF, it will search for a scene with the configured label and if "off" is found in the name, use it will activate the scene, even if that means not all devices are in that scene or label and will continue to represent the state of the labeled devices.
Scene Mode:
- Scans for all scenes that have the configured label
- Creates one switch per label (not per scene) that aggregates entities from all matching scenes
- The group includes all unique entities and devices from every scene with that label
- Turning ON: Activates the first scene alphabetically from all scenes with that label
- Turning OFF: Turns off ALL entities aggregated from all scenes with that label (can span multiple scenes)
- Properly handles both individual entities and devices added to scenes
- Dynamically updates when scenes are added, removed, or modified
This integration is actively evolving. Scene-only groups may report zero-valued sensors; behavior and corner cases continue to be refined. Use at your own risk; your mileage may vary.
Manual installation
- Copy the
labelmate_scenefolder into your Home Assistantcustom_componentsdirectory so the layout is:
custom_components/labelmate_scene/
__init__.py
manifest.json
config_flow.py
const.py
group_base.py
entity_manager.py
light.py
switch.py
sensor.py
strings.json
translations/en.json
-
Restart Home Assistant.
-
In Home Assistant go to Settings → Devices & Services → Add integration and search for "LabelMate Scene".
If/when this project is published to HACS, install it from HACS and restart Home Assistant. Then add the integration via Settings → Devices & Services like above.
-
Add a label to the entities you want to include. Labels are Home Assistant metadata attached to entities. You can add labels using the entity editor in the UI (Settings → Devices & Services → Entities → select an entity → Edit → Labels) or via the Entity Registry.
-
Add the LabelMate Scene integration from the UI. In the config flow you will be asked for:
- Label Name: the exact label text (case-insensitive) used to select entities.
- Group Type: "Switch", "Light", or "Scene"
- After creating the config entry, the integration will create:
- A switch or light entity named "Label <label_name> Group".
- Two sensors named like
sensor.label_<label_name_safe>_group_active_countandsensor.label_<label_name_safe>_group_total_count.
- Use the integration's Options to set the light color (hex). Helpful for dashboards/themes (e.g., holiday strings).
- Membership is dynamic and event-driven: the integration watches the entity/device/label registries and state changes to recompute which entities match the label. It filters to allowed domains (lights, switches, fans, input_booleans by default).
- The "Light" variant reports a computed
brightnessand supports RGB color in the UI (color is configurable as options on the config entry). - When turning the group ON or OFF (for Switch/Light types), the integration first attempts to find a Scene that matches the same label. Matching rules:
- Scene entity must have the same label attached.
- For ON actions: the scene name must NOT contain the word "off" (case-insensitive).
- For OFF actions: the scene name MUST contain the word "off".
- If multiple matches exist, the integration picks the first alphabetical scene entity id.
- Scene Mode behavior:
- Creates one switch per label that aggregates entities from all scenes with that label
- Supports both entities and devices added to scenes (devices are expanded to their constituent entities)
- Turn ON: Activates the first alphabetically-sorted scene
- Turn OFF: Deactivates all entities from all scenes with that label
- The switch state reflects whether any aggregated entities are currently on
- The integration matches labels using Home Assistant's label system. If you do not see expected entities, verify the label is attached to the entity (check Settings → Devices & Services → Entities and confirm the "Labels" field).
- If the group's entity shows zero total members, verify that matched entities are in allowed domains: the integration filters to a small set (light, switch, fan, input_boolean) by default. You can change
ALLOWED_DOMAINSinconst.pyto include other domains if needed. - Scene activation rules: Scene matching is based on labels attached to the scene entity. If scenes are not being activated, ensure the scene entity has the label set in the entity registry.
- Scene Mode: If entities aren't being detected from scenes, ensure the scene includes actual entities or devices. The integration extracts both direct entity references and expands device references to their constituent entities.
- Add support for areas
- Expose the suppression window as an option per-entry so users can tune optimistic UI timing.
- Add unit tests that mock
hass.statesand the template rendering to verify membership, sensors, and scene selection logic. - Consider adding an option to include additional domains or to configure the allowed domains from the UI.
Current tasks and status for this integration repository:
- Evaluate adding area support — Assess how to add area-based groups (design, API usage, config flow, migration, tests). (in progress)
-
Fix zero sensor values for the Scene option— Scene mode now aggregates entities properly -
Move to one switch per label instead of per scene— Implemented with entity aggregation across scenes - Move Sensor values tied to switch and light options to an attribute on the Light or Switch. Will improve support for the Scene option where we might have multiple switches on a single device.
