Home Assistant custom integration patterns and architectural decisions. Use when building HACS integrations, custom components, or API bridges for Home Assistant. Covers service response data, HTTP views, storage APIs, and integration architecture.
数据来源:ClawHub。 在 ClawSkills 查看
选择你使用的 Agent
方法一:命令行安装(推荐)
推荐(无需提前安装 clawhub)
npx clawhub@latest --dir ~/.claude/skills install ha-integration-patterns或使用 clawhub CLI(需提前安装)
clawhub --dir ~/.claude/skills install ha-integration-patterns⚠️ 需要 Node.js 18+,没有 Node?请使用下方方法二直接下载 ZIP。 安装 Node.js →
方法二:手动下载安装(无需 Node)
下载 ZIP,解压后将文件夹放到以下路径,重启 Agent 即可:
安装路径
~/.claude/skills/ha-integration-patterns/💡解压后将文件夹放到上方路径,重启 Agent 即可生效
--- name: ha-integration-patterns description: Home Assistant custom integration patterns and architectural decisions. Use when building HACS integrations, custom components, or API bridges for Home Assistant. Covers service response data, HTTP views, storage APIs, and integration architecture. ---
By default, HA services are "fire-and-forget" and return empty arrays [].
Register service with supports_response:
from homeassistant.helpers.service import SupportsResponse
hass.services.async_register(
domain,
"get_full_config",
handle_get_full_config,
schema=GET_CONFIG_SCHEMA,
supports_response=SupportsResponse.ONLY, # ← KEY PARAMETER
)
Call with ?return_response flag:
curl -X POST "$HA_URL/api/services/your_domain/get_full_config?return_response"
async def handle_get_full_config(hass: HomeAssistant, call: ServiceCall):
"""Handle the service call and return data."""
# ... your logic ...
return {"entities": entity_data, "automations": automation_data}
---
| Use Case | Use | Don't Use | |----------|-----|-----------| | Return complex data | HTTP View | Service (without response support) | | Fire-and-forget actions | Service | HTTP View | | Trigger automations | Service | HTTP View | | Query state/config | HTTP View | Internal storage APIs |
For data retrieval APIs:
from homeassistant.components.http import HomeAssistantView
class OpenClawConfigView(HomeAssistantView):
"""HTTP view for retrieving config."""
url = "/api/openclaw/config"
name = "api:openclaw:config"
requires_auth = True
async def get(self, request):
hass = request.app["hass"]
config = await get_config_data(hass)
return json_response(config)
# Register in async_setup:
hass.http.register_view(OpenClawConfigView())
---
Never use underscore-prefixed APIs — they're private and change between versions.
❌ Wrong:
storage_collection = hass.data["_storage_collection"]
✅ Right:
# Use public APIs only
from homeassistant.helpers.storage import Store
store = Store(hass, STORAGE_VERSION, STORAGE_KEY)
---
from homeassistant.helpers.storage import Store
STORAGE_KEY = "your_domain.storage"
STORAGE_VERSION = 1
store = Store(hass, STORAGE_VERSION, STORAGE_KEY)
# Save
data = {"entities": modified_entities}
await store.async_save(data)
# Load
data = await store.async_load()
Use external database or file storage, not HA storage helpers.
---
| Change | Version | Migration | |--------|---------|-----------| | Conversation agents | 2025.x+ | Use async_process directly | | Service response data | 2023.7+ | Add supports_response param | | Config entry migration | 2022.x+ | Use async_migrate_entry |
Always check: https://www.home-assistant.io/blog/ for your target version range.
---
custom_components/your_domain/
├── __init__.py # async_setup_entry
├── config_flow.py # UI configuration
├── manifest.json # Dependencies, version
├── services.yaml # Service definitions
└── storage_services.py # Your storage logic
{
"domain": "your_domain",
"name": "Your Integration",
"codeowners": ["@yourusername"],
"config_flow": true,
"dependencies": [],
"requirements": [],
"version": "1.0.0"
}
---
?return_response)---
developers.home-assistant.io/docs/creating_integration_indexdevelopers.home-assistant.io/docs/dev_101_servicesdevelopers.home-assistant.io/docs/api/webserverhome-assistant.io/blog/ (filter by version)hacs.xyz/docs/publish/start---
From HA-OpenClaw Bridge attempt:
> "80% of our issues were discoverable with 30-60 minutes of upfront docs reading. We jumped straight to coding based on assumptions rather than reading how HA actually works."
Use skills/pre-coding-research/ methodology before starting.
安装 Ha Integration Patterns 后,可以对 AI 说这些话来触发它
Help me get started with Ha Integration Patterns
Explains what Ha Integration Patterns does, walks through the setup, and runs a quick demo based on your current project
Use Ha Integration Patterns to home Assistant custom integration patterns and architectural decisions
Invokes Ha Integration Patterns with the right parameters and returns the result directly in the conversation
What can I do with Ha Integration Patterns in my developer & devops workflow?
Lists the top use cases for Ha Integration Patterns, with example commands for each scenario
将技能文件夹放到 ~/.claude/skills/ha-integration-patterns/ 目录(个人级,所有项目可用),或 .claude/skills/ha-integration-patterns/(项目级)。重启 AI 客户端后,用 /ha-integration-patterns 主动调用,或让 AI 根据上下文自动发现并使用。
Ha Integration Patterns 支持 Claude、Cursor、OpenClaw,可与这些 AI 平台无缝集成,扩展其能力。
Ha Integration Patterns 可免费安装使用。请查阅仓库了解许可证信息。
Home Assistant custom integration patterns and architectural decisions. Use when building HACS integrations, custom components, or API bridges for Home Assistant. Covers service response data, HTTP views, storage APIs, and integration architecture.
Automate my developer & devops tasks using Ha Integration Patterns
Identifies repetitive steps in your workflow and sets up Ha Integration Patterns to handle them automatically
Ha Integration Patterns 属于「Developer & DevOps」分类,该分类的技能帮助 AI 智能体在此领域执行专业任务。