Skip to content

Commit d4932ac

Browse files
committed
fix: use correct method get_entity_registry_list() instead of get_entity_registry()
- Fixed bug where delete_automation tried to call non-existent get_entity_registry() method - Changed to get_entity_registry_list() which is the correct method name - This fixes ghost entry removal from Entity Registry when automation not found in storage
1 parent eb2b37d commit d4932ac

5 files changed

Lines changed: 42 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,43 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [2.10.34] - 2026-01-27
6+
7+
### 🚀 API-based automation & script management + Security fix
8+
9+
**Breaking the file structure barrier: Now works with ALL automations and scripts, regardless of where they live**
10+
11+
#### The Problem We Solved
12+
13+
Previously, the agent could only see and manage automations and scripts that were stored in the traditional `automations.yaml` and `scripts.yaml` files. This created a frustrating limitation for users with mature Home Assistant setups:
14+
15+
- **Users with packages**: If you organized your config using `packages/*.yaml` files (a common practice for larger installations), the agent couldn't see those automations/scripts
16+
- **UI-created automations**: Automations created through Home Assistant's web interface are stored in `.storage` and were completely invisible to the agent
17+
- **Mixed setups**: Many users have a mix of file-based and UI-created automations, but the agent could only work with the file-based ones
18+
19+
**Real-world impact**: A user reported having 159 automations in their system, but the agent could only see 4 of them (the ones in `automations.yaml`). The other 155 automations were invisible and unmanageable through the agent.
20+
21+
#### The Solution
22+
23+
We've completely rebuilt how the agent interacts with automations and scripts. Instead of reading and writing YAML files directly, the agent now uses Home Assistant's official WebSocket API (`config/automation/list`, `config/script/list`, etc.). This means:
24+
25+
-**See everything**: `list_automations` and `list_scripts` now return ALL automations/scripts that Home Assistant knows about, regardless of where they're stored:
26+
- From `automations.yaml` / `scripts.yaml` (traditional files)
27+
- From `packages/*.yaml` files (organized configs)
28+
- Created via UI (stored in `.storage`)
29+
-**Get individual items**: You can now fetch a specific automation or script by ID using `get_automation` or `get_script`, without loading entire YAML files
30+
-**List IDs only**: Both endpoints support `ids_only=true` parameter to get just a list of IDs without full configurations, saving tokens and context
31+
-**Create/update/delete via API**: All write operations now go through Home Assistant's API, so they work regardless of your file structure
32+
-**Smart Git versioning**: After each operation, the agent exports the current state of all automations/scripts to Git in `export/automations/<id>.yaml` and `export/scripts/<id>.yaml` format, creating a complete history
33+
-**Intelligent rollback**: When rolling back to a previous Git commit, the agent detects exported automations/scripts and applies them via API, ensuring consistent restoration
34+
-**Backwards compatible**: Old Git commits (without the export/ structure) still work via file-based rollback, so your existing backups remain functional
35+
36+
**Result**: That user with 159 automations? Now all 159 are visible and manageable. No more file structure limitations.
37+
38+
#### Security Fix (from PR #22)
39+
40+
-**Secure API key regeneration**: The `/api/regenerate-key` endpoint now requires authentication (valid API key in `Authorization: Bearer <key>` header) to prevent unauthorized key regeneration from arbitrary web pages. Previously, any website could call this endpoint and regenerate your API key without authentication, creating a critical security vulnerability. The UI still works seamlessly by passing the current key in the request header when regenerating keys.
41+
542
## [2.10.33] - 2026-01-27
643

744
### 🚀 API-based automation & script management + Security fix

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# HA Vibecode Agent - Home Assistant Add-on
22

3-
[![Version](https://img.shields.io/badge/version-2.10.33-blue.svg)](https://github.com/Coolver/home-assistant-vibecode-agent)
3+
[![Version](https://img.shields.io/badge/version-2.10.34-blue.svg)](https://github.com/Coolver/home-assistant-vibecode-agent)
44
[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
55
[![MCP Package](https://img.shields.io/npm/v/@coolver/home-assistant-mcp?label=MCP%20Package)](https://www.npmjs.com/package/@coolver/home-assistant-mcp)
66

app/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
logger = setup_logger('ha_cursor_agent', LOG_LEVEL)
2727

2828
# Agent version
29-
AGENT_VERSION = "2.10.33"
29+
AGENT_VERSION = "2.10.34"
3030

3131
# FastAPI app
3232
app = FastAPI(

app/services/ha_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,7 @@ async def delete_automation(self, automation_id: str) -> Dict:
781781
ws_client = await get_ws_client()
782782

783783
# Get Entity Registry to find automations by alias
784-
entity_registry = await ws_client.get_entity_registry()
784+
entity_registry = await ws_client.get_entity_registry_list()
785785
automation_entities = [e for e in entity_registry if e.get('entity_id', '').startswith('automation.')]
786786

787787
# Normalize automation_id for alias matching
@@ -872,7 +872,7 @@ async def delete_automation(self, automation_id: str) -> Dict:
872872
pass
873873

874874
# Get Entity Registry to find all matching automations
875-
entity_registry = await ws_client.get_entity_registry()
875+
entity_registry = await ws_client.get_entity_registry_list()
876876
automation_entities = [e for e in entity_registry if e.get('entity_id', '').startswith('automation.')]
877877

878878
# Get actual entity_id from location if available

config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Home Assistant Add-on Configuration
22
name: HA Vibecode Agent
3-
version: "2.10.33"
3+
version: "2.10.34"
44
slug: home_assistant_cursor_agent
55
description: "Enable Cursor, VS Code, Claude Code, or any MCP-enabled IDE to help you vibe-code and manage Home Assistant: create and debug automations, design dashboards, tweak themes, modify configs, and deploy changes using natural language"
66
url: https://github.com/Coolver/home-assistant-cursor-agent

0 commit comments

Comments
 (0)