← 返回
效率工具 Key 中文

Ha Xiaomi Control

Control Xiaomi smart home devices via Home Assistant API. Use when user wants to control Xiaomi or Xiao AI devices such as air conditioner, speakers, and lig...
通过Home Assistant API控制小米智能家居设备。适用于用户想要控制小米或小爱设备(如空调、音箱和灯具等)的场景。
pipluuup
效率工具 clawhub v0.1.0 1 版本 100000 Key: 需要
★ 1
Stars
📥 618
下载
💾 26
安装
1
版本
#latest

概述

Home Assistant + Xiaomi Device Control

Control Xiaomi smart home devices through Home Assistant API.

Configuration

Load configuration from TOOLS.md智能家居 section, or use these defaults:

  • HA URL: http://192.168.31.35:8123
  • Access Token: Read from user's environment or TOOLS.md
  • Xiao AI Speaker: media_player.xiaomi_lx06_3ff3_play_control
  • Xiao AI Command Entity: text.xiaomi_lx06_3ff3_execute_text_directive
  • Air Conditioner: button.miir_ir02_8112_turn_off / button.miir_ir02_8112_turn_on

Control Rules

Xiao AI Speaker Control

When user message contains "小爱同学" or "小爱":

  1. Extract the command after the trigger word
  2. Call HA API to execute text directive

Example:

User: "小爱同学 播放音乐 天后"
→ Execute: text.xiaomi_lx06_3ff3_execute_text_directive with value "播放音乐天后"

API Call:

curl -X POST \
  -H "Authorization: Bearer ${TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{"entity_id": "text.xiaomi_lx06_3ff3_execute_text_directive", "value": "${COMMAND}"}' \
  ${HA_URL}/api/services/text/set_value

Air Conditioner Control

When user message contains "空调":

CommandEntityService
--------------------------
关闭空调button.miir_ir02_8112_turn_offbutton/press
打开空调button.miir_ir02_8112_turn_onbutton/press
空调 26 度number.miir_ir02_8112_temperature_for_irnumber/set_value
空调制冷select.miir_ir02_8112_mode_for_irselect/select_option (option: "Cool")
空调制热select.miir_ir02_8112_mode_for_irselect/select_option (option: "Heat")

Example - Turn Off:

curl -X POST \
  -H "Authorization: Bearer ${TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{"entity_id": "button.miir_ir02_8112_turn_off"}' \
  ${HA_URL}/api/services/button/press

Example - Set Temperature:

curl -X POST \
  -H "Authorization: Bearer ${TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{"entity_id": "number.miir_ir02_8112_temperature_for_ir", "value": 26}' \
  ${HA_URL}/api/services/number/set_value

Available Entities

See references/entities.md for complete entity list.

Error Handling

  1. Connection Failed: Check if HA is running and accessible
  2. 401 Unauthorized: Token expired, ask user to regenerate
  3. Entity Not Found: Verify entity ID in TOOLS.md
  4. Device Offline: Check device status in Mi Home app

Security Notes

  • ⚠️ Access Token is sensitive - never log or expose it
  • ✅ Store token in environment variable or secure config
  • ✅ Use HTTPS for remote HA access

版本历史

共 1 个版本

  • v0.1.0 当前
    2026-03-31 04:42 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

productivity

Weather

steipete
获取当前天气和预报(无需API密钥)
★ 446 📥 226,409
productivity

Word / DOCX

ivangdavila
创建、检查和编辑 Microsoft Word 文档及 DOCX 文件,支持样式、编号、修订记录、表格、分节符及兼容性检查等功能。
★ 440 📥 147,969
productivity

Obsidian

steipete
操作 Obsidian 仓库(纯 Markdown 笔记)并通过 obsidian-cli 自动化。
★ 432 📥 103,829