Skip to content

Commit 74ddf52

Browse files
committed
feat: Remove notification feature and blueprints to simplify integration scope
- Completed removal of the notification system (`notify_on_failure`) and all related code across 9 files. - Deleted blueprints directory and updated documentation to reflect the changes. - Verified no lingering references to removed features and ensured all tests pass. - Updated version to 0.2.0 and created CHANGELOG.md to document changes.
1 parent f1c40d9 commit 74ddf52

18 files changed

Lines changed: 1389 additions & 836 deletions

AGENTS.md

Lines changed: 129 additions & 73 deletions
Large diffs are not rendered by default.

CLAUDE.md

Lines changed: 51 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# CLAUDE.md
22

3-
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in
4+
this repository.
45

56
## Git Workflow
67

@@ -9,9 +10,12 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
910

1011
## Project Overview
1112

12-
HA-Light-Controller is a Home Assistant custom integration providing reliable light control with state verification, automatic retries, and preset management. It ensures lights actually reach their target state after commands are sent. Distributed via HACS.
13+
HA-Light-Controller is a Home Assistant custom integration providing reliable light
14+
control with state verification, automatic retries, and preset management. It ensures
15+
lights actually reach their target state after commands are sent. Distributed via HACS.
1316

14-
**Scope**: Focused on core light control with verification/retry and preset management. Notification feature and blueprints removed in v0.2.0.
17+
**Scope**: Focused on core light control with verification/retry and preset management.
18+
Notification feature and blueprints removed in v0.2.0.
1519

1620
## Environment
1721

@@ -20,14 +24,15 @@ HA-Light-Controller is a Home Assistant custom integration providing reliable li
2024

2125
## Home Assistant Environment Constraints
2226

23-
**Blocking calls freeze the entire HA instance.** All I/O must be async or use `hass.async_add_executor_job()`.
27+
**Blocking calls freeze the entire HA instance.** All I/O must be async or use
28+
`hass.async_add_executor_job()`.
2429

25-
| Constraint | Rule |
26-
|------------|------|
30+
| Constraint | Rule |
31+
| ---------- | ----------------------------------------------------------------------------------- |
2732
| Event loop | Single-threaded asyncio. Never use `time.sleep()`, sync `requests`, or blocking I/O |
28-
| Resources | HA runs on RPi-class hardware. Poll 30-60s minimum, prefer listeners over polling |
29-
| Sandbox | No filesystem access outside `config/`. Dependencies must be PyPI + `manifest.json` |
30-
| APIs | Use `hass.services.async_call`, `hass.states.get`. Never bypass HA's state machine |
33+
| Resources | HA runs on RPi-class hardware. Poll 30-60s minimum, prefer listeners over polling |
34+
| Sandbox | No filesystem access outside `config/`. Dependencies must be PyPI + `manifest.json` |
35+
| APIs | Use `hass.services.async_call`, `hass.states.get`. Never bypass HA's state machine |
3136

3237
## Commands
3338

