oh-my-posh/website/docs/segments/owm.mdx

69 lines
3.4 KiB
Plaintext
Raw Normal View History

2021-08-15 12:11:02 -07:00
---
id: owm
title: Open Weather Map
2022-01-22 10:46:56 -08:00
sidebar_label: Open Weather Map
2021-08-15 12:11:02 -07:00
---
## What
Shows the current weather of a given location with [Open Weather Map][owm].
2021-08-15 12:11:02 -07:00
:::caution
You **must** request an API key at the [Open Weather Map][owm-price] website.
The free tier for _Current weather and forecasts collection_ is sufficient.
2021-08-15 12:11:02 -07:00
:::
## Sample Configuration
2023-03-31 11:55:36 -07:00
import Config from '@site/src/components/Config.js';
<Config data={{
2021-08-15 12:11:02 -07:00
"type": "owm",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#ffffff",
"background": "#FF0000",
2022-03-27 01:12:47 -07:00
"template": "{{.Weather}} ({{.Temperature}}{{.UnitIcon}})",
2021-08-15 12:11:02 -07:00
"properties": {
"apikey": "<YOUR_API_KEY>",
"location": "AMSTERDAM,NL",
"units": "metric",
"http_timeout": 20,
2022-03-27 01:12:47 -07:00
"cache_timeout": 10
2021-08-15 12:11:02 -07:00
}
2023-03-31 11:55:36 -07:00
}}/>
2021-08-15 12:11:02 -07:00
## Properties
| Name | Type | Description |
| --------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `apikey` | `string` | Your API key from [Open Weather Map][owm] |
| `location` | `string` | The requested location. 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 - defaults to `DE BILT,NL` |
| `units` | `string` | Units of measurement. Available values are standard (kelvin), metric (celsius), and imperial (fahrenheit) - defaults to `standard` |
| `http_timeout` | `int` | The default timeout for http request is 20ms. |
| `cache_timeout` | `int` | The default timeout for request caching is 10m. A value of 0 disables the cache. |
| `template` | `string` | A go [text/template][go-text-template] template extended with [sprig][sprig] utilizing the properties below - defaults to `{{.Weather}} ({{.Temperature}}{{.UnitIcon}})` |
2021-11-02 23:33:15 -07:00
2022-02-01 03:10:46 -08:00
## Template ([info][templates])
:::note default template
```template
2022-02-01 03:10:46 -08:00
{{ .Weather }} ({{ .Temperature }}{{ .UnitIcon }})
```
:::
### Properties
2021-11-02 23:33:15 -07:00
| Name | Type | Description |
| -------------- | -------- | ---------------------------------------------- |
| `.Weather` | `string` | the current weather icon |
| `.Temperature` | `int` | the current temperature |
| `.UnitIcon` | `string` | the current unit icon(based on units property) |
| `.URL` | `string` | the url of the current api call |
2022-01-22 10:46:56 -08:00
2022-04-20 09:43:59 -07:00
[templates]: /docs/configuration/templates
[owm]: https://openweathermap.org
[owm-price]: https://openweathermap.org/price