SuperAPI AI Directory

xiaomi-speaker

General & other

View repository

Updated 10-15 21:54

About this skill

Xiaoai Speaker Controller 🎵

Elegantly control your Xiaomi smart speaker

Features

  • 🎯 Smart device name matching - Just say "Xiaoai", the speaker will be automatically recognized
  • 🔊 Complete media control - Play/pause/track switching/volume adjustment
  • 🗣️ TTS voice announcements - Make the speaker talk, suitable for reminders and notifications
  • ⏰ Scheduled task support - Automatic reminders, no manual supervision required
  • 💾 Local cache - Device information persisted, faster response

Device requirements

  • Xiaomi/Mijia smart speaker (such as Xiaoai Speaker Pro)
  • The device must be bound to a Xiaomi account and connected to the internet

Quick start

1. Install dependencies

pip3 install mijiaAPI

2. First login

python3 -m mijiaAPI --list_homes

Scan the displayed QR code and log in with the Mijia APP.

3. View devices

python3 scripts/xiaomi-speaker.py list

Example output:

🎵 找到 1 个音箱设备:

  1. 小爱音箱Pro (xiaomi.wifispeaker.lx06)
     DID: 936030139...

Command reference

Basic control

# 播放/暂停
python3 scripts/xiaomi-speaker.py play 小爱
python3 scripts/xiaomi-speaker.py pause 小爱

# 切歌
python3 scripts/xiaomi-speaker.py next 小爱
python3 scripts/xiaomi-speaker.py prev 小爱

# 音量调节 (0-100)
python3 scripts/xiaomi-speaker.py volume 小爱 50

# 查看状态
python3 scripts/xiaomi-speaker.py status 小爱

TTS voice announcements

python3 scripts/xiaomi-speaker.py say 小爱 "该起床啦"
python3 scripts/xiaomi-speaker.py say 小爱 "晚上八点开家庭会议"

Refresh device list

After adding a device or changing a device name:

python3 scripts/xiaomi-speaker.py refresh

Scheduled reminders (Cron tasks)

Add scheduled reminder

# 一次性提醒
openclaw cron add --at "2026-02-21T11:30:00+08:00" \
  --message "让小爱音箱播报:中午啦,全家人一起去吃涮羊肉吧!"

# 每日重复提醒
openclaw cron add --cron "30 21 * * *" \
  --message "让小爱音箱播报:九点半啦,哥哥和弟弟都要去刷牙睡觉啦!"

Common time formats

Requirement Cron expression
Every day at 8:30 AM 30 8 * * *
Every day at 2:30 PM 30 14 * * *
Every day at 9:30 PM 30 21 * * *
Weekdays at 7:00 AM 0 7 * * 1-5

Natural language usage

Describe your needs directly in OpenClaw:

  • "Set the living room speaker volume to 50"
  • "Xiaoai, play music"
  • "Ask Xiaoai to announce the Beijing weather"
  • "Set a reminder for tomorrow morning at 8 o'clock for my brother's composition class"

Troubleshooting

Login expired

rm ~/.config/mijia-api/auth.json
python3 -m mijiaAPI --list_homes  # 重新登录

Device not found

  1. Confirm the device is online in the Mijia APP
  2. Run python3 scripts/xiaomi-speaker.py refresh to refresh the list
  3. Check whether the device name contains keywords such as "speaker" or "Xiaoai"

TTS announcement failed

Some speaker models may not support the play-text action. You can check with the following command:

python3 -m mijiaAPI --get_device_info xiaomi.wifispeaker.lx06

Check whether the actions list contains play-text。


Technical notes

  • Based on mijiaAPI to call the Xiaomi cloud API
  • Device information is cached in ~/.config/xiaomi-speaker/devices.json
  • Login status is saved in ~/.config/mijia-api/auth.json
  • The TTS function is implemented through the play-text action (siid=5, aiid=1)

Changelog

v1.0 (2026-02-21)

  • ✅ Device discovery and smart name matching
  • ✅ Play/pause/track switching/volume control
  • ✅ TTS voice announcements
  • ✅ Local device cache
  • ✅ Scheduled reminder integration

Roadmap

  • Support more speaker models
  • Music playlist control
  • Smart home scene linkage
  • Voice wake word settings

What is elegant is not the technology, but the experience. 🦐