Custom component for Home Assistant that automatically creates and maintains groups of entities based on their assigned area.
- Automatically creates groups for each area (currently supports
lightentities) - Groups are named
light.area_[area_name](e.g.,light.area_salon) - Optional area groups for
sensorandbinary_sensorby device class (temperature/humidity/illuminance, motion/presence/opening, door/window) - Updates automatically when entities are added/removed from areas
- Updates automatically when areas are created/modified
- Initializes on Home Assistant startup
- Extensible architecture for future support of other entity domains
-
Copy the folder
custom_components/auto_groups_area/from this repository into your Home Assistantcustom_componentsdirectory. -
Restart Home Assistant
-
Add the integration from the UI: Settings → Devices & services → Add integration → Auto Groups by Area
-
Add this repository to HACS (custom repository, category Integration):
- Use the badge/link at the top of this README, or
- Manually add:
https://github.com/nico97118/auto_groups_area
-
Install it from HACS, then restart Home Assistant
-
Add the integration from the UI: Settings → Devices & services → Add integration → Auto Groups by Area
Once installed and configured, the component will:
- On startup: Scan all areas and create groups for each area containing light entities
- Automatically: Update groups when you:
- Add a light to an area
- Remove a light from an area
- Move a light between areas
- Create or modify areas
If you have an area named "Salon" with 3 lights:
light.plafonnier_salonlight.lampe_1light.lampe_2
The component will create:
light.area_saloncontaining all 3 lights
You can then use this group in automations, scripts, or the UI:
service: light.turn_on
target:
entity_id: light.area_salon
data:
brightness: 255The group will automatically reflect:
- State:
onif at least one light is on - Brightness: Average of all lights
- Color: Average color of all lights
- And all other aggregated attributes
No configuration is required. Add the integration from the UI and it will create/update area groups automatically.
You can configure behavior from the UI: Settings → Devices & services → Auto Groups by Area → Options
- Create light groups / sensor groups / binary_sensor groups: Enable or disable group creation by platform.
- Entity id prefix (object id): Prefix used to build the entity_id (default:
area_). - Create groups even when empty: If disabled (default), empty groups are not created and existing groups are removed when they become empty.
- Include entities whose device is assigned to the area: Also include entities that inherit the area from their device assignment (recommended).
- Only include these areas / Exclude these areas: Multi-select of areas to include or exclude.
- Binary Sensors: Enable/disable each binary_sensor group type (motion/presence/opening/door-window).
- Sensors: Choose aggregation per sensor type (
max,mean,min,last). - Advanced → Excluded entities: Multi-select entities that will never be included in any group.
auto_groups_area.reload: Force a full resynchronization of all area groups managed by this integration.
Home Assistant diagnostics are available for this integration (config entry and device diagnostics) from: Settings → Devices & services → Auto Groups by Area → Download diagnostics.
Enable logging for this integration in configuration.yaml:
logger:
default: info
logs:
custom_components.auto_groups_area: debugCheck the logs for messages like:
Created light group for area 'Salon' with 5 member(s)
Created humidity sensor group for area 'Salle de bain' with 2 member(s)
Created motion binary_sensor group for area 'Entrée' with 1 member(s)
- Support for other entity domains (switch, fan, climate, etc.)
- Configuration options for customization
- Option to exclude certain areas
- Option to disable empty group creation
- Services to manually trigger group updates
Feel free to open issues or submit pull requests!
- QA / tests / lint / formatting:
TESTING.md
MIT License.