MetService smart home integration, free and open source

Official New Zealand weather by MetService: hourly forecast per town, today and tomorrow.
The official weather of New Zealand in Gladys: the hourly forecast of MetService for the towns you follow, read through the MetService Point Forecast API (run by MetOcean Solutions, a MetService company). For anyone with a home, a bach or family in New Zealand.
Developed without an API key: feedback welcome. The integration follows the API documentation and was tested against the live service for what needs no key (the endpoint, the refused key), not with a real forecast. Please report what works and what does not in the issues.
This integration is not affiliated with MetService nor with MetOcean.
Presentationâ
- One device per town: up to five of the 43 towns and cities MetService publishes a local forecast for, from Kaitaia to Invercargill.
- Each device shows, for the hour in progress: temperature, feels-like temperature, humidity, air pressure, wind speed, gusts and direction, precipitation (mm/h) and the conditions (fine, partly cloudy, rainâŠ); and the minimum and maximum of today and tomorrow.
- A scene trigger Rain expected: rain is forecast within the next 3 hours.
- A scene action Get the MetService forecast: today's or tomorrow's forecast as scene variables, ready for a message.
- A dashboard widget MetService forecast: live values, the coming hours, today and tomorrow.
- Read-only: nothing can be controlled.
Prerequisitesâ
- Gladys Assistant 5.3.0 or later (catalog countries; widgets and scene cards since 5.1.0).
- A MetService Point Forecast API key: create an account on console.metoceanapi.com, then copy the key from Usage & keys. The free plan is for non-commercial use and includes a monthly amount of API units; check it in the console, and set a usage limit there so that nothing is ever charged.
- Internet access for Gladys (the integration calls
forecast-v2.metoceanapi.com).
Why not the forecasts of the metservice.com website? Their data says it "may only be used with explicit permission from MetService": the integration uses the official API instead.
Configurationâ
Open Integrations â MetService â Configuration.
API keyâ
Paste the key of the console. It stays in the Gladys configuration: it is never written in the
logs nor under /data.
Townsâ
Pick the towns to follow, five at most: each one becomes a device in Discovery. The forecast is asked for the centre of the town (rounded to about 1 km).
Refresh and API unitsâ
Each request costs 8 API units per town (8 weather variables), whatever the number of hours it returns. One request brings the hourly forecast from midnight today to midnight after tomorrow (New Zealand time); between two requests, the values move on by themselves every hour. So a long interval costs little and loses little:
| Interval | Units a month, per town |
|---|---|
| 15 min | 23,040 |
| 30 min | 11,520 |
| 1 hour | 5,760 |
| 2 hours | 2,880 (default) |
| 3 hours | 1,920 |
| 6 hours | 960 |
The Test the connection button shows the estimate for your configuration. The forecast models behind the API are updated a few times a day: below one hour, the gain is small.
Languageâ
The language of the feature names of new devices (fixed at their creation), of the conditions and of the scene action texts. French by default.
Devicesâ
| Feature | Type | Unit |
|---|---|---|
| Temperature | temperature | °C |
| Feels like | temperature | °C |
| Humidity | humidity | % |
| Air pressure (sea level) | pressure | hPa |
| Wind speed, wind gusts | speed | km/h |
| Wind direction (where it comes from) | angle | ° |
| Precipitation | precipitation | mm/h |
| Conditions | text | |
| Today minimum / maximum | temperature (min, max) | °C |
| Tomorrow minimum / maximum | temperature (min, max) | °C |
All values are forecasts of the model for the hour in progress, not station observations. The feels-like temperature is the apparent temperature (Steadman), from temperature, humidity and wind. The conditions come from the precipitation rate and the cloud cover.
Widgetâ
Add the MetService forecast widget to a dashboard and pick a town. It shows the conditions, the temperature, the feels-like temperature, the wind and the rain, then the coming hours (every 3 hours) and today and tomorrow (min / max, rain, strongest gust). Each of the last two blocks can be hidden in the widget settings. Showing the widget never spends a request.
Scene triggerâ
Rain expected fires once when the forecast starts showing rain (0.5 mm/h or more) within the
next 3 hours, after a dry forecast; it fires again only after a dry spell. Filter: the town.
Variables: town, starts_at (ISO date), minutes (before the rain), rate (strongest rate,
mm/h), horizon_hours. It is evaluated every minute on the forecast already received.
Scene actionâ
Get the MetService forecast (town, today or tomorrow) returns, for the following actions:
summary (a ready sentence, in the configured language), conditions, min, max (°C), rain
(mm over the day) and gust (km/h). It reads the forecast already received: no request. Example:
every morning at 7:00, Get the MetService forecast for today, then send summary on Telegram.
Scene examplesâ
- Rain expected in Auckland â notify "Rain in {{minutes}} min: bring the washing in".
- Every evening, Get the MetService forecast for tomorrow â if
minis below 3, notify a frost risk. - When Wind gusts exceed 90 km/h â close the awning.
Troubleshootingâ
- "MetService refused the API key": check the key in the console (no space), and that it is active.
- "MetService refused the request" (HTTP 402/403): the plan of the key, or its usage limit, does not allow it; check Usage & keys in the console.
- "Too many MetService requests" (HTTP 429): every request stops for one hour.
- "MetService does not answer": the forecasts resume as soon as it does; the values already received keep moving on in the meantime, up to midnight after tomorrow.
- No value on a device: add it in Discovery first; the values arrive right away.
- Logs: Integrations â MetService â Logs;
LOG_LEVEL=debugshows each request.
Limitsâ
- Forecasts only: the integration does not read the observations of MetService weather stations.
- No MetService severe weather warnings: the Point Forecast API does not carry them.
- The conditions are computed from rain and cloud cover: no thunderstorm, fog or hail.
- 43 towns, five at most: no free coordinates.
- Developed without an API key (see above): the units of each variable are converted from what the API says in its answer; an unknown unit is skipped and logged, never published wrong.
Configuration settingsâ
These are the settings MetService asks for in its configuration screen in Gladys.
| Setting | Type | Required | Description |
|---|---|---|---|
| Getting started | section | No | The forecasts come from the MetService Point Forecast API (MetOcean, a MetService company). Create an account on console.metoceanapi.com and copy your API key: the free plan is for non-commercial use and includes a monthly amount of API units. Each request costs 8 units per town. Not affiliated with MetService. |
| Point Forecast API key | secret | Yes | The key shown in "Usage & keys" of console.metoceanapi.com. |
| Towns | multi_select | Yes | The MetService towns and cities to follow, five at most: one device each. |
| Refresh interval | select | No | Time between two requests per town. Between requests, the hourly forecast already received moves on by itself. |
| Language of the texts | select | No | Feature names of new devices, conditions and the texts of the scene action. |
How to install MetService in Gladysâ
- In Gladys, open Integrations: MetService appears in the catalog, next to the native integrations, with a community badge.
- Click Install. Gladys pulls the Docker image (
ghcr.io/guim31/gladys-metservice:1.0.0), starts it in a sandbox isolated from the core, and generates the integration's interface (devices, discovery and configuration). - Open the Configuration screen of the integration, fill in the settings, and save.
- You can also install it directly from its repository URL: https://github.com/guim31/gladys-metservice.
MetService requires Gladys >=5.3.0. The catalog inside Gladys refreshes every hour, so a new version becomes available at most one hour after its release.
Not running Gladys yet? It is free and open source: follow the installation guide to get started.
About external integrationsâ
MetService is an external integration: a community integration packaged as a Docker container and published on GitHub, that Gladys installs in one click and runs in a sandbox isolated from its core. It is published and maintained by guim31, not by the Gladys core team.
- Browse all integrations, native and community
- Build and publish your own external integration
- Source code on GitHub â source of this documentation