Weather Location
This skill automates weather data retrieval using Open-Meteo and live webcam image capture using agent-browser.
Workflow
- 1. Get Coordinates (Geocoding):
- Execute
curl -s "https://geocoding-api.open-meteo.com/v1/search?name=[Location]&count=1&language=es&format=json" to resolve city name to coordinates.
- 2. Get weather (Open-Meteo):
- Execute
curl -s "https://api.open-meteo.com/v1/forecast?latitude=[Lat]&longitude=[Lon]¤t=temperature_2m,relative_humidity_2m,apparent_temperature,weather_code,wind_speed_10m" to get real-time data.
- 3. Search for Webcam:
- Web search for
site:meteoblue.com [Location] webcam or
site:windy.com [Location] webcam.
- Select the direct link to the location's webcam page.
- 4. Capture Image (Agent Browser Method):
- Use
agent-browser to navigate and interact:
/home/user/.npm-global/bin/agent-browser --session-name webcam open "[URL]"
-
Interaction:
- Click "OK/Accept" on cookie banners using
snapshot +
click @ref.
-
Extraction:
- Use
eval to find the highest resolution URL (look for
/full/ and
original.jpg):
Array.from(document.querySelectorAll('img')).map(img => img.src).filter(src => src.includes('original.jpg') && src.includes('/full/'))[0]
-
Download:
- Download with
curl to
/home/user/.openclaw/workspace/webcam.jpg.
- 5. User Response:
- Send with
message(action=send, media="/home/user/.openclaw/workspace/webcam.jpg", caption="[City]: [Icon] [Temp]°C [Humidity]% [Wind]km/h\n[Comment]").
- Respond with
NO_REPLY.
Optimization (Token Saving)
- 1. Open-Meteo API: Faster, keyless, and more reliable than wttr.in.
- Agent Browser: Priority method for Alex to ensure interaction (cookies) and high-quality images.
- Session Persistence: Use
--session-name webcam to keep cookies.
天气与网络摄像头
该技能使用Open-Meteo自动获取天气数据,并通过agent-browser捕获实时网络摄像头图像。
工作流程
- 1. 获取坐标(地理编码):
- 执行 curl -s https://geocoding-api.open-meteo.com/v1/search?name=[位置]&count=1&language=es&format=json 将城市名称解析为坐标。
- 2. 获取天气(Open-Meteo):
- 执行 curl -s https://api.open-meteo.com/v1/forecast?latitude=[纬度]&longitude=[经度]¤t=temperature
2m,relativehumidity
2m,apparenttemperature,weather
code,windspeed_10m 获取实时数据。
- 3. 搜索网络摄像头:
- 网络搜索 site:meteoblue.com [位置] webcam 或 site:windy.com [位置] webcam。
- 选择指向该位置网络摄像头页面的直接链接。
- 4. 捕获图像(Agent Browser方法):
- 使用
agent-browser 进行导航和交互:
bash
/home/user/.npm-global/bin/agent-browser --session-name webcam open [URL]
- 交互操作:
- 使用 snapshot + click @ref 点击Cookie横幅上的确定/接受。
- 提取操作:
- 使用 eval 查找最高分辨率URL(查找 /full/ 和 original.jpg):
javascript
Array.from(document.querySelectorAll(img)).map(img => img.src).filter(src => src.includes(original.jpg) && src.includes(/full/))[0]
- 下载操作:
- 使用 curl 下载到 /home/user/.openclaw/workspace/webcam.jpg。
- 5. 用户响应:
- 使用 message(action=send, media=/home/user/.openclaw/workspace/webcam.jpg, caption=[城市]: [图标] [温度]°C [湿度]% [风速]km/h\n[评论]) 发送。
- 回复 NO_REPLY。
优化(节省Token)
- 1. Open-Meteo API:比wttr.in更快、无需密钥且更可靠。
- Agent Browser:Alex的优先方法,确保交互(Cookie)和高质量图像。
- 会话持久化:使用 --session-name webcam 保持Cookie。