> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coreflux.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Open-Meteo REST API

> Client-mode REST API connector for free weather forecast and solar radiation (Open-Meteo Forecast API)

Technical Preview

## Overview

Client-mode REST API connector for free weather forecast and solar radiation (Open-Meteo Forecast API). `BASE_ADDRESS` defaults to `https://api.open-meteo.com`. Auth: **None for non-commercial (optional apikey query for commercial)**. Pass secrets only at runtime via MQTT JSON placeholders or Hub `GET SECRET` — never commit real credentials.

## Auth

None for non-commercial (optional apikey query for commercial). Prefer Hub secrets / `GET SECRET`. Never hard-code tokens into the `.lot`.

## Basic Syntax

```lot wrap theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}

DEFINE ROUTE OpenMeteoRestApi WITH TYPE REST_API
    ADD REST_API_CONFIG
        WITH BASE_ADDRESS "https://api.open-meteo.com"
        WITH ENABLE_CLIENT "true"
        WITH USE_SSL "true"
        WITH REQUEST_TIMEOUT '30'
        WITH DEFAULT_CONTENT_TYPE "application/json"
        # Optional: WITH USERNAME "YOUR_USER" / WITH PASSWORD GET SECRET "APP_PASSWORD"
    ADD EVENT Getforecasthourlysolar
        WITH SOURCE_TOPIC "integrations/open-meteo/request/Getforecasthourlysolar"
        WITH DESTINATION_TOPIC "integrations/open-meteo/response/Getforecasthourlysolar"
        WITH METHOD "GET"
        WITH ENDPOINT "/v1/forecast?latitude={value.json.latitude}&longitude={value.json.longitude}&hourly=temperature_2m,shortwave_radiation&timezone={value.json.timezone}"
        WITH HEADERS
            ADD "Accept" "application/json"
    ADD EVENT Getcurrentweather
        WITH SOURCE_TOPIC "integrations/open-meteo/request/Getcurrentweather"
        WITH DESTINATION_TOPIC "integrations/open-meteo/response/Getcurrentweather"
        WITH METHOD "GET"
        WITH ENDPOINT "/v1/forecast?latitude={value.json.latitude}&longitude={value.json.longitude}&current=temperature_2m,wind_speed_10m,weather_code&timezone={value.json.timezone}"
        WITH HEADERS
            ADD "Accept" "application/json"
    ADD EVENT Getforecasthourlyweather
        WITH SOURCE_TOPIC "integrations/open-meteo/request/Getforecasthourlyweather"
        WITH DESTINATION_TOPIC "integrations/open-meteo/response/Getforecasthourlyweather"
        WITH METHOD "GET"
        WITH ENDPOINT "/v1/forecast?latitude={value.json.latitude}&longitude={value.json.longitude}&hourly=temperature_2m,relative_humidity_2m,precipitation,wind_speed_10m&forecast_days={value.json.forecast_days}&timezone={value.json.timezone}"
        WITH HEADERS
            ADD "Accept" "application/json"
    ADD EVENT Getforecastdaily
        WITH SOURCE_TOPIC "integrations/open-meteo/request/Getforecastdaily"
        WITH DESTINATION_TOPIC "integrations/open-meteo/response/Getforecastdaily"
        WITH METHOD "GET"
        WITH ENDPOINT "/v1/forecast?latitude={value.json.latitude}&longitude={value.json.longitude}&daily=temperature_2m_max,temperature_2m_min,precipitation_sum,shortwave_radiation_sum&forecast_days={value.json.forecast_days}&timezone={value.json.timezone}"
    # ... additional EVENTs in package .lot ...
```

## MQTT topics

Request topics under `integrations/open-meteo/request/...`; responses on `integrations/open-meteo/response/...`.

## Template reference

Generated from the shipped broker template `open-meteo` (`-routeCode OPEN_METEO`). It lists every event the template defines.

### Auth

None for non-commercial (optional apikey query for commercial)

### Template parameters

