Skip to content

Commit e230d95

Browse files
refactor: rename "Rooms" integration to "Custom Areas" (#5)
* refactor: rename "Rooms" integration to "Custom Areas" Rename the entire "Rooms" integration to "Custom Areas" to better reflect its functionality and usage. The renaming affects: - directory and file names: custom_components/rooms -> custom_components/areas - documentation, comments, and strings references to the "Rooms" entity - README and other markdown files to clarify the new scope - update entity IDs and names to use "area_" prefixes This change aligns the integration's name with its features of managing custom area sensors in Home Assistant, providing clarity to users and developers. * Update .github/workflows/ci.yml Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]>
1 parent 294a6e8 commit e230d95

24 files changed

+170
-171
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ jobs:
124124
125125
- name: Run linting
126126
run: |
127-
black --check --diff custom_components/rooms/
128-
isort --check-only --diff custom_components/rooms/
129-
flake8 custom_components/rooms/
130-
ruff check custom_components/rooms/
131-
cd custom_components && python -m mypy rooms/
127+
black --check --diff custom_components/areas/
128+
isort --check-only --diff custom_components/areas/
129+
flake8 custom_components/areas/
130+
ruff check custom_components/areas/
131+
cd custom_components && python -m mypy areas/

.github/workflows/manual-validation.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ jobs:
7575
7676
- name: Run linting
7777
run: |
78-
black --check --diff custom_components/rooms/
79-
isort --check-only --diff custom_components/rooms/
80-
flake8 custom_components/rooms/
78+
black --check --diff custom_components/areas/
79+
isort --check-only --diff custom_components/areas/
80+
flake8 custom_components/areas/
8181
8282
manual-type-check:
8383
if: inputs.validation_type == 'all' || inputs.validation_type == 'type-check'

README.md

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
# Rooms Integration for Home Assistant
1+
# Custom Areas Integration for Home Assistant
22

3-
A custom integration for Home Assistant that creates composite "Room" sensors with UI configuration.
3+
A custom integration for Home Assistant that creates composite "Area" sensors with UI configuration.
44

55
## Features
66

7-
- **UI Configuration**: Add rooms through Home Assistant's UI with an intuitive config flow
8-
- **Composite Sensors**: Each room creates a summary sensor that combines multiple entity states
7+
- **UI Configuration**: Add areas through Home Assistant's UI with an intuitive config flow
8+
- **Composite Sensors**: Each area creates a summary sensor that combines multiple entity states
99
- **Real-time Updates**: Uses event-driven updates instead of polling for instant state changes
1010
- **Device Registry**: Creates proper devices in Home Assistant's device registry
1111

1212
## Documentation
1313

1414
📖 **Complete Documentation**: [docs/](docs/)
1515

16-
- **[Design Rationale](docs/rationale.md)** - Why this exists and how it pairs with CFHAC/Area-like UX
16+
- **[Design Rationale](docs/rationale.md)** - Why this exists and how it pairs with Custom Features for Home Assistant Cards/Area-like UX
1717
- **[API Reference](docs/api.md)** - Entity states, attributes, and configuration schema
1818
- **[Configuration Examples](docs/examples.md)** - Real-world setup examples and use cases
1919
- **[Developer Guide](docs/developer.md)** - Architecture overview and development setup
@@ -43,40 +43,40 @@ Not affiliated with Home Assistant — just vibing on top of it.
4343
- Select "Custom repositories"
4444
- Add: `https://github.com/DefinitelyADev/room-entity`
4545
- Category: Integration
46-
3. Search for "Rooms" in HACS and install it
46+
3. Search for "Areas" in HACS and install it
4747
4. Restart Home Assistant
4848

4949
### Manual Installation
5050

51-
1. Download the `custom_components/rooms/` folder from this repository
51+
1. Download the `custom_components/areas/` folder from this repository
5252
2. Copy it to your Home Assistant's `custom_components/` directory
5353
3. Restart Home Assistant
5454

5555
## Configuration
5656

57-
### Adding a Room
57+
### Adding an Area
5858

5959
1. Go to **Settings****Devices & Services****Add Integration**
60-
2. Search for "Rooms" and select it
61-
3. Configure your room:
62-
- **Room Name**: Display name for the room
60+
2. Search for "Areas" and select it
61+
3. Configure your area:
62+
- **Area Name**: Display name for the area
6363
- **Power Sensor**: Optional sensor for power consumption
6464
- **Energy Sensor**: Optional sensor for energy consumption
6565
- **Temperature Sensor**: Optional temperature sensor
6666
- **Humidity Sensor**: Optional humidity sensor
6767
- **Motion Sensor**: Optional motion detection sensor
6868
- **Window Sensor**: Optional window/door sensor
6969
- **Climate Entity**: Optional climate control entity
70-
- **Active Power Threshold**: Power level (in watts) above which the room is considered "active"
70+
- **Active Power Threshold**: Power level (in watts) above which the area is considered "active"
7171

7272
## Usage
7373

7474
### Summary Sensor
7575

76-
Each room creates a summary sensor with these states:
77-
- **active**: Room is currently active (motion detected OR power above threshold)
78-
- **idle**: Room has configured entities but is not active
79-
- **unknown**: No entities configured for the room
76+
Each area creates a summary sensor with these states:
77+
- **active**: Area is currently active (motion detected OR power above threshold)
78+
- **idle**: Area has configured entities but is not active
79+
- **unknown**: No entities configured for the area
8080

8181
The summary sensor includes these attributes:
8282
- `power_w` (numeric) and `power` (string with unit, e.g. "28.6 W")
@@ -88,39 +88,39 @@ The summary sensor includes these attributes:
8888
- `climate_mode`: Current climate mode
8989
- `climate_target_c` (numeric) and `climate_target` (string with unit)
9090

91-
### Area vs Tile (with CFHAC)
91+
### Area vs Tile (with Custom Features for Home Assistant Cards)
9292

93-
If you want to mimic the Area card using a Tile card with CFHAC features and the room summary sensor:
93+
If you want to mimic the Area card using a Tile card with Custom Features for Home Assistant Cards features and the area summary sensor:
9494

95-
![Area card vs Tile card with CFHAC](docs/images/area-vs-tile.png)
95+
![Area card vs Tile card with Custom Features for Home Assistant Cards](docs/images/area-vs-tile.png)
9696

9797
## State Logic
9898

99-
The room state is determined by this priority:
99+
The area state is determined by this priority:
100100
1. If motion sensor is ON → **active**
101101
2. If power consumption > active threshold → **active**
102102
3. If any core entities exist but conditions 1-2 are false → **idle**
103103
4. If no entities configured → **unknown**
104104

105105
## Icons
106106

107-
The summary sensor icon changes based on room status:
107+
The summary sensor icon changes based on area status:
108108
- Window open: `mdi:window-open-variant`
109109
- Motion detected: `mdi:motion-sensor`
110110
- Default: `mdi:home`
111111

112112
## Device Registry
113113

114-
Each room creates a device in Home Assistant's device registry, allowing you to:
115-
- Group all room sensors together
114+
Each area creates a device in Home Assistant's device registry, allowing you to:
115+
- Group all area sensors together
116116
- View device information
117117
- Manage device settings
118118

119119
## Requirements
120120

121121
- Home Assistant 2024.1.0 or later
122122
- Python 3.10 or later
123-
- Entities must exist before configuring the room
123+
- Entities must exist before configuring the area
124124

125125
## Troubleshooting
126126

@@ -137,7 +137,7 @@ Add this to your `configuration.yaml` to enable debug logging:
137137
logger:
138138
default: info
139139
logs:
140-
custom_components.rooms: debug
140+
custom_components.areas: debug
141141
```
142142
143143
## Contributing
@@ -182,9 +182,9 @@ Or run individual checks:
182182
python validate.py # Custom validation
183183
python run_tests.py # Unit tests
184184
pyright # Type checking
185-
black --check custom_components/rooms/ # Code formatting
186-
isort --check-only custom_components/rooms/ # Import sorting
187-
flake8 custom_components/rooms/ # Linting
185+
black --check custom_components/areas/ # Code formatting
186+
isort --check-only custom_components/areas/ # Import sorting
187+
flake8 custom_components/areas/ # Linting
188188
```
189189

190190
### Pre-commit Setup

check_all.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python3
2-
"""Run all validations and checks for the Rooms integration."""
2+
"""Run all validations and checks for the Custom Areas Integration."""
33

44
import subprocess
55
import sys
@@ -23,12 +23,12 @@ def run_command(cmd, description):
2323

2424
def main():
2525
"""Run all validations."""
26-
print("🚀 Running all validations for Rooms integration...")
26+
print("🚀 Running all validations for Custom Areas Integration...")
2727

2828
all_passed = True
2929

3030
# Check if we're in the right directory
31-
if not Path("custom_components/rooms").exists():
31+
if not Path("custom_components/areas").exists():
3232
print("❌ Not in the correct directory. Please run from the project root.")
3333
return 1
3434

@@ -45,13 +45,13 @@ def main():
4545
all_passed = False
4646

4747
# Run linting
48-
if not run_command("black --check --diff custom_components/rooms/", "Black formatting check"):
48+
if not run_command("black --check --diff custom_components/areas/", "Black formatting check"):
4949
all_passed = False
5050

51-
if not run_command("isort --check-only --diff custom_components/rooms/", "Import sorting check"):
51+
if not run_command("isort --check-only --diff custom_components/areas/", "Import sorting check"):
5252
all_passed = False
5353

54-
if not run_command("flake8 custom_components/rooms/", "Flake8 linting"):
54+
if not run_command("flake8 custom_components/areas/", "Flake8 linting"):
5555
all_passed = False
5656

5757
# Run pre-commit (if available)

custom_components/rooms/__init__.py renamed to custom_components/areas/__init__.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Rooms integration for Home Assistant."""
1+
"""Custom Areas Integration for Home Assistant."""
22

33
import logging
44

@@ -8,19 +8,19 @@
88
from homeassistant.helpers import device_registry as dr
99

1010
from .const import DOMAIN
11-
from .sensor import RoomSensorCoordinator
11+
from .sensor import AreaSensorCoordinator
1212

1313
_LOGGER = logging.getLogger(__name__)
1414

1515
PLATFORMS = ["sensor"]
1616

1717

1818
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
19-
"""Set up rooms from a config entry."""
20-
_LOGGER.info("Setting up rooms integration for %s", entry.title)
19+
"""Set up areas from a config entry."""
20+
_LOGGER.info("Setting up areas integration for %s", entry.title)
2121

2222
try:
23-
coordinator = RoomSensorCoordinator(hass, entry)
23+
coordinator = AreaSensorCoordinator(hass, entry)
2424
await coordinator.async_config_entry_first_refresh()
2525

2626
hass.data.setdefault(DOMAIN, {})
@@ -31,9 +31,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
3131
device_registry.async_get_or_create(
3232
config_entry_id=entry.entry_id,
3333
identifiers={(DOMAIN, entry.entry_id)},
34-
name=f"Room: {entry.data.get('room_name', 'Unknown')}",
35-
manufacturer="Rooms Integration",
36-
model="Room Sensor",
34+
name=f"Area: {entry.data.get('area_name', 'Unknown')}",
35+
manufacturer="Areas Integration",
36+
model="Area Sensor",
3737
)
3838

3939
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
@@ -43,7 +43,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
4343
return True
4444

4545
except Exception as ex:
46-
_LOGGER.error("Error setting up rooms integration: %s", ex)
46+
_LOGGER.error("Error setting up areas integration: %s", ex)
4747
_LOGGER.error("Exception type: %s", type(ex).__name__)
4848
import traceback
4949

@@ -53,7 +53,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
5353

5454
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
5555
"""Unload a config entry."""
56-
_LOGGER.info("Unloading rooms integration for %s", entry.title)
56+
_LOGGER.info("Unloading areas integration for %s", entry.title)
5757

5858
unload_ok: bool = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
5959

custom_components/rooms/config_flow.py renamed to custom_components/areas/config_flow.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Config flow for Rooms integration."""
1+
"""Config flow for Custom Areas Integration."""
22

33
import logging
44
from typing import Any, Dict, Optional
@@ -10,13 +10,13 @@
1010

1111
from .const import (
1212
CONF_ACTIVE_THRESHOLD,
13+
CONF_AREA_NAME,
1314
CONF_CLIMATE_ENTITY,
1415
CONF_ENERGY_ENTITY,
1516
CONF_HUMIDITY_ENTITY,
1617
CONF_ICON,
1718
CONF_MOTION_ENTITY,
1819
CONF_POWER_ENTITY,
19-
CONF_ROOM_NAME,
2020
CONF_TEMP_ENTITY,
2121
CONF_WINDOW_ENTITY,
2222
DEFAULT_ICON,
@@ -26,10 +26,10 @@
2626
_LOGGER = logging.getLogger(__name__)
2727

2828

29-
class RoomsConfigFlow(
29+
class AreasConfigFlow(
3030
config_entries.ConfigFlow, domain=DOMAIN
3131
): # type: ignore[call-arg] # HA's __init_subclass__ accepts domain parameter
32-
"""Handle a config flow for Rooms."""
32+
"""Handle a config flow for Areas."""
3333

3434
VERSION = 1
3535
DOMAIN = DOMAIN
@@ -43,24 +43,24 @@ async def async_step_user(self, user_input: Optional[Dict[str, Any]] = None) ->
4343
errors: Dict[str, str] = {}
4444

4545
if user_input is not None:
46-
# Validate room name is unique
47-
await self.async_set_unique_id(user_input[CONF_ROOM_NAME])
46+
# Validate area name is unique
47+
await self.async_set_unique_id(user_input[CONF_AREA_NAME])
4848
self._abort_if_unique_id_configured()
4949

5050
# Ensure icon has a default value if not provided
5151
if CONF_ICON not in user_input or user_input[CONF_ICON] is None:
5252
user_input[CONF_ICON] = DEFAULT_ICON
5353

5454
return self.async_create_entry(
55-
title=user_input[CONF_ROOM_NAME],
55+
title=user_input[CONF_AREA_NAME],
5656
data=user_input,
5757
) # pyright: ignore[reportReturnType]
5858

5959
return self.async_show_form(
6060
step_id="user",
6161
data_schema=vol.Schema(
6262
{
63-
vol.Required(CONF_ROOM_NAME): str,
63+
vol.Required(CONF_AREA_NAME): str,
6464
vol.Optional(CONF_ICON): selector.IconSelector(
6565
selector.IconSelectorConfig(placeholder="mdi:texture-box")
6666
),

custom_components/rooms/const.py renamed to custom_components/areas/const.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
"""Constants for the Rooms integration."""
1+
"""Constants for the Custom Areas Integration."""
22

3-
DOMAIN = "rooms"
4-
CONF_ROOM_NAME = "room_name"
3+
DOMAIN = "areas"
4+
CONF_AREA_NAME = "area_name"
55
CONF_POWER_ENTITY = "power_entity"
66
CONF_ENERGY_ENTITY = "energy_entity"
77
CONF_TEMP_ENTITY = "temp_entity"

custom_components/rooms/manifest.json renamed to custom_components/areas/manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"domain": "rooms",
3-
"name": "Rooms",
2+
"domain": "areas",
3+
"name": "Custom Areas Integration",
44
"codeowners": ["@DefinitelyADev"],
55
"config_flow": true,
66
"dependencies": [],

0 commit comments

Comments
 (0)