table-mountain-status

TotalClaw 作者 totalclaw

通过官方天气 API 获取并报告桌山空中索道状态。当 Master 要求“Tafelberg”更新、需要有关开放/关闭的警报或需要有关状态、天气和等待时间的自动 Telegram 报告时使用。

安装 / 下载方式

TotalClaw CLI推荐
totalclaw install totalclaw:totalclaw~zopyx-table-mountain-status
cURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/totalclaw%3Atotalclaw~zopyx-table-mountain-status/file -o zopyx-table-mountain-status.md
# Table Mountain Status

## Überblick
Dieses Skill ruft die offizielle Cableway-API (`https://cms.tablemountain.net/.../weather-api`) ab, parsed Status/Weather-Felder und liefert eine saubere Zusammenfassung (Text oder JSON). Ideal für Sofortabfragen („Status Tafelberg?“) sowie automatisierte Polling-Jobs mit Telegram-Alerts.

## Quick Start
1. **Manuell abrufen**
   ```bash
   python3 skills/table-mountain-status/scripts/fetch_status.py \
     --output data/table-mountain/$(date +%F_%H%M).txt
   ```
   Ausgabe erscheint sowohl in der Datei als auch im Terminal.

2. **JSON für Weiterverarbeitung**
   ```bash
   python3 skills/table-mountain-status/scripts/fetch_status.py \
     --format json --output data/table-mountain/$(date +%F).json
   ```

3. **Felder** (bereits im Script enthalten): `statusType`, `status`, `temperature`, `visibility`, `wind`, `firstUp`, `lastUp`, `lastDown`, `waitingTimeBottom`, `waitingTimeTop`, `lastUpdated`.

## Automatisierte Telegram-Alerts
1. **Cronjob alle 10 Minuten (Beispiel):**
   ```bash
   openclaw cron add <<'JSON'
   {
     "name": "table-mountain-10min",
     "schedule": { "kind": "every", "everyMs": 600000 },
     "sessionTarget": "isolated",
     "payload": {
       "kind": "agentTurn",
       "model": "default",
       "message": "Run `python3 skills/table-mountain-status/scripts/fetch_status.py --output data/table-mountain/latest.txt`. Post the summary to Master on Telegram, highlight status (open/closed), weather, queues, and timestamp. If the fetch fails, report the error."
     }
   }
   JSON
   ```
2. **Temporäre Jobs** (z. B. nur bis 16:00 lokal) → `schedule.kind = "cron"`, `expr = "*/10 6-15 * * *"`, `tz = "Europe/Berlin"`, und nach Ende wieder `cron update --enabled=false` oder `cron remove`.
3. **Job-Stop**: Immer sowohl Interval- als auch Tagesjob deaktivieren, falls mehrere Instanzen laufen.

## Troubleshooting
- **API down / Consent-Block:** Script liefert Exit-Code 1 + Fehlermeldung → Cron meldet den Fehler weiter.
- **Zeitzonen:** `lastUpdated` wird auf UTC+2 konvertiert (Cape Town). Bei Bedarf `format_summary` im Script anpassen.
- **Standard-Wartezeiten (0:05:00)** stammen oft vom API-Default; wenn echte Queue benötigt wird, Hinweis im Bericht ergänzen.
- **Netzwerk-Limits:** Falls `curl`-Proxy nötig, `urllib` ggf. um Environment-Proxy erweitern.

## Ressourcen
- `scripts/fetch_status.py` – Einfache CLI zum Abrufen, Formatieren und Speichern (Text/JSON) des Table-Mountain-Status.

---

## 中文说明

# 桌山状态

## 概述
本技能调用官方索道 API(`https://cms.tablemountain.net/.../weather-api`),解析状态/天气字段,并提供清晰的摘要(文本或 JSON)。既适合即时查询("桌山状态?"),也适合带 Telegram 警报的自动轮询任务。

## 快速开始
1. **手动获取**
   ```bash
   python3 skills/table-mountain-status/scripts/fetch_status.py \
     --output data/table-mountain/$(date +%F_%H%M).txt
   ```
   输出会同时显示在文件和终端中。

2. **用于后续处理的 JSON**
   ```bash
   python3 skills/table-mountain-status/scripts/fetch_status.py \
     --format json --output data/table-mountain/$(date +%F).json
   ```

3. **字段**(脚本中已包含):`statusType`、`status`、`temperature`、`visibility`、`wind`、`firstUp`、`lastUp`、`lastDown`、`waitingTimeBottom`、`waitingTimeTop`、`lastUpdated`。

## 自动化 Telegram 警报
1. **每 10 分钟一次的 Cronjob(示例):**
   ```bash
   openclaw cron add <<'JSON'
   {
     "name": "table-mountain-10min",
     "schedule": { "kind": "every", "everyMs": 600000 },
     "sessionTarget": "isolated",
     "payload": {
       "kind": "agentTurn",
       "model": "default",
       "message": "Run `python3 skills/table-mountain-status/scripts/fetch_status.py --output data/table-mountain/latest.txt`. Post the summary to Master on Telegram, highlight status (open/closed), weather, queues, and timestamp. If the fetch fails, report the error."
     }
   }
   JSON
   ```
2. **临时任务**(例如仅运行到本地时间 16:00)→ `schedule.kind = "cron"`、`expr = "*/10 6-15 * * *"`、`tz = "Europe/Berlin"`,结束后再次执行 `cron update --enabled=false` 或 `cron remove`。
3. **停止任务**:若运行了多个实例,务必同时禁用周期任务和每日任务。

## 故障排查
- **API 宕机 / 同意拦截:** 脚本返回退出码 1 + 错误信息 → Cron 会转发该错误。
- **时区:** `lastUpdated` 会被转换为 UTC+2(开普敦)。如有需要,可调整脚本中的 `format_summary`。
- **默认等待时间(0:05:00)** 通常来自 API 默认值;若需要真实排队时间,请在报告中补充说明。
- **网络限制:** 若 `curl` 需要代理,可在 `urllib` 中扩展环境代理。

## 资源
- `scripts/fetch_status.py` – 用于获取、格式化并保存(文本/JSON)桌山状态的简易 CLI。