# Smhi Weather Window Finder (`kassako/smhi-weather-window-finder`) Actor

- **URL**: https://apify.com/kassako/smhi-weather-window-finder.md
- **Developed by:** [KassaKo Tools](https://apify.com/kassako) (community)
- **Categories:** Travel, Developer tools, Open source
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-usage

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Nordic Weather Window Finder (SMHI)

Tell it where you work and what weather you can work in. It tells you **when**.

Most weather actors return a raw forecast table and leave you to write the filtering yourself. This actor does the filtering. Give it limits (wind, gusts, rain, visibility, temperature, daylight) and a list of places, and it returns the **time windows over the next 10 days where all your limits hold**, ready to schedule against.

Typical uses: drone and photography flights, roofing and painting, crane and lifting work, outdoor events, sailing and boat launches, field spraying, film crews.

Data comes from the official **SMHI open data API** (Swedish Meteorological and Hydrological Institute). No scraping, no login, no API key. Coverage is the SMHI forecast area: Sweden and the surrounding Nordic region.

### What you get

One dataset item per good window, longest first. Locations with no window return one free `no_window` item that lists which of your limits blocked the most hours, so you know what to loosen.

#### Output example (illustrative values)

```json
{
  "type": "window",
  "location": "Stockholm",
  "latitude": 59.3293,
  "longitude": 18.0686,
  "startUtc": "2026-10-22T06:00:00+00:00",
  "endUtc": "2026-10-22T15:00:00+00:00",
  "startLocal": "2026-10-22 08:00",
  "endLocal": "2026-10-22 17:00",
  "durationHours": 9.0,
  "maxWindSpeedMs": 5.6,
  "maxGustMs": 9.1,
  "totalPrecipitationMm": 0,
  "maxPrecipitationProbabilityPct": 10,
  "minTemperatureC": 8.2,
  "maxTemperatureC": 11.4,
  "minVisibilityKm": 22.3,
  "minCloudBaseM": 1240,
  "forecastCreatedUtc": "2026-10-21T09:16:42Z",
  "attribution": "Weather data: SMHI (Swedish Meteorological and Hydrological Institute), CC BY 4.0"
}
```

### Input

| Field | Default | Meaning |
|---|---|---|
| `places` | none | Swedish place names: Stockholm, Goteborg, Malmo, Uppsala, Kiruna, Are and about 25 more (30 in total). Accents are optional. |
| `coordinates` | none | Any point as `{"name": "Site A", "latitude": 59.33, "longitude": 18.07}` |
| `maxWindSpeed` | 8 | Mean wind limit, m/s |
| `maxGust` | 12 | Gust limit, m/s |
| `maxPrecipitationMm` | 0.1 | Rain per forecast step, mm |
| `maxPrecipitationProbability` | 30 | Percent |
| `maxThunderstormProbability` | 5 | Percent |
| `minVisibilityKm` | 5 | Kilometres |
| `minTemperatureC` / `maxTemperatureC` | -10 / 35 | Degrees C |
| `minCloudBaseM` | 0 (off) | Minimum cloud base in metres, when reported |
| `daylightOnly` | true | Skip hours between sunset and sunrise (calculated, accurate to roughly 10 minutes) |
| `minWindowHours` | 2 | Shortest window worth returning |
| `horizonHours` | 240 | How far ahead to look |
| `maxWindowsPerLocation` | 10 | Caps your cost |

Example input:

```json
{
  "places": ["Stockholm", "Goteborg"],
  "coordinates": [{ "name": "Wind farm site", "latitude": 63.2, "longitude": 14.6 }],
  "maxWindSpeed": 9,
  "maxGust": 14,
  "minWindowHours": 3
}
```

### Pricing: pay per result

You pay per **window returned** (event `weather-window`). `no_window` and `error` items are free. Set a maximum cost per run in the Apify console and the actor stops at that limit. No monthly fee.

### Notes and limits

- The first 2 days are forecast hourly. Days 3 to 10 use coarser steps (3 to 12 hours), so long-range windows are less precise. Treat day 5+ as a planning hint, not a promise.
- This is not a safety or aviation-certified product. Check official sources and local rules before flying or lifting.
- Points outside the SMHI area return an `error` item.
- Weather data: SMHI, licensed CC BY 4.0. This actor is an independent tool and is not affiliated with SMHI.

### Run on a schedule

Use Apify schedules to run it every morning and send the dataset to Slack, email or a webhook with Apify integrations.

# Actor input Schema

## `places` (type: `array`):

Names of well-known Swedish places, for example Stockholm, Goteborg, Malmo, Kiruna, Are. Use coordinates below for anywhere else.

## `coordinates` (type: `array`):

Any point in the Nordic forecast area, as objects like {"name": "My site", "latitude": 59.33, "longitude": 18.07}.

## `maxWindSpeed` (type: `number`):

Hours with higher mean wind fail. Typical consumer drone limit is 8-10 m/s.

## `maxGust` (type: `number`):

Highest allowed wind gust in the window. Leave empty to ignore gusts.

## `maxPrecipitationMm` (type: `number`):

Mean expected precipitation in the interval. 0.1 means practically dry.

## `maxPrecipitationProbability` (type: `integer`):

Highest allowed chance of precipitation per hour. Leave empty to ignore.

## `maxThunderstormProbability` (type: `integer`):

Highest allowed chance of thunder per hour. Leave empty to ignore.

## `minVisibilityKm` (type: `number`):

Lowest allowed horizontal visibility. Leave empty to ignore.

## `minTemperatureC` (type: `number`):

Coldest allowed air temperature. Leave empty to ignore.

## `maxTemperatureC` (type: `number`):

Warmest allowed air temperature. Leave empty to ignore.

## `minCloudBaseM` (type: `integer`):

Only checked when SMHI reports a cloud base. Useful for drone and aviation work.

## `daylightOnly` (type: `boolean`):

Ignore hours between sunset and sunrise.

## `minWindowHours` (type: `integer`):

Shortest window worth reporting, in hours.

## `horizonHours` (type: `integer`):

SMHI forecasts reach about 10 days (240 hours). Later hours are 3-6 hourly, so long windows are coarser.

## `maxWindowsPerLocation` (type: `integer`):

Caps cost. You pay per window returned.

## Actor input object example

```json
{
  "places": [
    "Stockholm",
    "Goteborg"
  ],
  "maxWindSpeed": 8,
  "maxGust": 12,
  "maxPrecipitationMm": 0.1,
  "maxPrecipitationProbability": 30,
  "maxThunderstormProbability": 5,
  "minVisibilityKm": 5,
  "minTemperatureC": -10,
  "maxTemperatureC": 35,
  "minCloudBaseM": 0,
  "daylightOnly": true,
  "minWindowHours": 2,
  "horizonHours": 240,
  "maxWindowsPerLocation": 10
}
```

# Actor output Schema

## `windows` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "places": [
        "Stockholm",
        "Goteborg"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("kassako/smhi-weather-window-finder").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "places": [
        "Stockholm",
        "Goteborg",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("kassako/smhi-weather-window-finder").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "places": [
    "Stockholm",
    "Goteborg"
  ]
}' |
apify call kassako/smhi-weather-window-finder --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,kassako/smhi-weather-window-finder"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/I2yx5twE60iIUVrNp/builds/5tI1ijtLtWzF3s26v/openapi.json
