Back to Oh My Posh

Open Weather Map

website/docs/segments/web/owm.mdx

29.12.03.2 KB
Original Source

What

Shows the current weather of a given location with Open Weather Map.

:::caution You must request an API key at the Open Weather Map website. The free tier for Current weather and forecasts collection is sufficient. :::

Sample Configuration

import Config from "@site/src/components/Config.js";

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

Options

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

Template (info)

:::note default template

template
 {{ .Weather }} ({{ .Temperature }}{{ .UnitIcon }})

:::

Properties

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