Weather
The weather set gives your app live weather data from Open-Meteo — no API key, no account, no setup. Fetch current conditions, a multi-day forecast, or hour-by-hour data for any city or set of coordinates.
There are three actions:
| Action | What it returns | Default range |
|---|---|---|
weather-current | Current conditions (temperature, wind, humidity, etc.) | — |
weather-forecast | Array of daily forecasts | 7 days (up to 16) |
weather-hourly | Array of hourly forecasts | 48 hours (up to 168) |
All three are functions — they must be assigned to a variable. All temperatures are in Celsius.
Current conditions — weather-current
$weather = weather-current "New York"$weather = weather-current $city$weather = weather-current $lat $lonThe result is an object with these fields:
| Field | Type | Description |
|---|---|---|
$weather.temperature | number | Temperature in °C |
$weather.feelsLike | number | Feels-like temperature in °C |
$weather.humidity | number | Relative humidity, 0–100 |
$weather.windSpeed | number | Wind speed in km/h |
$weather.windDirection | number | Wind direction in degrees, 0–360 |
$weather.description | text | Condition label, e.g. "Clear sky" |
$weather.icon | text | MDI icon name, e.g. "mdi:weather-sunny" |
$weather.isDay | true/false | Whether it is currently daytime |
$weather.precipitation | number | Current precipitation in mm |
Basic example
$weather = weather-current "Tokyo".text "$weather.temperature° — $weather.description".text "Feels like $weather.feelsLike° · Humidity $weather.humidity% · Wind $weather.windSpeed km/h"Displaying the weather icon
The icon field contains an MDI icon name. Pass it to .icon to render it:
$weather = weather-current "London"$ic = $weather.icon.icon $ic.text "$weather.description"Using coordinates
Pass latitude and longitude as numeric variables (not strings):
$lat = 40.71$lon = -74.01$weather = weather-current $lat $lon.text "$weather.temperature° in New York"Multi-day forecast — weather-forecast
$forecast = weather-forecast "Paris"$forecast = weather-forecast "Tokyo" 14$forecast = weather-forecast $city$forecast = weather-forecast $city $days$forecast = weather-forecast $lat $lon $daysThe result is an array of daily forecast objects. The default is 7 days; the maximum is 16.
Each item in the array has:
| Field | Type | Description |
|---|---|---|
date | text | Date in YYYY-MM-DD format |
high | number | High temperature in °C |
low | number | Low temperature in °C |
feelsLikeHigh | number | Feels-like high in °C |
feelsLikeLow | number | Feels-like low in °C |
precipChance | number | Precipitation probability, 0–100 |
precipAmount | number | Precipitation in mm |
windSpeed | number | Max wind speed in km/h |
description | text | Condition label |
icon | text | MDI icon name |
sunrise | text | Sunrise time (ISO format) |
sunset | text | Sunset time (ISO format) |
Iterating all days
$forecast = weather-forecast "London"foreach $forecast as $day: .text "$day.date: $day.high°C / $day.low°C — $day.description":endCustom number of days
$forecast = weather-forecast "Sydney" 10foreach $forecast as $day: .text "$day.date — Rain chance: $day.precipChance%":endAccessing specific days by index
Array entries are 1-based. To pull out specific days without a loop:
$forecast = weather-forecast "London".text "Today: $forecast.1.description, high $forecast.1.high°C".text "Tomorrow: $forecast.2.description, high $forecast.2.high°C"Hourly forecast — weather-hourly
$hourly = weather-hourly "Miami"$hourly = weather-hourly "Seattle" 24$hourly = weather-hourly $city$hourly = weather-hourly $city $hoursThe result is an array of hourly entries. The default is 48 hours; the maximum is 168 (7 days).
Each entry has:
| Field | Type | Description |
|---|---|---|
time | text | Timestamp (ISO format) |
temperature | number | Temperature in °C |
feelsLike | number | Feels-like temperature in °C |
humidity | number | Relative humidity, 0–100 |
precipChance | number | Precipitation probability, 0–100 |
precipitation | number | Precipitation in mm |
description | text | Condition label |
icon | text | MDI icon name |
windSpeed | number | Wind speed in km/h |
Iterating hourly entries
$hourly = weather-hourly "New York" 24foreach $hourly as $entry: .text "$entry.time — $entry.temperature°C, $entry.description":endHandling errors
All three actions support an extended result pattern that gives you the data, an error message, and extra location metadata as three separate variables:
$result, $error, $details = weather-current "London"$result, $error, $details = weather-forecast "Paris" 5$result, $error, $details = weather-hourly "Chicago" 24$error is null on success or an error message string if the request failed. Always check before using the data:
$result, $error, $details = weather-current "Berlin"if have $error: .text "Could not load weather: $error" #red:else .text "$result.temperature° — $result.description":endPractical patterns
City search app
Let the user type a city and see current conditions:
[home].text "Weather" -bold.enter-text "Enter a city" $city.button "Search" goto [results]
[results]$now, $err = weather-current $cityif have $err: .text "City not found" #red:else .text "$city" -bold .text "$now.temperature°C — $now.description" .text "Humidity: $now.humidity% · Wind: $now.windSpeed km/h":end.button "Back" goto [home]Current + forecast on one screen
Fetch both in the same block — they can share the same $city variable:
[home]$city = "London"
$now = weather-current $city.large.text "$now.temperature°C" -bold.text "$now.description"
$forecast = weather-forecast $city 5foreach $forecast as $day: .text "$day.date: $day.high° / $day.low° — $day.description":endRemembering the user’s city
Use remember to persist the chosen city between sessions:
[launch] remember $city
[home]if have $city: goto [weather]:else .enter-text "Enter your city" $city remember $city .button "Save" goto [weather]:end
[weather]$now = weather-current $city.text "$city — $now.temperature°C"Common mistakes
| Mistake | Fix |
|---|---|
weather-current "Tokyo" without $var = | Weather actions are functions — always assign: $weather = weather-current "Tokyo" |
Using $weather.temperature before checking for errors | Use the extended result pattern and if have $error: first |
Passing coordinates as strings: $lat = "40.71" | Coordinates must be numbers, not quoted strings |
| Requesting more than 16 forecast days | weather-forecast caps at 16 days; values above that are clamped |
| Requesting more than 168 hourly entries | weather-hourly caps at 168 hours; values above that are clamped |
| Treating forecast/hourly results as a single object | Both return arrays — use foreach to iterate, or .1, .2 for specific entries |