为了让你体验各种免费的AI服务,本集成默认使用免费模型及服务,当然你可能会需要申请账号或创建 API Key。
开篇致谢:前人栽树,后人乘凉。没有 knoop7 和 edge-tts 这两个项目,就没有本集成,特此感谢!
To experience various free AI services, this integration uses free models and services by default. You may need to register an account or create an API Key.
Special Thanks: We stand on the shoulders of giants. Without knoop7 and edge-tts, this project would not exist!
- 🔧 前置条件 / Prerequisites
- 🌟 功能介绍 / Features
- 📦 安装方法 / Installation
- 🚀 快速开始 / Quick Start
- 🔑 账号注册与Token获取 / Account Registration & Token
- 📖 使用指南 / Usage Guide
- 🤝 参与贡献 / Contributing
- 📄 许可协议 / License
- 📱 关注我 / Follow Me
- ☕ 赞助支持 / Support
- Home Assistant: 2025.8.0 或更高版本 / 2025.8.0 or higher
- 网络要求 / Network: 本集成完全依赖互联网服务,稳定的网络连接是必需的 / This integration relies entirely on internet services; a stable network connection is required
AI Hub 是 Home Assistant 的自定义集成,提供对话助手、AI任务、TTS、STT,以及组件/蓝图汉化能力。
AI Hub is a custom integration for Home Assistant that provides conversation, AI tasks, TTS, STT, and component/blueprint localization.
说明: 微信等即时消息功能已从本项目移除,统一由 cn_im_hub 提供。
Note: Instant messaging features such as WeChat have been removed from this project and are now handled by cn_im_hub.
提示: 如果有些条目你不需要,只需不填 API Key 即可,或者直接删除,后续有需要可以再次添加。
Tip: If you don't need some entries, just leave the API key blank or delete it. You can add it back later when needed.
| 中文 | English |
|---|---|
| 回复自然: 支持日常问答、设备控制和状态查询 | Natural Replies: Supports daily conversations, device control, and state queries |
| 家居控制: 对接 Home Assistant LLM API,支持控制和查询设备状态 | Home Control: Integrates with Home Assistant LLM API to control devices and query states |
| 图片理解: 消息携带图片时自动切换到视觉模型(GLM-4.1V-9B-Thinking) | Image Understanding: Automatically switches to vision model (GLM-4.1V-9B-Thinking) when message contains an image |
| 连续对话: 支持多轮对话,适合日常家居语音场景 | Multi-turn Conversation: Supports follow-up conversations for daily smart home use |
| 中文 | English |
|---|---|
| 任务生成: 可用于生成文本内容、整理信息和处理复杂指令 | Task Assistance: Useful for content generation, organizing information, and handling more complex prompts |
| 图片生成: 使用 Kolors 等模型生成图片,支持 URL 或 base64 返回 | Image Generation: Generate images using Kolors and other models, supporting URL or base64 result |
| 多模态支持: 复用对话消息格式,便于复杂任务处理 | Multimodal Support: Reuses conversation message format for complex tasks |
| 中文 | English |
|---|---|
| 高质量语音: 集成微软 Edge TTS,支持多语言、多风格 | High-Quality Voice: Integrates Microsoft Edge TTS, supporting multiple languages and styles |
| 丰富语音库: 支持晓晓、云健、Aria、Jenny 等 400+ 种语音模型 | Rich Voice Library: Supports 400+ voices including Xiaoxiao, Yun Jian, Aria, Jenny, and more |
| Prosody 参数: 支持语速(rate)、音量(volume)、音调(pitch)调节 | Prosody Parameters: Supports rate, volume, and pitch adjustments |
| 对话播报: 适合搭配语音助手和日常播报场景 | Conversation Playback: Suitable for voice assistants and everyday announcement scenarios |
| 多种格式: 输出 MP3 格式音频 | Audio Format: Outputs MP3 format audio |
| 中文 | English |
|---|---|
| 高精度识别: 集成硅基流动语音识别服务,支持 SenseVoice、TeleSpeechASR 等模型 | High Accuracy Recognition: Integrates SiliconFlow speech recognition service, supporting SenseVoice, TeleSpeechASR and more models |
| 自动语言检测: 自动识别中文、英文、日文、韩文等多种语言,无需手动指定 | Auto Language Detection: Automatically detects Chinese, English, Japanese, Korean, and other languages without manual specification |
| 格式兼容: 支持常见音频格式,便于接入不同来源的录音 | Format Compatibility: Supports common audio formats for different recording sources |
| 实时处理: 适合语音控制、Voice Assistant 等场景 | Real-Time Processing: Suitable for voice control, Voice Assistant, and other scenarios |
| 中文 | English |
|---|---|
| 自动翻译: 使用AI自动翻译自定义组件的英文翻译文件为中文 | Auto Translation: Use AI to automatically translate custom component English translation files to Chinese |
| 批量处理: 支持批量处理多个组件的汉化工作 | Batch Processing: Supports batch localization for multiple components |
| 智能识别: 自动识别需要翻译的组件,跳过已存在中文翻译的文件 | Intelligent Recognition: Automatically detects components needing translation, skipping already localized ones |
| 中文 | English |
|---|---|
| 一键汉化: 在集成界面中添加"蓝图汉化"按钮,一键完成所有blueprints的汉化 | One-Click Localization: Add "Blueprint Localization" button in the integration interface for one-click translation of all blueprints |
| 原位翻译: 直接修改原始blueprint文件,不产生额外翻译文件 | In-Place Translation: Directly modify original blueprint files without creating additional translation files |
| 智能保护: 自动保护技术参数和变量,只翻译用户界面文本 | Smart Protection: Automatically protect technical parameters and variables, only translating user interface text |
| 递归扫描: 自动扫描blueprints目录及其子目录中的所有YAML文件 | Recursive Scanning: Automatically scan blueprints directory and its subdirectories for all YAML files |
| 状态检测: 智能检测已汉化文件,避免重复翻译 | Status Detection: Intelligently detect already localized files to avoid duplicate processing |
| 完整支持: 支持复杂的嵌套结构和Home Assistant特殊语法 | Complete Support: Support complex nested structures and Home Assistant special syntax |
- 打开 HACS: 在 Home Assistant 中进入 HACS → 集成 / In Home Assistant, go to HACS → Integrations
- 搜索集成: 点击右上角的"探索与下载 repositories",搜索"ai_hub" / Click "Explore & Download Repositories" in the upper right, search for "ai_hub"
- 安装集成: 找到"AI Hub"并点击下载 / Find "AI Hub" and click Download
- 重启系统: 重启 Home Assistant 使集成生效 / Restart Home Assistant to activate
- 下载文件: 从 GitHub Releases 下载最新版本的
ai_hub.zip/ Download the latestai_hub.zipfrom GitHub Releases - 解压文件: 将 zip 文件解压到
<HA_CONFIG>/custom_components/ai_hub/目录 / Unzip to<HA_CONFIG>/custom_components/ai_hub/ - 重启系统: 重启 Home Assistant / Restart Home Assistant
提示: 本集成依赖新版的 Conversation/AI Task/子条目框架,建议使用较新的 Home Assistant 版本(>2025.8.0)。
Tip: This integration depends on the new Conversation/AI Task/Entry framework; a newer Home Assistant version (>2025.8.0) is recommended.
- 添加集成: 进入 设置 → 设备与服务 → 集成 → 添加集成,搜索"AI HUB(ai_hub)" / Go to Settings → Devices & Services → Integrations → Add Integration, search "AI HUB (ai_hub)"
- 配置 API Keys: 按照向导提示依次配置以下服务 / Follow the wizard to configure:
- 硅基流动 API Key(用于对话、AI任务、STT)/ SiliconFlow API Key (for Conversation, AI Task, and STT)
- 验证配置: 系统会自动验证 API Keys 的有效性 / System will verify your API Keys
- 完成设置: 配置完成后,集成会自动创建相应的服务和实体 / Integration will auto-create relevant services and entities
AI Hub 支持子条目配置,可以为不同功能创建独立的配置:
AI Hub supports sub-entry configuration for independent functionality:
| 中文 | English |
|---|---|
| AI Hub对话助手: 用于 Assist 对话代理 | AI Hub Conversation: For Assist agents |
| AI Hub AI任务: 用于图片生成和结构化数据 | AI Hub AI Task: For image generation and structured data |
| AI Hub TTS语音: 用于文本转语音 | AI Hub TTS: For text-to-speech |
| AI Hub STT语音: 用于语音转文本 | AI Hub STT: For speech-to-text |
| AI Hub 集成汉化: 用于集成汉化 | AI Hub Localization: For component translation |
| AI Hub 蓝图汉化: 用于蓝图汉化 | AI Hub Blueprint Localization: For blueprint translation |
| 项目 | 内容 |
|---|---|
| 用途 / Usage | 对话助手、AI任务、语音识别 / Conversation, AI Tasks, STT |
| 注册地址 / Register | 点击注册 / Sign Up Here |
获取 API Key / Get API Key:
- 完成注册并登录 / Register and login
- 进入控制台 / Go to the dashboard
- 在 API密钥管理 页面创建新的 API Key / Create new API Key in the API Key Management page
- 复制生成的 API Key / Copy your new API Key
注意: Edge TTS 使用微软官方免费接口,不需要单独的 API Key。
Note: Edge TTS uses the official Microsoft free API; no API Key is required.
- 切换代理: 在 Assist 对话页面,将当前代理切换为"AI Hub对话助手" / In Assist, set agent to "AI Hub Conversation"
- 开始对话: 直接输入或说出问题,如 / Input/speak questions such as:
- "打开客厅灯到 60%" / "Turn on the living room light to 60%"
- "帮我总结今天日程" / "Summarize my schedule for today"
- "设置一个明早8点的闹钟" / "Set an alarm for 8 AM tomorrow"
- 上传图片: 在支持的前端上传图片或引用摄像头图片 / Upload images or use camera snapshots in a supported frontend
- 描述问题: 输入对图片的描述或问题 / Input what you want to ask/analyze about the image
- 获取分析: 模型会自动进行视觉分析并回答 / The model analyzes and responds automatically
- 启用家居能力: 在对话助手子条目中启用"LLM Hass API" / Enable "LLM Hass API" in the conversation sub-entry
- 控制与查询: 可以直接控制设备或查询状态 / Control devices or check their status directly
通过自动化或服务调用生成图片:
Generate images via automation or service invocation:
automation:
- alias: "生成每日图片 / Generate daily picture"
trigger:
- platform: time
at: "08:00:00"
action:
- service: ai_hub.generate_image
data:
prompt: "美丽的日出风景 / Beautiful sunrise landscape"
size: "1024x1024"
model: "Kwai-Kolors/Kolors"可用于整理信息、生成内容或处理复杂需求:
Useful for organizing information, generating content, or handling more complex requests:
# 调用AI任务生成JSON数据 / Call AI task to generate JSON data
service: ai_hub.ai_task
data:
input: "帮我生成一个包含姓名、年龄、职业的JSON格式数据 / Generate a JSON including name, age, and occupation"
model: "Qwen/Qwen3-8B"
temperature: 0.3- 选择TTS: 在媒体播放器中选择"AI Hub TTS语音"作为语音服务 / In a media player, select "AI Hub TTS"
- 输入文本: 输入要合成的文本内容 / Enter your text
- 播放语音: 系统会自动播放合成的语音 / It will be played automatically
- 选择STT: 在麦克风设置中选择"AI Hub STT语音" / In microphone settings, select "AI Hub STT"
- 开始录音: 点击录音按钮开始语音输入 / Start recording
- 获取文本: 系统会自动将语音转换为文本 / Speech will be converted to text
service: ai_hub.stt_transcribe
data:
file: "/config/tmp/recording.wav"
model: "FunAudioLLM/SenseVoiceSmall"service: ai_hub.translate_components
data:
custom_components_path: "custom_components" # 可选 / Optional, default path
force_translation: false # 是否强制重新翻译 / Force re-translate- 添加蓝图汉化子条目: 在 AI Hub 集成详情页,点击"添加子条目",选择"AI Hub 蓝图汉化" / In AI Hub integration details page, click "Add Sub-Entry" and select "AI Hub Blueprint Localization"
- 一键汉化: 在集成详情页点击"蓝图汉化"按钮 / Click the "Blueprint Localization" button in the integration details page
系统会自动 / The system will automatically:
- 扫描
/config/blueprints目录及其子目录中的所有 YAML 文件 - 智能识别已汉化文件,跳过重复处理
- 保护技术参数、变量名和 Home Assistant 语法
- 直接在原文件上进行汉化,不产生额外文件
# 列出所有 Blueprint 文件及其汉化状态 / List all Blueprint files and their status
service: ai_hub.translate_blueprints
data:
list_blueprints: true # 仅列出状态,不执行汉化 / Only list status
target_blueprint: "" # 留空表示查看所有 / Leave empty to view all
force_translation: false
# 汉化指定的 Blueprint 文件 / Localize specific Blueprint file
service: ai_hub.translate_blueprints
data:
list_blueprints: false # 执行汉化操作 / Perform localization
target_blueprint: "my_blueprint.yaml" # 指定文件名(不含路径)
force_translation: false
# 汉化所有 Blueprint 文件 / Localize all Blueprint files
service: ai_hub.translate_blueprints
data:
list_blueprints: false
target_blueprint: "" # 留空表示汉化所有 / Leave empty to localize all
force_translation: false欢迎参与项目贡献,帮助完善功能与文档:
You're welcome to contribute — improve features and docs!
- 报告问题: 在 Issues 中报告 bug 或提出功能建议 / Report Bugs
- 提交代码: Fork 项目,修改代码后提交 Pull Request / Fork, modify & PR
- 完善文档: 帮助改进文档内容,增加使用示例 / Improve Docs
- 测试反馈: 测试新功能并提供反馈 / Feedback
本项目遵循仓库内 LICENSE 协议发布。
This project is released under the LICENSE in this repository.
- 项目主页 / Homepage: https://github.com/ha-china/ai_hub
- 问题反馈 / Issue Tracker: https://github.com/ha-china/ai_hub/issues
- 发布版本 / Releases: https://github.com/ha-china/ai_hub/releases
- HACS 页面 / HACS Page: HACS 集成商店 / HACS Integration Shop
- 感谢 knoop7 项目的基础架构 / Thanks to knoop7 for project foundation
- 感谢 hasscc/hass-edge-tts 项目的 Edge TTS 集成 / Thanks to hass-edge-tts for Edge TTS integration
- 感谢所有贡献者和用户的支持与反馈 / Thanks to all contributors and users for support and feedback
📲 扫描下面二维码,关注我。有需要可以随时给我留言:
Scan the QR code below to follow me! Feel free to leave me a message:
如果您觉得我花费大量时间维护这个库对您有帮助,欢迎请我喝杯奶茶,您的支持将是我持续改进的动力!
If you found my work helpful, please buy me a milk tea! Your support motivates continuous improvement!
💖 感谢您的支持与鼓励!/ Thank you for your support! 💖