| Placeholder | Type | Description | Required |
| - | - | - | - |
| `RouteName` | string | Name of the Open-Meteo connector | no |
| `BaseUrl` | string | Open-Meteo base URL without trailing slash (e.g. [https://api.open-meteo.com](https://api.open-meteo.com)) | yes |

`BASE_ADDRESS` default: `https://api.open-meteo.com`.

### Events

| Event | Method | Endpoint | Request topic | Response topic | Payload fields |
| - | - | - | - | - | - |
| `Getforecasthourlysolar` | GET | `/v1/forecast?latitude={value.json.latitude}&longitude={value.json.longitude}&hourly=temperature_2m,shortwave_radiation&timezone={value.json.timezone}` | `integrations/open-meteo/request/Getforecasthourlysolar` | `integrations/open-meteo/response/Getforecasthourlysolar` | `latitude`, `longitude`, `timezone` |
| `Getcurrentweather` | GET | `/v1/forecast?latitude={value.json.latitude}&longitude={value.json.longitude}&current=temperature_2m,wind_speed_10m,weather_code&timezone={value.json.timezone}` | `integrations/open-meteo/request/Getcurrentweather` | `integrations/open-meteo/response/Getcurrentweather` | `latitude`, `longitude`, `timezone` |
| `Getforecasthourlyweather` | GET | `/v1/forecast?latitude={value.json.latitude}&longitude={value.json.longitude}&hourly=temperature_2m,relative_humidity_2m,precipitation,wind_speed_10m&forecast_days={value.json.forecast_days}&timezone={value.json.timezone}` | `integrations/open-meteo/request/Getforecasthourlyweather` | `integrations/open-meteo/response/Getforecasthourlyweather` | `forecast_days`, `latitude`, `longitude`, `timezone` |
| `Getforecastdaily` | GET | `/v1/forecast?latitude={value.json.latitude}&longitude={value.json.longitude}&daily=temperature_2m_max,temperature_2m_min,precipitation_sum,shortwave_radiation_sum&forecast_days={value.json.forecast_days}&timezone={value.json.timezone}` | `integrations/open-meteo/request/Getforecastdaily` | `integrations/open-meteo/response/Getforecastdaily` | `forecast_days`, `latitude`, `longitude`, `timezone` |
| `Getsolarradiation` | GET | `/v1/forecast?latitude={value.json.latitude}&longitude={value.json.longitude}&hourly=shortwave_radiation,direct_radiation,diffuse_radiation,direct_normal_irradiance&timezone={value.json.timezone}` | `integrations/open-meteo/request/Getsolarradiation` | `integrations/open-meteo/response/Getsolarradiation` | `latitude`, `longitude`, `timezone` |
| `Getforecastbymodel` | GET | `/v1/forecast?latitude={value.json.latitude}&longitude={value.json.longitude}&hourly=temperature_2m&models={value.json.models}&timezone={value.json.timezone}` | `integrations/open-meteo/request/Getforecastbymodel` | `integrations/open-meteo/response/Getforecastbymodel` | `latitude`, `longitude`, `models`, `timezone` |
| `Getelevation` | GET | `/v1/elevation?latitude={value.json.latitude}&longitude={value.json.longitude}` | `integrations/open-meteo/request/Getelevation` | `integrations/open-meteo/response/Getelevation` | `latitude`, `longitude` |

### Deploy

Get the template card (JSON with `template` and `metadata`) from the broker, then deploy the connector:

```bash theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
mosquitto_pub -t '$SYS/Coreflux/Command' -m "-routeCode OPEN_METEO"
```

The deployable connector from the REST API app, with `BASE_ADDRESS` already filled in:

```lot theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
DEFINE ROUTE OpenMeteoRestApi WITH TYPE REST_API
    ADD REST_API_CONFIG
        WITH BASE_ADDRESS "https://api.open-meteo.com"
        WITH ENABLE_CLIENT "true"
        WITH USE_SSL "true"
        WITH REQUEST_TIMEOUT '30'
        WITH DEFAULT_CONTENT_TYPE "application/json"
    ADD EVENT Getforecasthourlysolar
        WITH SOURCE_TOPIC "integrations/open-meteo/request/Getforecasthourlysolar"
        WITH DESTINATION_TOPIC "integrations/open-meteo/response/Getforecasthourlysolar"
        WITH METHOD "GET"
        WITH ENDPOINT "/v1/forecast?latitude={value.json.latitude}&longitude={value.json.longitude}&hourly=temperature_2m,shortwave_radiation&timezone={value.json.timezone}"
        WITH HEADERS
            ADD "Accept" "application/json"
    ADD EVENT Getcurrentweather
        WITH SOURCE_TOPIC "integrations/open-meteo/request/Getcurrentweather"
        WITH DESTINATION_TOPIC "integrations/open-meteo/response/Getcurrentweather"
        WITH METHOD "GET"
        WITH ENDPOINT "/v1/forecast?latitude={value.json.latitude}&longitude={value.json.longitude}&current=temperature_2m,wind_speed_10m,weather_code&timezone={value.json.timezone}"
        WITH HEADERS
            ADD "Accept" "application/json"
    ADD EVENT Getforecasthourlyweather
        WITH SOURCE_TOPIC "integrations/open-meteo/request/Getforecasthourlyweather"
        WITH DESTINATION_TOPIC "integrations/open-meteo/response/Getforecasthourlyweather"
        WITH METHOD "GET"
        WITH ENDPOINT "/v1/forecast?latitude={value.json.latitude}&longitude={value.json.longitude}&hourly=temperature_2m,relative_humidity_2m,precipitation,wind_speed_10m&forecast_days={value.json.forecast_days}&timezone={value.json.timezone}"
        WITH HEADERS
            ADD "Accept" "application/json"
    ADD EVENT Getforecastdaily
        WITH SOURCE_TOPIC "integrations/open-meteo/request/Getforecastdaily"
        WITH DESTINATION_TOPIC "integrations/open-meteo/response/Getforecastdaily"
        WITH METHOD "GET"
        WITH ENDPOINT "/v1/forecast?latitude={value.json.latitude}&longitude={value.json.longitude}&daily=temperature_2m_max,temperature_2m_min,precipitation_sum,shortwave_radiation_sum&forecast_days={value.json.forecast_days}&timezone={value.json.timezone}"
        WITH HEADERS
            ADD "Accept" "application/json"
    ADD EVENT Getsolarradiation
        WITH SOURCE_TOPIC "integrations/open-meteo/request/Getsolarradiation"
        WITH DESTINATION_TOPIC "integrations/open-meteo/response/Getsolarradiation"
        WITH METHOD "GET"
        WITH ENDPOINT "/v1/forecast?latitude={value.json.latitude}&longitude={value.json.longitude}&hourly=shortwave_radiation,direct_radiation,diffuse_radiation,direct_normal_irradiance&timezone={value.json.timezone}"
        WITH HEADERS
            ADD "Accept" "application/json"
    ADD EVENT Getforecastbymodel
        WITH SOURCE_TOPIC "integrations/open-meteo/request/Getforecastbymodel"
        WITH DESTINATION_TOPIC "integrations/open-meteo/response/Getforecastbymodel"
        WITH METHOD "GET"
        WITH ENDPOINT "/v1/forecast?latitude={value.json.latitude}&longitude={value.json.longitude}&hourly=temperature_2m&models={value.json.models}&timezone={value.json.timezone}"
        WITH HEADERS
            ADD "Accept" "application/json"
    ADD EVENT Getelevation
        WITH SOURCE_TOPIC "integrations/open-meteo/request/Getelevation"
        WITH DESTINATION_TOPIC "integrations/open-meteo/response/Getelevation"
        WITH METHOD "GET"
        WITH ENDPOINT "/v1/elevation?latitude={value.json.latitude}&longitude={value.json.longitude}"
        WITH HEADERS
            ADD "Accept" "application/json"
```

Deploy it with `-addRoute` (do not include `ADD METADATA`).

### Usage example

Call `Getforecasthourlysolar` by publishing a JSON payload to its request topic, and read the reply on the response topic:

```bash theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
mosquitto_sub -t 'integrations/open-meteo/response/Getforecasthourlysolar' &
mosquitto_pub -t 'integrations/open-meteo/request/Getforecasthourlysolar' -m '{"latitude": "<latitude>", "longitude": "<longitude>", "timezone": "<timezone>"}'
```

## Related

* [REST API Connectors](/latest/lot-language/routes/rest-api-routes)
* [REST API apps index](/latest/lot-language/routes/rest-api-apps)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.