@@ -57,20 +62,21 @@ logger:
5762
custom_components.ha_light_controller: debug
5863
```
5964

60-
Tests mock the entire `homeassistant` module in `tests/conftest.py` and don't require a running HA instance.
65+
Tests mock the entire `homeassistant` module in `tests/conftest.py` and don't require a
66+
running HA instance.
6167

6268
## Architecture
6369

6470
### Core Components
6571

66-
| File | Purpose |
67-
|------|---------|
68-
| `__init__.py` | Entry point: registers services individually in `async_setup()`, initializes `LightController` and `PresetManager`, uses `_get_param()` and `_service_response()` helpers |
69-
| `controller.py` | Light control: `ensure_state()``_expand_entities()``_build_targets()``_group_by_settings_with_transition()` → send → verify → retry |
70-
| `preset_manager.py` | Preset storage in `ConfigEntry.data[CONF_PRESETS]`, `activate_preset_with_options()` for shared activation logic |
71-
| `config_flow.py` | Menu-based options flow: settings (collapsible sections), add_preset (multi-step with per-entity config), manage_presets (edit/delete with confirmation) |
72-
| `button.py` / `sensor.py` | Preset entities: button activates preset via `preset_manager.activate_preset_with_options()`, sensor tracks status |
73-
| `const.py` | All `CONF_*`, `ATTR_*`, `DEFAULT_*`, `PRESET_*` constants |
72+
| File | Purpose |
73+
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
74+
| `__init__.py` | Entry point: registers services individually in `async_setup()`, initializes `LightController` and `PresetManager`, uses `_get_param()` and `_service_response()` helpers |
75+
| `controller.py` | Light control: `ensure_state()``_expand_entities()``_build_targets()``_group_by_settings_with_transition()` → send → verify → retry |
76+
| `preset_manager.py` | Preset storage in `ConfigEntry.data[CONF_PRESETS]`, `activate_preset_with_options()` for shared activation logic |
77+
| `config_flow.py` | Menu-based options flow: settings (collapsible sections), add_preset (multi-step with per-entity config), manage_presets (edit/delete with confirmation) |
78+
| `button.py` / `sensor.py` | Preset entities: button activates preset via `preset_manager.activate_preset_with_options()`, sensor tracks status |
79+
| `const.py` | All `CONF_*`, `ATTR_*`, `DEFAULT_*`, `PRESET_*` constants |
7480

7581
### Key Classes
7682

@@ -82,13 +88,13 @@ Tests mock the entire `homeassistant` module in `tests/conftest.py` and don't re
8288

8389
### Services
8490

85-
| Service | Description |
86-
|---------|-------------|
87-
| `ensure_state` | Control lights with verification and retries |
88-
| `activate_preset` | Activate preset by name or ID |
89-
| `create_preset` | Create preset programmatically |
90-
| `create_preset_from_current` | Capture current light states as preset |
91-
| `delete_preset` | Delete preset by ID |
91+
| Service | Description |
92+
| ---------------------------- | -------------------------------------------- |
93+
| `ensure_state` | Control lights with verification and retries |
94+
| `activate_preset` | Activate preset by name or ID |
95+
| `create_preset` | Create preset programmatically |
96+
| `create_preset_from_current` | Capture current light states as preset |
97+
| `delete_preset` | Delete preset by ID |
9298

9399
## Key Patterns
94100

@@ -116,11 +122,14 @@ brightness_tolerance = _get_param(data, options, ATTR_BRIGHTNESS_TOLERANCE, CONF
116122

117123
### Entity Expansion
118124

119-
`_expand_entity()` resolves `light.*` groups and `group.*` helper groups to individual `light.` entities. Uses `_get_state()` directly for attribute access.
125+
`_expand_entity()` resolves `light.*` groups and `group.*` helper groups to individual
126+
`light.` entities. Uses `_get_state()` directly for attribute access.
120127

121128
### Service Registration
122129

123-
Services are registered individually in `async_setup()` (not `async_setup_entry()`). This ensures they persist across config entry reloads. Each handler resolves the active entry at call time via `_get_loaded_entry()`:
130+
Services are registered individually in `async_setup()` (not `async_setup_entry()`).
131+
This ensures they persist across config entry reloads. Each handler resolves the active
132+
entry at call time via `_get_loaded_entry()`:
124133

125134
```python
126135
hass.services.async_register(
@@ -159,7 +168,7 @@ entry.runtime_data = LightControllerData(...)
159168
## Adding New Service Parameters
160169

161170
1. **const.py** - Add `ATTR_*` constant (and `CONF_*`/`DEFAULT_*` if configurable)
162-
2. ****init**.py** - Add to voluptuous schema, use `_get_param()` helper in handler
171+
2. \***\*init**.py\*\* - Add to voluptuous schema, use `_get_param()` helper in handler
163172
3. **services.yaml** - Add field definition with HA selector
164173
4. **controller.py** - Add to `ensure_state()` signature if needed
165174
5. **preset_manager.py** - Add to `activate_preset_with_options()` if preset-relevant
@@ -190,14 +199,19 @@ Two requirements govern all code in this repository:
190199
- **Prefer flat over nested** - Avoid deep nesting (3+ levels). Extract helpers instead.
191200
- **Name for intent** - Variables and functions should describe what they do, not how.
192201
- **Consistent patterns** - Similar operations should use identical patterns throughout.
193-
- **Minimal comments** - Code should be self-explanatory. Comments explain "why", not "what".
202+
- **Minimal comments** - Code should be self-explanatory. Comments explain "why", not
203+
"what".
194204

195205
### 2. Simplicity
196206

197-
- **No speculative handling** - Only handle edge cases that actually occur. Delete code for hypothetical scenarios.
198-
- **DRY without over-abstraction** - Extract repeated code, but don't create abstractions for single-use cases.
199-
- **Delete, don't deprecate** - Remove unused code entirely. No commented-out code or compatibility shims.
200-
- **Fail early, fail clearly** - Validate inputs at boundaries, then trust internal state.
207+
- **No speculative handling** - Only handle edge cases that actually occur. Delete code
208+
for hypothetical scenarios.
209+
- **DRY without over-abstraction** - Extract repeated code, but don't create
210+
abstractions for single-use cases.
211+
- **Delete, don't deprecate** - Remove unused code entirely. No commented-out code or
212+
compatibility shims.
213+
- **Fail early, fail clearly** - Validate inputs at boundaries, then trust internal
214+
state.
201215

202216
### Anti-patterns to Avoid
203217

@@ -210,7 +224,9 @@ Two requirements govern all code in this repository:
210224
## Resources
211225

212226
- [AGENTS.md](AGENTS.md) — Codex agent instructions and architecture details
213-
- [REFERENCE_GUIDE.md](REFERENCE_GUIDE.md) — Comprehensive integration development reference
214-
- [resources/](resources/) — HA development skills, agent specifications, and best practices
227+
- [REFERENCE_GUIDE.md](REFERENCE_GUIDE.md) — Comprehensive integration development
228+
reference
229+
- [resources/](resources/) — HA development skills, agent specifications, and best
230+
practices
215231
- `skills/ha-skills/` — Claude Code skills for HA integration development
216232
- `agents/` — Agent specifications for ha-integration-dev, debugger, and reviewer

README.md

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,20 @@
66
<img alt="HA Light Controller" src="brand-images/logo.png" width="200">
77
</picture>
88

9-
109
[![hacs_badge](https://img.shields.io/badge/HACS-Custom-41BDF5.svg)](https://github.com/hacs/integration)
1110
[![GitHub Release](https://img.shields.io/github/release/L3DigitalNet/HA-Light-Controller.svg)](https://github.com/L3DigitalNet/HA-Light-Controller/releases)
1211
[![License](https://img.shields.io/github/license/L3DigitalNet/HA-Light-Controller.svg)](LICENSE)
1312
[![Issues](https://img.shields.io/github/issues/L3DigitalNet/HA-Light-Controller.svg)](https://github.com/L3DigitalNet/HA-Light-Controller/issues)
1413

15-
HA Light Controller adds state verification and automatic retries to light commands. When you call `light.turn_on`, Home Assistant sends the command once and assumes success. This integration verifies that entities actually reached the target state and retries if they didn't.
14+
HA Light Controller adds state verification and automatic retries to light commands.
15+
When you call `light.turn_on`, Home Assistant sends the command once and assumes
16+
success. This integration verifies that entities actually reached the target state and
17+
retries if they didn't.
1618

17-
This solves the common problem of lights occasionally missing commands due to network congestion, Zigbee/Z-Wave mesh issues, or unresponsive devices. Instead of building retry logic into every script and automation, HA Light Controller handles verification centrally with configurable tolerances and backoff strategies.
19+
This solves the common problem of lights occasionally missing commands due to network
20+
congestion, Zigbee/Z-Wave mesh issues, or unresponsive devices. Instead of building
21+
retry logic into every script and automation, HA Light Controller handles verification
22+
centrally with configurable tolerances and backoff strategies.
1823

1924
### How It Works
2025

@@ -26,30 +31,37 @@ This solves the common problem of lights occasionally missing commands due to ne
2631

2732
## Key Features
2833

29-
- **State verification** - Confirms entities reached target brightness, color, and temperature within configurable tolerances
34+
- **State verification** - Confirms entities reached target brightness, color, and
35+
temperature within configurable tolerances
3036
- **Automatic retries** - Configurable retry attempts with exponential backoff
31-
- **Group expansion** - Automatically expands `light.*` and `group.*` entities to individual lights
32-
- **Per-entity overrides** - Set different attributes for each light in a single service call via the `targets` parameter
37+
- **Group expansion** - Automatically expands `light.*` and `group.*` entities to
38+
individual lights
39+
- **Per-entity overrides** - Set different attributes for each light in a single service
40+
call via the `targets` parameter
3341
- **Presets** - Store light configurations as button entities for one-tap activation
3442

3543
## Installation
3644

3745
### HACS
3846

39-
1. Add `https://github.com/L3DigitalNet/HA-Light-Controller` as a custom repository (Integration)
47+
1. Add `https://github.com/L3DigitalNet/HA-Light-Controller` as a custom repository
48+
(Integration)
4049
2. Install "HA Light Controller"
4150
3. Restart Home Assistant
4251

4352
### Manual
4453

45-
1. Copy `custom_components/ha_light_controller` to your `config/custom_components/` directory
54+
1. Copy `custom_components/ha_light_controller` to your `config/custom_components/`
55+
directory
4656
2. Restart Home Assistant
4757

4858
## Configuration
4959

50-
Add the integration via **Settings****Devices & Services****Add Integration** → "Light Controller".
60+
Add the integration via **Settings****Devices & Services****Add Integration**
61+
"Light Controller".
5162

52-
Configuration options include default brightness, transition time, verification tolerances (brightness, RGB, Kelvin), retry settings, and success logging.
63+
Configuration options include default brightness, transition time, verification
64+
tolerances (brightness, RGB, Kelvin), retry settings, and success logging.
5365

5466
## Usage
5567

@@ -61,7 +73,7 @@ data:
6173
entities:
6274
- light.living_room_ceiling
6375
- light.living_room_lamp
64-
state: "off"
76+
state: 'off'
6577
```
6678
6779
### Per-Entity Overrides
@@ -84,24 +96,28 @@ data:
8496
8597
### Presets
8698
87-
Create and edit presets via the integration options UI or programmatically. The UI supports per-entity configuration - set different brightness, color, and state for each light in the preset. Preset deletion includes a confirmation step.
99+
Create and edit presets via the integration options UI or programmatically. The UI
100+
supports per-entity configuration - set different brightness, color, and state for each
101+
light in the preset. Preset deletion includes a confirmation step.
88102
89103
```yaml
90104
service: ha_light_controller.create_preset
91105
data:
92-
name: "Movie Night"
106+
name: 'Movie Night'
93107
entities:
94108
- light.living_room
95109
- light.tv_backlight
96110
brightness_pct: 20
97111
color_temp_kelvin: 2700
98112
```
99113
100-
Each preset creates a `button.*` entity for activation and a `sensor.*` entity for status tracking.
114+
Each preset creates a `button.*` entity for activation and a `sensor.*` entity for
115+
status tracking.
101116

102117
## Documentation
103118

104-
See the **[Usage Guide](USAGE.md)** for complete service parameters, configuration options, and examples.
119+
See the **[Usage Guide](USAGE.md)** for complete service parameters, configuration
120+
options, and examples.
105121

106122
## Links
107123

0 commit comments

Comments
 (0)