360 Secure SkillHub
360 安全技能中心

Morning Wake-Up

通过 TypeScript 脚本调用 Open-Meteo 获取指定地点当前天气,将 WMO 天气代码映射为晴朗、多云、下雨、下雪、暴风雨五类,再在 Sonos 音箱上播放对应收藏项并设置音量;可手动运行,也可由宿主定时任务每日触发。

terrycarter1985
terrycarter1985
热度 25.56
最近更新 2026-05-12 07:56:54
分类:自动化依赖:代码执行 / 读写文件 / 第三方 API应用场景:自动化脚本 / 工作流 / 日程安排

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add morning-wake-up
Metadata
name
morning-wake-up
description
Morning wake-up automation that fetches today's weather and matches it to a Sonos playback preset. Use when the user asks for a morning routine, wake-up automation, weather-based music selection, or daily alarm with Sonos. Triggers on phrases like "morning wake-up", "wake me up", "morning routine", "weather-based music", "daily alarm with music".

Morning Wake-Up

Automate a morning wake-up flow: fetch weather → match preset → play on Sonos.

Prerequisites

  • Weather skill (Open-Meteo, no API key)
  • Sonos CLI (sonos) installed and speakers on local network
  • At least one Sonos favorite configured per weather category

Weather-to-Preset Mapping

Weather Category WMO Codes Default Sonos Favorite
sunny 0, 1 Morning Sunshine
cloudy 2, 3, 45, 48 Cloudy Morning
rain 51–67, 80–82 Rainy Day
snow 71–77, 85–86 Winter Morning
storm 95–99 Storm Chaser

Override defaults by editing scripts/presets.json.

Manual Run

# From the skill directory
bun scripts/wake-up.ts --location "Shanghai" --speaker "Living Room"

Parameters:

  • --location (required): City name or "lat,lon"
  • --speaker (required): Sonos speaker name
  • --volume (optional, default 15): Start volume (0–100)
  • --units (optional, default "celsius"): "celsius" or "fahrenheit"

Scheduled Automation (cron)

Set up a daily cron job via OpenClaw:

cron add — schedule: "0 7 * * *" — payload: "Run morning-wake-up for location Shanghai on speaker Living Room"

The agent reads this skill, then executes the wake-up script.

How It Works

  1. Fetch weather — calls Open-Meteo API for current conditions at the given location
  2. Map weather code — translates WMO code to a category using presets.json
  3. Play on Sonos — opens the matching Sonos favorite and sets volume

Troubleshooting

  • sonos discover fails → see sonoscli skill troubleshooting (Local Network permission, sandbox mode)
  • No matching favorite → falls back to the first available Sonos favorite
  • Weather API unreachable → uses last known category if cached, otherwise defaults to cloudy