ClawSkills logoClawSkills

Wled

通过 HTTP API 控制 WLED LED 控制器。当用户要求控制 WLED 灯光、灯带或基于 ESP 的 LED 控制器时使用。支持开关电源、亮

介绍

# WLED Control

通过 HTTP JSON API 控制 WLED LED 灯带和矩阵。

## 要求

- 位于同一网络中的 WLED 设备 - 设备 IP 地址或主机名 - Python 3(无外部依赖)

## 用法

所有命令都需要使用 WLED 设备的 IP/主机名指定 `--host`(或 `-H`)。

### 电源控制

```bash python3 scripts/wled.py -H <ip> power # Get power state python3 scripts/wled.py -H <ip> power on # Turn on python3 scripts/wled.py -H <ip> power off # Turn off ```

### 亮度

```bash python3 scripts/wled.py -H <ip> brightness # Get current brightness python3 scripts/wled.py -H <ip> brightness 255 # Max brightness python3 scripts/wled.py -H <ip> brightness 128 # 50% brightness ```

### 颜色

```bash python3 scripts/wled.py -H <ip> color 255 0 0 # Red python3 scripts/wled.py -H <ip> color 0 255 0 # Green python3 scripts/wled.py -H <ip> color 0 0 255 # Blue python3 scripts/wled.py -H <ip> color 255 255 255 # White ```

### 效果

```bash python3 scripts/wled.py -H <ip> effects # List all effects with IDs python3 scripts/wled.py -H <ip> effect 0 # Solid color python3 scripts/wled.py -H <ip> effect 9 # Rainbow python3 scripts/wled.py -H <ip> effect 9 -s 200 # Rainbow, fast speed python3 scripts/wled.py -H <ip> effect 9 -i 128 # Rainbow, medium intensity ```

### 调色板

```bash python3 scripts/wled.py -H <ip> palettes # List all palettes with IDs python3 scripts/wled.py -H <ip> palette 6 # Set Party palette ```

### 预设

```bash python3 scripts/wled.py -H <ip> presets # List saved presets python3 scripts/wled.py -H <ip> preset 1 # Load preset #1 ```

### 状态

```bash python3 scripts/wled.py -H <ip> status # Full device status ```

## 参考

完整 API 文档请参阅 [references/api.md](references/api.md)。

## 配置

通过在 `~/.wled/config.json` 创建配置文件,避免每次都传递 `--host`:

```json { "bedroom": "192.168.1.100", "kitchen": "192.168.1.101", "living_room": "wled-abc123.local" } ```

然后使用别名: ```bash python3 scripts/wled.py -H bedroom brightness 255 python3 scripts/wled.py -H kitchen color 255 0 0 ```

或者设置 `WLED_HOST` 环境变量: ```bash export WLED_HOST=192.168.1.100 python3 scripts/wled.py brightness 255 ```

## 查找您的 WLED 设备

通常可以通过以下方式找到 WLED 设备: - 路由器管理面板(查找 ESP 设备) - mDNS/Bonjour:`wled-<mac>.local` - WLED 应用发现

## 静态 IP 建议

IP 地址会随时间变化。为了避免更新配置,**请在您的 WLED 设备上设置静态 IP**:

**选项 1:基于路由器(最简单)** 1. 打开路由器管理面板 2. 通过 MAC 地址找到 WLED 设备 3. 保留/分配静态 IP

**选项 2:设备上** 1. 访问 `http://<current-ip>` 进入 WLED Web UI 2. 转到 Settings → WiFi Settings 3. 手动设置静态 IP 4. 保存并重启

使用 mDNS 主机名(例如 `wled-abc123.local`)也可以避免 IP 跟踪问题——路由器会自动解析这些地址。

更多产品