diff --git a/redis-server/DOCS.md b/redis-server/DOCS.md new file mode 100644 index 0000000..64d8c2f --- /dev/null +++ b/redis-server/DOCS.md @@ -0,0 +1,88 @@ +# Redis 服务器 + +Redis 是一个开源的内存数据库,可以用作缓存、消息代理和数据存储。此插件为您的 Home Assistant 安装 Redis 服务器。 + +## 如何使用 + +安装后,Redis 服务器将在默认端口(6379)上运行,并可以通过 Home Assistant 或网络中的其他设备访问。 + +### 配置 + +以下选项可在插件配置页面上设置: + +```yaml +# 示例配置 +port: 6379 +databases: 4 +password: mypassword # 强烈建议设置密码 +appendonly: true +``` + +#### 选项 `port` + +Redis 服务器的监听端口。默认是 6379。 + +#### 选项 `databases` + +Redis 实例中的数据库数量。默认是 4。 + +#### 选项 `password` + +可选的 Redis 认证密码。为了安全起见,强烈建议设置此选项。 + +#### 选项 `appendonly` + +启用/禁用 AOF(Append Only File)持久化。此选项默认为启用,确保在重启后数据仍然可用。 + +## 高级配置 + +本插件支持使用完整的 Redis 配置文件进行高级配置。插件首次启动时,会在`/config/redis/redis.conf`创建一个默认的 Redis 配置文件,并通过软链接连接到`/etc/redis.conf`。 + +您可以通过直接编辑`/config/redis/redis.conf`文件来自定义 Redis 的所有设置。这些更改将在插件下次重启时生效。 + +### 配置文件路径 + +- 主配置文件:`/config/redis/redis.conf` +- 软链接位置:`/etc/redis.conf` + +### 常用高级配置选项 + +以下是一些您可能需要在配置文件中调整的常用高级选项: + +``` +# 内存限制 +maxmemory 100mb +maxmemory-policy allkeys-lru + +# 快照配置 +save 900 1 +save 300 10 +save 60 10000 + +# 连接限制 +maxclients 1000 + +# 日志级别 +loglevel notice +``` + +关于所有可用配置选项的详细说明,请参考[Redis 官方文档](https://redis.io/topics/config)。 + +### 注意事项 + +- 如果您在配置文件中修改了基本设置(如端口号),请确保同时更新插件的配置选项,以保持一致性。 +- 建议在修改配置文件前先创建备份。 +- 不当的配置更改可能导致 Redis 服务无法启动。 + +## 使用案例 + +Redis 服务器可以用于多种场景: + +1. 高速缓存 +2. 用于 Home Assistant 自动化规则的消息代理 +3. 临时数据存储 +4. 跨设备/服务的共享状态存储 + +## 支持 + +如有问题或建议,请通过 GitHub 仓库提交问题。 diff --git a/redis-server/README.md b/redis-server/README.md new file mode 100644 index 0000000..cece8f5 --- /dev/null +++ b/redis-server/README.md @@ -0,0 +1,80 @@ +# 冬瓜甄选addons:Home Assistant Redis 服务器插件 + +这个插件为 Home Assistant 提供了一个 Redis 服务器。Redis 是一个开源的内存数据库,可以用作缓存、消息代理和数据存储。 + +## 安装 + +1. 在 Home Assistant 中添加此存储库 URL 到您的插件商店 +2. 安装 Redis 服务器插件 +3. 启动 Redis 服务器插件 + +## 配置选项 + +| 选项 | 描述 | +| ---------- | ------------------------------ | +| port | Redis 服务器端口(默认:6379) | +| databases | Redis 数据库数量(默认:4) | +| password | Redis 认证密码(可选) | +| appendonly | 启用持久化存储(默认:开启) | + +## 配置文件 + +插件第一次启动时会在`/config/redis/redis.conf`创建一个默认的 Redis 配置文件,并通过软链接到`/etc/redis.conf`。您可以直接编辑此配置文件来自定义 Redis 的高级设置。 + +配置文件的更改将在插件下次重启时生效。插件的基本设置(端口、数据库数量、密码和持久化)会在首次创建配置文件时自动应用。 + +## 如何使用 + +安装并启动后,Redis 服务器将在您的 Home Assistant 实例上运行。您可以使用标准的 Redis 客户端连接它: + +``` +redis-cli -h -p 6379 +``` + +如果您设置了密码,可以通过以下方式连接: + +``` +redis-cli -h -p 6379 -a +``` + +## 数据持久化 + +默认情况下,Redis 数据将保存在`/data`目录中。如果您启用了`appendonly`选项,Redis 将使用 AOF(Append Only File)方式进行持久化。 + +## 开发信息 + +### 自动化构建 + +本项目使用 GitLab CI 进行自动化构建。当代码推送到主分支或创建标签时,CI 流水线会自动构建并推送 Docker 镜像。 + +支持的架构: + +- aarch64 (ARM 64 位) +- amd64 (x86_64) + +### 手动构建 + +如需手动构建,可以使用以下命令: + +```bash +# 获取版本号 +VERSION=$(jq -r '.version' config.yaml) +ARCH="aarch64" # 或 "amd64" + +# 从build.yaml获取基础镜像 +BUILD_FROM=$(yq eval ".build_from.${ARCH}" build.yaml) + +# 构建Docker镜像 +docker build \ + --build-arg BUILD_FROM="${BUILD_FROM}" \ + --build-arg BUILD_ARCH="${ARCH}" \ + --build-arg BUILD_VERSION="${VERSION}" \ + -t "registry.wghaos.com/wghaos/redis-server:${ARCH}-${VERSION}" \ + . +``` + +## 注意事项 + +- 默认情况下,Redis 仅监听本地网络。 +- 建议为您的 Redis 实例设置密码以增强安全性。 +- 如果您修改了配置文件中的基本设置(如端口),请确保同时更新插件的配置选项,以保持一致性。 diff --git a/redis-server/config.yaml b/redis-server/config.yaml new file mode 100644 index 0000000..d1a2c70 --- /dev/null +++ b/redis-server/config.yaml @@ -0,0 +1,29 @@ +name: "Redis Server" +version: "7.2.7" +slug: "redis-server" +description: "Redis数据库服务器插件,为您的Home Assistant提供高性能缓存和数据存储服务" +url: "https://github.com/redis/redis" +startup: services +boot: manual +init: false +host_network: false +ingress: false +arch: + - aarch64 + - amd64 +map: + - config:rw +ports: + 6379/tcp: 6379 +ports_description: + 6379/tcp: "Redis服务器端口" +schema: + port: "int(1025,65535)?" + databases: "int(1,16)?" + password: "str?" + appendonly: "bool?" +options: + port: 6379 + databases: 4 + appendonly: true +image: "r.hassbus.com/wghaos/redis-server" diff --git a/redis-server/icon.png b/redis-server/icon.png new file mode 100644 index 0000000..14f1219 Binary files /dev/null and b/redis-server/icon.png differ diff --git a/redis-server/logo.png b/redis-server/logo.png new file mode 100644 index 0000000..7be8b87 Binary files /dev/null and b/redis-server/logo.png differ diff --git a/xiaozhi-esp32-server-mini/CHANGELOG.md b/xiaozhi-esp32-server-mini/CHANGELOG.md new file mode 100644 index 0000000..74fe2d6 --- /dev/null +++ b/xiaozhi-esp32-server-mini/CHANGELOG.md @@ -0,0 +1,35 @@ +# 更新日志 + +## 0.3.4 + +- 版本升级 + +## 1.0.3 + +- 添加 ASR(语音识别)配置选项到 Home Assistant 界面 +- 支持选择不同的语音识别模型(FunASR、SherpaASR、DoubaoASR、TencentASR) +- 为在线语音识别服务添加 API 凭据配置 +- 修复音乐目录递归软链接的问题 +- 优化脚本代码结构,删除冗余注释,提高可读性 +- 修复唤醒词配置保存时出现的空行累积问题 + +## 1.0.2 + +- 添加 LLM 模型名称配置选项,允许用户自定义模型名称 +- 修复翻译文件格式问题 +- 优化配置文件更新逻辑,避免文件格式损坏 +- 改进文件管理方式,使用软链接减少存储空间占用 + +## 1.0.1 + +- 修复 Home Assistant 加载项配置同步功能 +- 添加自动将加载项配置应用到.config.yaml 的功能 +- 完善配置同步机制,支持所有加载项配置参数 +- 更新文档,详细说明配置方法和故障排除 + +## 1.0.0 + +- 首次发布 +- 支持小智 ESP32 语音识别服务 +- 自动下载模型和配置 +- 使用 S6 Overlay 进行服务管理 diff --git a/xiaozhi-esp32-server-mini/DOCS.md b/xiaozhi-esp32-server-mini/DOCS.md new file mode 100644 index 0000000..89ebed5 --- /dev/null +++ b/xiaozhi-esp32-server-mini/DOCS.md @@ -0,0 +1,52 @@ +# 小智 AI Server 极速版 + +本加载项提供虾哥小智AI音箱的HA本地服务器功能,让大家简单玩转AI语音设备控制。 + +## 安装 + +1. 安装"小智 AI Server 极速版"加载项 +3. 配置加载项 + +## 使用说明(快速入门) + +使用之前先做如下的准备: + +1. 更换成小智AI音箱(HA专用固件) + + (1)烧录专用固件,固件烧录地址:https://xzfw.wghaos.com/ + + (2)配置网络 + +2. 火山引擎 + + (1)注册并认证火山引擎:https://www.volcengine.com/ + + (2)LLM(大语言模型服务)模型名称及API密钥的获取: + + - 打开以下网址,开通的服务搜索Doubao-pro-32k,开通它 + + 开通改地址:https://console.volcengine.com/ark/region:ark+cn-beijing/openManagement?LLM=%7B%7D&OpenTokenDrawer=false + + - 免费额度500000token + + - 开通后,进入这里获取密钥:https://console.volcengine.com/ark/region:ark+cn-beijing/apiKey?apikey=%7B%7D + + (3)TTS(文本转语音)和语音识别模型(ASR)的语音识别APPID和语音合成令牌的获取: + + 注:TTS和ASR可以使用同一个。 + + - 在后面链接申请相关Key等信息,https://console.volcengine.com/speech/app + - 填写相应的appid和access_token + - 语音合成音色,可以填"BV001_streaming" + +3. 填写homeassistant令牌 + + 点击左下角的用户头像,选择**安全**,向下滚动到长期访问令牌部分,点击创建令牌,生成后复制并保存(关闭后无法再次查看) + +4. 启动体验 + + + +### 支持 + +详细错做说明,请查看www.wghaos.com或者https://bbs.hassbian.com查看 diff --git a/xiaozhi-esp32-server-mini/README.md b/xiaozhi-esp32-server-mini/README.md new file mode 100644 index 0000000..7d177ad --- /dev/null +++ b/xiaozhi-esp32-server-mini/README.md @@ -0,0 +1,23 @@ +# 冬瓜甄选addons:小智 AI Server 极速版 + +小智 AI Server是home assistant中专用的小智AI服务器,免搭建让小智快速在HA中使用。 + + + +## 关于 + +此系列共有三个版本,旨在满足不同需求的用户快速玩转小智AI + +- 小智 AI Server 极速版:在addons配置进行优化,介绍以豆包平台为主,可以在10分钟内建好小智AI控制。 +- 小智 AI Server 简化版:原汁原味官方简化版,可方便对照网上教程调整配置。 +- 小智 AI OTA管理: 官方的全模块版,主要是OTA管理,可研究通讯方式等。 + +另提供小智AI的固件在线刷机,支持免激活版。 + +链接:https://xzfw.wghaos.com + + + +## 支持与反馈 + +本项目基于[xinnan-tech/xiaozhi-esp32-server](https://github.com/xinnan-tech/xiaozhi-esp32-server) 开发。 diff --git a/xiaozhi-esp32-server-mini/config.yaml b/xiaozhi-esp32-server-mini/config.yaml new file mode 100644 index 0000000..09d48f4 --- /dev/null +++ b/xiaozhi-esp32-server-mini/config.yaml @@ -0,0 +1,61 @@ +name: "小智 AI Server 极速版" +version: "0.3.4" +slug: "xiaozhi_esp32_server_mini" +description: "小智 AI Server 极速版 - 提供语音识别、对话和控制功能,支持与ESP32设备通信" +url: "https://gitcode.com/waxgourd/addons" +arch: + - aarch64 + - amd64 +startup: application +boot: manual +translations: true +ports: + 8000/tcp: 8000 +ports_description: + 8000/tcp: "WebSocket服务端口" +map: + - addon_config:rw +host_network: false +init: false +watchdog: "tcp://[HOST]:[PORT:8000]" +journald: true +options: + plugins.home_assistant.base_url: http://homeassistant.local:8123 + plugins.home_assistant.api_key: "" + plugins.home_assistant.devices: [ ] + llm.type: DoubaoLLM + model_name: "doubao-1-5-pro-32k-250115" + llm.api_key: "" + tts.type: DoubaoTTS + tts.appid: "" + tts.access_token: "" + tts.voice: "" + asr.type: DoubaoASR + asr.appid: "" + asr.access_token: "" + asr.secret_key: "" + plugins.get_weather.api_key: a861d0d5e7bf4ee1a83d9a9e4f96d4da + plugins.get_weather.default_location: 广州 + log_level: INFO + timezone: Asia/Shanghai +schema: + plugins.home_assistant.base_url: url + plugins.home_assistant.api_key: str + plugins.home_assistant.devices: + - str + llm.type: list(DoubaoLLM|ChatGLMLLM|DeepSeekLLM) + model_name: str + llm.api_key: str + tts.type: list(DoubaoTTS|EdgeTTS) + tts.appid: str? + tts.access_token: str? + tts.voice: str? + asr.type: list(DoubaoASR|TencentASR|FunASR) + asr.appid: str? + asr.access_token: str? + asr.secret_key: str? + plugins.get_weather.api_key: str + plugins.get_weather.default_location: str + log_level: list(INFO|DEBUG) + timezone: str +image: r.hassbus.com/wghaos/xiaozhi-esp32-server-mini diff --git a/xiaozhi-esp32-server-mini/icon.png b/xiaozhi-esp32-server-mini/icon.png new file mode 100644 index 0000000..0d8f03c Binary files /dev/null and b/xiaozhi-esp32-server-mini/icon.png differ diff --git a/xiaozhi-esp32-server-mini/logo.png b/xiaozhi-esp32-server-mini/logo.png new file mode 100644 index 0000000..3f1b2de Binary files /dev/null and b/xiaozhi-esp32-server-mini/logo.png differ diff --git a/xiaozhi-esp32-server-mini/translations/en.yaml b/xiaozhi-esp32-server-mini/translations/en.yaml new file mode 100644 index 0000000..5a0e57c --- /dev/null +++ b/xiaozhi-esp32-server-mini/translations/en.yaml @@ -0,0 +1,59 @@ +--- +configuration: + timezone: + name: "Timezone" + description: "Set the server timezone" + log_level: + name: "Log Level" + description: "Set the verbosity of logs" + llm.type: + name: "LLM Type" + description: "Choose which Large Language Model service to use" + model_name: + name: "LLM Model Name" + description: "Specific model name for the LLM" + llm.api_key: + name: "LLM API Key" + description: "API key for the selected Large Language Model service" + tts.type: + name: "TTS Type" + description: "Choose which Text-to-Speech service to use" + tts.appid: + name: "TTS AppID" + description: "Application ID for text-to-speech service (required for DoubaoTTS only)" + tts.access_token: + name: "TTS Access Token" + description: "Access token for text-to-speech service (required for DoubaoTTS only)" + tts.voice: + name: "TTS Voice" + description: "Voice setting for text-to-speech service (optional, defaults to BV001_streaming)" + asr.type: + name: "Speech Recognition Model" + description: "Choose which speech recognition model to use, different models support different languages" + asr.appid: + name: "Speech Recognition AppID" + description: "Application ID for speech recognition service (required for online services only)" + asr.access_token: + name: "Speech Recognition Token/Secret ID" + description: "Access token or secret ID for speech recognition service (required for online services only)" + asr.secret_key: + name: "Speech Recognition Secret Key" + description: "Secret key for speech recognition service (required for Tencent ASR only)" + plugins.get_weather.api_key: + name: "Weather API Key" + description: "QWeather API key" + plugins.get_weather.default_location: + name: "Default Location" + description: "Default location for weather queries" + plugins.home_assistant.base_url: + name: "Home Assistant URL" + description: "URL of your Home Assistant instance" + plugins.home_assistant.api_key: + name: "Home Assistant Token" + description: "Long-lived access token for Home Assistant" + plugins.home_assistant.devices: + name: "Home Assistant Devices" + description: "List of Home Assistant devices to control" + +network: + 8000/tcp: "WebSocket server port for ESP32 device communication" diff --git a/xiaozhi-esp32-server-mini/translations/zh-Hans.yaml b/xiaozhi-esp32-server-mini/translations/zh-Hans.yaml new file mode 100644 index 0000000..aaa801e --- /dev/null +++ b/xiaozhi-esp32-server-mini/translations/zh-Hans.yaml @@ -0,0 +1,59 @@ +--- +configuration: + timezone: + name: "时区" + description: "设置服务器时区" + log_level: + name: "日志级别" + description: "设置日志详细程度" + llm.type: + name: "大语言模型(LLM)" + description: "选择使用哪个大语言模型(LLM), DoubaoLLM:豆包大语言模型, ChatGLMLLM:智谱 AI 大语言模型, DeepSeekLLM:DeepSeek 大语言模型" + model_name: + name: "LLM模型名称" + description: "大语言模型的具体模型名称" + llm.api_key: + name: "LLM API密钥" + description: "所选大语言模型服务的API密钥" + tts.type: + name: "文本转语音(TTS)" + description: "选择使用哪个文本转语音服务(TTS),DoubaoTTS:豆包/火山引擎 文本转语音,EdgeTTS:微软 Edge 浏览器 文本转语音" + tts.appid: + name: "语音合成AppID" + description: "语音合成服务的应用ID(仅DoubaoTTS需要)" + tts.access_token: + name: "语音合成访问令牌" + description: "语音合成服务的访问令牌(仅DoubaoTTS需要)" + tts.voice: + name: "语音合成音色" + description: "语音合成服务的音色设置(可选,默认为BV001_streaming)" + asr.type: + name: "语音识别模型(ASR)" + description: "选择使用哪种语音识别模型,不同模型支持不同语言,DoubaoASR:豆包语音识别,TencentASR:腾讯云语音识别,FunASR:Fun语音识别" + asr.appid: + name: "语音识别AppID" + description: "语音识别服务的应用ID(仅在线服务需要)" + asr.access_token: + name: "语音识别Token/Secret ID" + description: "语音识别服务的访问令牌或密钥ID(仅在线服务需要)" + asr.secret_key: + name: "语音识别Secret Key" + description: "语音识别服务的密钥(仅腾讯ASR需要)" + plugins.get_weather.api_key: + name: "天气API密钥" + description: "和风天气API密钥" + plugins.get_weather.default_location: + name: "默认位置" + description: "天气查询的默认位置" + plugins.home_assistant.base_url: + name: "Home Assistant地址" + description: "您的Home Assistant实例地址" + plugins.home_assistant.api_key: + name: "Home Assistant令牌" + description: "Home Assistant的长期访问令牌" + plugins.home_assistant.devices: + name: "Home Assistant设备" + description: "要控制的Home Assistant设备列表" + +network: + 8000/tcp: "ESP32设备通信的WebSocket服务器端口" diff --git a/xiaozhi-esp32-server/CHANGELOG.md b/xiaozhi-esp32-server/CHANGELOG.md new file mode 100644 index 0000000..8213934 --- /dev/null +++ b/xiaozhi-esp32-server/CHANGELOG.md @@ -0,0 +1,31 @@ +# 更新日志 + +## 1.0.3 + +- 添加 ASR(语音识别)配置选项到 Home Assistant 界面 +- 支持选择不同的语音识别模型(FunASR、SherpaASR、DoubaoASR、TencentASR) +- 为在线语音识别服务添加 API 凭据配置 +- 修复音乐目录递归软链接的问题 +- 优化脚本代码结构,删除冗余注释,提高可读性 +- 修复唤醒词配置保存时出现的空行累积问题 + +## 1.0.2 + +- 添加 LLM 模型名称配置选项,允许用户自定义模型名称 +- 修复翻译文件格式问题 +- 优化配置文件更新逻辑,避免文件格式损坏 +- 改进文件管理方式,使用软链接减少存储空间占用 + +## 1.0.1 + +- 修复 Home Assistant 加载项配置同步功能 +- 添加自动将加载项配置应用到.config.yaml 的功能 +- 完善配置同步机制,支持所有加载项配置参数 +- 更新文档,详细说明配置方法和故障排除 + +## 1.0.0 + +- 首次发布 +- 支持小智 ESP32 语音识别服务 +- 自动下载模型和配置 +- 使用 S6 Overlay 进行服务管理 diff --git a/xiaozhi-esp32-server/DOCS.md b/xiaozhi-esp32-server/DOCS.md new file mode 100644 index 0000000..cc5a396 --- /dev/null +++ b/xiaozhi-esp32-server/DOCS.md @@ -0,0 +1,206 @@ +# 小智 AI Server 最简化版 + +本加载项提供小智 ESP32 语音识别服务器功能,可与 ESP32 设备配合使用实现语音识别功能。 + +## 安装 + +1. 在 Home Assistant 的加载项商店中添加此仓库地址或复制到本地加载项目录 +2. 安装"小智 AI Server 最简化版"加载项 +3. 配置加载项 + +## 配置参数 + +| 参数 | 描述 | +| ------------------------------------ | --------------------------------- | +| timezone | 时区设置 | +| server.auth.enabled | 是否启用设备认证(可选) | +| server.auth.tokens | 设备认证令牌列表(可选) | +| log_level | 日志级别 (INFO/DEBUG) | +| llm.type | 大语言模型类型 | +| model_name | 大语言模型名称 | +| llm.api_key | 大语言模型 API 密钥 | +| tts.type | 语音合成服务类型 | +| tts.appid | TTS 服务应用 ID (DoubaoTTS 需要) | +| tts.access_token | TTS 服务访问令牌 (DoubaoTTS 需要) | +| tts.voice | TTS 音色 (DoubaoTTS 可选) | +| asr.type | 语音识别服务类型 | +| asr.appid | ASR 服务应用 ID(在线服务需要) | +| asr.access_token | ASR 服务访问令牌(在线服务需要) | +| asr.secret_key | ASR 服务密钥(腾讯 ASR 需要) | +| plugins.get_weather.api_key | 和风天气 API 密钥 | +| plugins.get_weather.default_location | 默认天气查询位置 | +| plugins.home_assistant.base_url | Home Assistant 地址 | +| plugins.home_assistant.api_key | Home Assistant 长期访问令牌 | +| plugins.home_assistant.devices | Home Assistant 设备列表 | + +## 使用说明 + +安装并启动后,服务器会在 8000 端口启动 WebSocket 服务。您可以通过 ESP32 设备连接到此服务进行语音识别。 + +### 配置方式说明 + +本加载项支持两种配置方式: + +1. **通过 Home Assistant 加载项页面配置**:在 Home Assistant -> 设置 -> 加载项 -> 小智 AI Server 最简化版 中配置基本参数 + + - 这些配置会自动应用到服务器的.config.yaml 文件中 + - 每次重启加载项时,Home Assistant 配置会自动覆盖相应的.config.yaml 设置 + +2. **手动编辑配置文件**: + - 配置文件位于: `/config/data/.config.yaml`(通过文件编辑器访问) + - 适合进行高级配置调整,如不在加载项页面提供的参数 + +**注意**:所有需要的 ASR 和 LLM 参数都应当在 Home Assistant 加载项配置页面中设置,这是推荐的配置方法。修改后需要重启加载项才能生效。 + +### 具体配置路径 + +1. **加载项配置页面**: + + - Home Assistant → 设置 → 加载项 → 小智 AI Server 极速版 → 配置 + - 在此页面可以设置所有主要参数,包括 ASR 类型、appid、access_token、LLM 类型、model_name 和 api_key 等 + +2. **通过文件编辑器**: + - Home Assistant → 设置 → 加载项 → 文件编辑器 + - 导航到 `/config/data/.config.yaml` (加载项配置文件) + - 此文件包含更详细的配置,但每次重启加载项后会被加载项配置页面的设置覆盖 + +### 模型文件 + +使用 FunASR 模型时,需要使用 SenseVoiceSmall 模型文件才能正常工作。系统会自动下载模型文件并放置在以下位置: + +``` +/config/models/SenseVoiceSmall/model.pt +``` + +如果自动下载失败,您需要手动下载并放置模型文件。 + +### 语音识别服务 (ASR) + +本插件支持以下语音识别服务: + +1. **FunASR**:本地语音识别模型,需要下载模型文件。无需配置 API 密钥。 +2. **DoubaoASR**:豆包 ASR 服务,需要配置 appid 和 access_token。 +3. **TencentASR**:腾讯云 ASR 服务,需要配置 appid、access_token 和 secret_key。 + +**注意**:如果您选择 DoubaoASR 或 TencentASR,但未提供完整的配置信息,系统将无法启动相应服务。请确保提供所有必要的参数。 + +### 大语言模型服务 (LLM) + +本插件支持以下大语言模型服务: + +1. **DoubaoLLM**:豆包大语言模型服务 +2. **ChatGLMLLM**:智谱 AI 大语言模型服务 +3. **DeepSeekLLM**:DeepSeek 大语言模型服务 + +每种 LLM 服务都需要配置相应的 model_name 和 api_key。 + +### 如何获取各服务的配置信息 + +#### DoubaoASR (豆包语音识别) + +- **获取地址**: [火山引擎语音服务](https://console.volcengine.com/speech/app) +- **appid**: 申请开通火山引擎语音合成服务后获取的 appid +- **access_token**: 开通后获取的访问令牌 + +#### TencentASR (腾讯云语音识别) + +- **密钥申请**: [获取密钥](https://console.cloud.tencent.com/cam/capi) +- **免费资源**: [领取免费资源](https://console.cloud.tencent.com/asr/resourcebundle) +- **appid**: 腾讯云语音识别服务应用 ID +- **secret_id**: 获取的腾讯云语音识别 SecretID +- **secret_key**: 获取的腾讯云语音识别 SecretKey + +#### DoubaoLLM (豆包大语言模型) + +- **开通地址**: [开通服务](https://console.volcengine.com/ark/region:ark+cn-beijing/openManagement?LLM=%7B%7D&OpenTokenDrawer=false) +- **获取密钥**: 开通后,进入[这里](https://console.volcengine.com/ark/region:ark+cn-beijing/apiKey?apikey=%7B%7D)获取 +- **适用模型**: 推荐模型名 `doubao-pro-32k-functioncall-241028` +- **免费额度**: 开通后提供 500000 token 的免费额度 + +#### ChatGLMLLM (智谱 AI 大语言模型) + +- **获取密钥**: [智谱 AI 平台](https://bigmodel.cn/usercenter/proj-mgmt/apikeys) +- **推荐模型**: `glm-4-flash` (免费模型,但需要注册并填写 API 密钥) +- **API 访问**: 模型通过 `https://open.bigmodel.cn/api/paas/v4/` 接口访问 + +#### DeepSeekLLM (DeepSeek 大语言模型) + +- **获取密钥**: [DeepSeek 平台](https://platform.deepseek.com/) +- **模型名称**: 如 `deepseek-chat` +- **访问地址**: https://api.deepseek.com + +### 语音合成服务 (TTS) + +本插件支持多种语音合成服务: + +#### EdgeTTS (微软 Edge 浏览器 TTS) + +- **无需 API 密钥**: 免费使用的本地 TTS 服务 +- **默认语音**: `zh-CN-XiaoxiaoNeural`,中文女声 + +#### DoubaoTTS (豆包/火山引擎 TTS) + +- **配置参数**: 需要设置`tts.appid`、`tts.access_token`和`tts.voice`(可选) +- **获取地址**: [火山引擎语音合成](https://console.volcengine.com/speech/service/8) +- **购买建议**: 建议购买付费服务,起步价 30 元可获得 100 并发,免费版本只有 2 个并发 +- **特色音色**: 湾湾小何音色可在[此处开通](https://console.volcengine.com/speech/service/10007) +- **音色设置**: 默认使用`BV001_streaming`,湾湾小何音色设置为`zh_female_wanwanxiaohe_moon_bigtts` +- **开通说明**: 购买服务后,可能需要等待约半小时才能使用 +- **验证要求**: 系统会在启动时验证 appid 和 access_token,如果缺少将无法启动 + +### FunASR 才会使用下面模型文件 + +您可以通过以下方式下载模型文件(正常情况下会自动下载): + +1. 线路一:[阿里魔塔下载 SenseVoiceSmall](https://www.modelscope.cn/models/iic/SenseVoiceSmall/summary) +2. 线路二:[百度网盘下载 SenseVoiceSmall](https://pan.baidu.com/s/1HW_UmfLiXhWwMjzS0GIpWg?pwd=qvna) 提取码:`qvna` + +下载后,请将模型文件放置在上述路径中,或通过文件编辑器上传到 addon 配置目录的 models/SenseVoiceSmall 文件夹中。 + +### 配置文件 + +配置文件位于加载项配置目录: + +``` +/config/data/.config.yaml +``` + +如果未找到配置文件,系统会自动创建默认配置文件。首次运行时,会提示您修改配置文件中的 API 密钥等重要信息。 + +### 初次运行 + +首次启动插件时,会出现以下流程: + +1. 检查模型文件,不存在则自动下载 +2. 检查配置文件,不存在则自动创建 +3. 提示您修改配置文件中的 API 密钥和其他设置 +4. 配置好后需重启插件应用更改 + +这些提示只会在首次运行时显示,后续启动不会重复提示。 + +## 技术实现 + +本插件基于以下技术实现: + +1. 使用 Home Assistant 标准加载项结构 +2. 采用 S6-Overlay 进行服务管理,提高稳定性和可靠性 +3. 使用 addon_config 目录存储配置和模型文件,符合 Home Assistant 最佳实践 +4. 自动同步 Home Assistant 加载项配置到服务器配置 + +## 连接 ESP32 设备 + +1. 确保 ESP32 设备与 Home Assistant 在同一网络 +2. WebSocket 服务地址:`ws://<您的Home Assistant IP>:8000/xiaozhi/v1/` +3. 将 ESP32 设备配置为连接上述 WebSocket 地址 + +## 故障排除 + +如果遇到以下问题,请参考处理方法: + +1. **语音识别出现韩文、日文、英文**:检查模型文件是否正确加载 +2. **TTS 任务出错或超时**:检查网络连接和配置文件设置 +3. **连接问题**:确保 ESP32 设备与 Home Assistant 在同一网络 +4. **无法自动下载模型**:网络问题或服务器故障,请尝试手动下载 +5. **配置问题**:如果在加载项页面修改的配置未生效,请重启加载项并检查日志 +6. **ASR 配置不完整错误**:确保您选择的 ASR 服务(如 DoubaoASR 或 TencentASR)已配置所有必要的参数 +7. **TTS 配置不完整错误**:当选择 DoubaoTTS 时,确保已配置 appid 和 access_token diff --git a/xiaozhi-esp32-server/README.md b/xiaozhi-esp32-server/README.md new file mode 100644 index 0000000..e0894b7 --- /dev/null +++ b/xiaozhi-esp32-server/README.md @@ -0,0 +1,24 @@ +# 冬瓜甄选addons:小智 AI Server 最简化版 + +适用于 Home Assistant 的小智 AI Server 最简化版加载项。 + +## 功能特点 + +- 基于 WebSocket 的语音识别服务 +- 支持多种语音识别服务(FunASR 本地模型、豆包 ASR 在线服务、腾讯 ASR 在线服务) +- 支持大语言模型对话功能 +- 自动下载模型和配置 +- 支持常见架构:aarch64 和 amd64 +- 使用 S6-Overlay 管理服务 + +## 使用方法 + +1. 安装加载项 +2. 配置语音识别服务 (ASR) 和大语言模型 (LLM) 参数 +3. 点击启动,并查看日志,等待小智客户端接入 + +详细使用说明请参阅 DOCS.md 文档。 + +## 支持与反馈 + +本项目基于[xinnan-tech/xiaozhi-esp32-server](https://github.com/xinnan-tech/xiaozhi-esp32-server) 开发。 diff --git a/xiaozhi-esp32-server/config.yaml b/xiaozhi-esp32-server/config.yaml new file mode 100644 index 0000000..d129707 --- /dev/null +++ b/xiaozhi-esp32-server/config.yaml @@ -0,0 +1,21 @@ +name: "小智 AI Server 最简化版" +version: "0.3.4" +slug: "xiaozhi_esp32_server" +description: "小智 AI Server 最简化版 - 提供语音识别、对话和控制功能,支持与ESP32设备通信" +url: "https://github.com/xinnan-tech/xiaozhi-esp32-server" +arch: + - aarch64 + - amd64 +startup: application +boot: manual +ports: + 8000/tcp: 8000 +ports_description: + 8000/tcp: "WebSocket服务端口" +map: + - addon_config:rw +host_network: false +init: false +watchdog: "tcp://[HOST]:[PORT:8000]" +journald: true +image: r.hassbus.com/wghaos/xiaozhi-esp32-server diff --git a/xiaozhi-esp32-server/icon.png b/xiaozhi-esp32-server/icon.png new file mode 100644 index 0000000..3a9798f Binary files /dev/null and b/xiaozhi-esp32-server/icon.png differ diff --git a/xiaozhi-esp32-server/logo.png b/xiaozhi-esp32-server/logo.png new file mode 100644 index 0000000..a233d94 Binary files /dev/null and b/xiaozhi-esp32-server/logo.png differ diff --git a/xiaozhi-esp32-webui/DOCS.md b/xiaozhi-esp32-webui/DOCS.md new file mode 100644 index 0000000..e5bb249 --- /dev/null +++ b/xiaozhi-esp32-webui/DOCS.md @@ -0,0 +1,27 @@ +# 小智 AI OTA 管理 + +本加载项提供小智 ESP32 语音识别服务器功能,可与 ESP32 设备配合使用实现语音识别功能。 + +## 安装 + 1. 在 Home Assistant 的加载项商店中添加此仓库地址或复制到本地加载项目录 + 1. 安装 "Redis Server" 并配置 + 1. 安装 "Mysql"或"MariaDB" 并配置 + 1. 安装 "小智 AI OTA 管理" 加载项 + +## 配置 + +```yaml +mysql_host: core-mariadb #MySQL/MariaDB数据库主机地址,查看方式:Home Assistant → 设置 → 加载项 → MySQL/MariaDB → 信息 → 宿主名 +mysql_port: 3306 #MySQL/MariaDB数据库端口(默认: 3306) +mysql_database: xiaozhi_esp32_server #要使用的数据库名称 +mysql_username: homeassistant #数据库认证用户名 +mysql_password: root #数据库认证密码 +redis_host: 0920e2ff-redis-server #Redis服务器主机地址,查看方式:Home Assistant → 设置 → 加载项 → Redis Server → 信息 → 宿主名 +redis_port: 6379 #Redis服务器端口(默认: 6379) +timezone: Asia/Shanghai #设置服务器时区 +``` + +## 使用说明 + +1. 启动后,点击“打开网页界面”,浏览器访问 http://homeassistant.local:8002 进入 Web 管理界面 +2. 首次访问需要注册用户 \ No newline at end of file diff --git a/xiaozhi-esp32-webui/README.md b/xiaozhi-esp32-webui/README.md new file mode 100644 index 0000000..3cf55b0 --- /dev/null +++ b/xiaozhi-esp32-webui/README.md @@ -0,0 +1,15 @@ +# 冬瓜甄选addons:小智 AI OTA 管理 + +适用于 Home Assistant 的 小智 AI OTA 管理加载项。 + +## 使用方法 + +1. 安装加载项 +2. 配置 Mysql 和 Redis 参数 +3. 点击启动,访问 http://homeassistant.local:8002 进入 Web 管理界面 + +详细使用说明请参阅 DOCS.md 文档。 + +## 支持与反馈 + +本项目基于[xinnan-tech/xiaozhi-esp32-server](https://github.com/xinnan-tech/xiaozhi-esp32-server) 开发。 diff --git a/xiaozhi-esp32-webui/config.yaml b/xiaozhi-esp32-webui/config.yaml new file mode 100644 index 0000000..e3068a1 --- /dev/null +++ b/xiaozhi-esp32-webui/config.yaml @@ -0,0 +1,39 @@ +name: "小智 AI OTA 管理" +version: "0.3.4" +slug: "xiaozhi_esp32_webui" +description: "小智 AI Server 全模块版 - 提供语音识别、对话和控制功能,支持与ESP32设备通信,集成WEB管理界面" +url: "https://github.com/xinnan-tech/xiaozhi-esp32-server" +arch: + - aarch64 + - amd64 +startup: application +boot: manual +translations: true +ports: + 8002/tcp: 8002 +ports_description: + 8002/tcp: "WEB服务端口" +host_network: false +init: false +webui: "http://[HOST]:[PORT:8002]/" +watchdog: "http://[HOST]:[PORT:8002]/" +journald: true +options: + mysql_host: core-mariadb + mysql_port: 3306 + mysql_database: xiaozhi_esp32_server + mysql_username: homeassistant + mysql_password: + redis_host: + redis_port: 6379 + timezone: Asia/Shanghai +schema: + mysql_host: str + mysql_port: port + mysql_database: str + mysql_username: str + mysql_password: str + redis_host: str + redis_port: port + timezone: str +image: "r.hassbus.com/wghaos/xiaozhi-esp32-webui" diff --git a/xiaozhi-esp32-webui/icon.png b/xiaozhi-esp32-webui/icon.png new file mode 100644 index 0000000..01869ac Binary files /dev/null and b/xiaozhi-esp32-webui/icon.png differ diff --git a/xiaozhi-esp32-webui/logo.png b/xiaozhi-esp32-webui/logo.png new file mode 100644 index 0000000..550b470 Binary files /dev/null and b/xiaozhi-esp32-webui/logo.png differ diff --git a/xiaozhi-esp32-webui/translations/en.yaml b/xiaozhi-esp32-webui/translations/en.yaml new file mode 100644 index 0000000..82502c5 --- /dev/null +++ b/xiaozhi-esp32-webui/translations/en.yaml @@ -0,0 +1,29 @@ +--- +configuration: + mysql_host: + name: "MySQL Host" + description: "MySQL/MariaDB database host address" + mysql_port: + name: "MySQL Port" + description: "MySQL/MariaDB database port (default: 3306)" + mysql_database: + name: "MySQL Database" + description: "Name of the database to use" + mysql_username: + name: "MySQL Username" + description: "Username for database authentication" + mysql_password: + name: "MySQL Password" + description: "Password for database authentication" + redis_host: + name: "Redis Host" + description: "Redis server host address" + redis_port: + name: "Redis Port" + description: "Redis server port (default: 6379)" + timezone: + name: "Timezone" + description: "Set the server timezone" + +network: + 8002/tcp: "Web management interface port" diff --git a/xiaozhi-esp32-webui/translations/zh-Hans.yaml b/xiaozhi-esp32-webui/translations/zh-Hans.yaml new file mode 100644 index 0000000..86aa1ef --- /dev/null +++ b/xiaozhi-esp32-webui/translations/zh-Hans.yaml @@ -0,0 +1,29 @@ +--- +configuration: + mysql_host: + name: "MySQL主机" + description: "MySQL/MariaDB数据库主机地址" + mysql_port: + name: "MySQL端口" + description: "MySQL/MariaDB数据库端口(默认: 3306)" + mysql_database: + name: "MySQL数据库名" + description: "要使用的数据库名称" + mysql_username: + name: "MySQL用户名" + description: "数据库认证用户名" + mysql_password: + name: "MySQL密码" + description: "数据库认证密码" + redis_host: + name: "Redis主机" + description: "Redis服务器主机地址" + redis_port: + name: "Redis端口" + description: "Redis服务器端口(默认: 6379)" + timezone: + name: "时区" + description: "设置服务器时区" + +network: + 8002/tcp: "Web管理界面端口"