# 能耗日报定时任务配置

## 方案一：使用 OpenClaw Cron（推荐）

```bash
# 添加定时任务：每天早上 8 点自动生成
openclaw cron add --schedule "0 8 * * *" \
  --command "python3 /home/admin/.openclaw/workspace-agent-200/scripts/generate_energy_report.py" \
  --name "能耗日报自动生成"
```

## 方案二：系统 Crontab

```bash
# 编辑 crontab
crontab -e

# 添加以下行（每天 8:00 执行）
0 8 * * * /usr/bin/python3 /home/admin/.openclaw/workspace-agent-200/scripts/generate_energy_report.py >> /home/admin/.openclaw/logs/energy_report.log 2>&1
```

## 方案三：OpenClaw Gateway Cron

使用 `cron` 工具添加 isolated session 任务：

```json
{
  "name": "能耗日报自动生成",
  "schedule": {
    "kind": "cron",
    "expr": "0 8 * * *",
    "tz": "Asia/Shanghai"
  },
  "payload": {
    "kind": "agentTurn",
    "message": "生成昨日能耗日报并发送到工作区"
  },
  "sessionTarget": "isolated",
  "enabled": true
}
```

---

## 执行测试

```bash
# 手动运行测试
python3 /home/admin/.openclaw/workspace-agent-200/scripts/generate_energy_report.py

# 查看生成的报表
ls -la /home/admin/.openclaw/workspace-agent-200/reports/
```
