跳转到主内容

开放天气地图

非官方测试版翻译

本页面由 PageTurner AI 翻译(测试版)。未经项目官方认可。 发现错误? 报告问题 →

功能

通过 开放天气地图 显示指定位置的实时天气。

注意

必须开放天气地图 网站申请 API 密钥。 免费套餐中的 实时天气与预报集 已足够使用。

示例配置

{
"type": "owm",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#ffffff",
"background": "#FF0000",
"template": "{{.Weather}} ({{.Temperature}}{{.UnitIcon}})",
"options": {
"api_key": "<YOUR_API_KEY>",
"location": "AMSTERDAM,NL",
"units": "metric",
"http_timeout": 20
}
}

选项

NameTypeDefaultDescription
api_keytemplate.Your API key from Open Weather Map.
locationtemplateDe Bilt,NLThe requested location interpreted only if valid coordinates aren't given. Formatted as <City,STATE,COUNTRY_CODE>. City name, state code and country code divided by comma. Please, refer to ISO 3166 for the state codes or country codes .
unitsstringstandardUnits of measurement. Available values are standard (kelvin), metric (celsius), and imperial (fahrenheit)
http_timeoutint20in milliseconds, the timeout for http request

模板 (信息)

默认模板
 {{ .Weather }} ({{ .Temperature }}{{ .UnitIcon }})

属性

NameTypeDescription
.Weatherstringthe current weather icon
.Temperatureintthe current temperature
.UnitIconstringthe current unit icon(based on units property)
.URLstringthe url of the current api call