Skip to content

OpenWeather (English)

roe-dl edited this page Aug 25, 2024 · 14 revisions

What is OpenWeather?

OpenWeather is an UK based company that provides weather data based on calculations for every point on earth. Despite how they call themselves, their services are not entirely for free. There is a rate limit for the current weather data if you don't pay (which will not be exceeded by this extension). To get the forecast you need a separate subscription, which involves a per-download fee and some free downloads. For maps you have to pay always.

Using OpenWeather API with WeeWX

weewx-DWD supports retrieving actual weather data from OpenWeather by their API. It includes additional observation types to the archive record. The observation types are named like the standard observation types of core WeeWX, but prepended by a configurable prefix. You can retrieve data for more than one location in parallel.

Their maps you can download using the [[download]] feature. You need a subscription with OpenWeather for that.

Retrieving current weather data

Configuration

The configuration is simple. Specify latitude and longitude and the language, the text messages should be provided in. You need an API key which you get from OpenWeather for free. The configuration section in weewx.conf could look like this:

[WeatherServices]
    [[current]]
        [[[FichtelbergOWM]]]
            provider = OpenWeather
            station = Fichtelberg
            latitude = 50.4283
            longitude = 12.9536
            lang = 'en'
            prefix = 'xyz'
            api_key = 'API key that you got from OpenWeather'

This would retrieve current weather data for mount Fichtelberg in Saxony. You can specify any other location around the world.

Using in skins

The prefix is set to xyz in this example. This means, if you want to display the temperature you would write $current.xyzOutTemp in the skin template. $current.xyzIcon.raw provides an icon file name, and $current.xyzIcontitle.raw a text message describing the current weather.

As OpenWeather does not provide dewpoint, it is calculated within weewx-DWD using the WeeWX formula.

Observation types (replace prefix by the prefix you set in configuration):

  • prefixDateTime: issuing timestamp
  • prefixPressure: ground level pressure
  • prefixBarometer: sea-level pressure
  • prefixOutTemp: air temperature
  • prefixOutHumidity: relative humidity
  • prefixDewpoint: dewpoint (not provided by OpenWeather but calculated by this extension)
  • prefixAppTemp: feels-like temperature
  • prefixMinTemp: minimum temperature (I do not really understand what that is for a single timestamp.)
  • prefixMaxTemp: maximum temperature
  • prefixVisibility: visibility (up to 10 km)
  • prefixWindSpeed: wind speed
  • prefixWindDir: wind direction
  • prefixWindGust: wind gust speed
  • prefixCloudcover: cloud cover (percent)
  • prefixIcon: file name of the weather condition icon
  • prefixIcontitle: current weather condition as text in the specified language
  • prefixLongitude: longitude of the location
  • prefixLatitude: latitude of the location
  • prefixSunrise: sunrise time at the specified location
  • prefixSunset: sunset time at the specified location
  • prefixUtcoffset: UTC offset valid at the specified location at the given timestamp

Saving to a database

WeeWX uses a constant archive interval, but OpenWeather provides their data with a varying interval. Therefore, weewx-DWD stores the data it got from OpenWeather to a separate database. This database can be made available to WeeWX by configuring an appropriate binding.

I see no use in putting downloaded data into LOOP packets here, as their data is updated at most once per 5 minutes.

Mobile stations

If your station is mounted on a vehicle and its location is available in WeeWX by observation types called latitude and longitude, you can specify station = mobile, and data is always retrieved for the current location of the station as provided by the observation types latitude and longitude. I am sure there is at least one person who wants to try this feature.

Forecast

Support for downloading OpenWeather's forecast should be available soon.

Maps

[WeatherServices]
    path = '/etc/weewx/skins/SKINNAME/SUBDIRECTORY'
    [[download]]
        [[[example map]]]
            url = 'https://maps.openweathermap.org/maps/...'
            file = '...'