[App][Pro] OpenWeather

large

This app brings the OpenWeatherMap API to Homey.
Get current weather data and forecasts for any number of locations.

The following weather data is available:

  • Current weather data (and location)
  • Hourly forecasts up to 48 hours
  • Daily forecasts up to 7 days

Different values are provided for each variant, such as temperature, air pressure, humidity, weather conditions and many other values.

A description of the API and example data can be found at https://openweathermap.org/api/one-call-api


Precondition:
An API key is required to use the OpenWeatherMap API.
The API key can be downloaded free of charge from https://openweathermap.org/api.
1000 calls per day are permitted per API key.

Update 08/2022:
OWM has deprecated the OneCallAPI 2.5. So new user with a new API key will need a subscription for OneCallAPI 3.0. You have to set a payment option but you still have 1000 calls a day free. You can set a limit to 1000 calls in the OWM profile.
While adding the current weather/location device, choose the API version 3.0.


Migration to the OneCall API:

The previous Homey devices use an older API version that will no longer be supported by OWM in the future or is only available in subscriptions.
These devices are marked as [deprecated]. They still continue to work but they can’t be added anomore.
As long as the API calls are still possible, these devices can continue to be used.
However, it is recommended to replace these devices with the new devices and adjust the flows.


Known breaking changes:

  • The migration to the SDK3 will break a flow trigger “measure_rain_changed”. You have to replace the trigger card in your flows.

Support app development with a small donation via PayPal. Many thanks :beers:

btn_donate_LG1

7 Likes

The Devices

Current weather (location)
First, you need a location for which you want to get weather data.
So add a new device and select the device type “Current weather (location)”:
grafik

In the next step you can set the device properties:
grafik

  • The OWM API key
  • A city name. Leave blank to use Homeys location.
  • A polling interval in minutes. Take a interval to keep below 1000 API calls a day. Every current weather device is calling the API at this interval.

The next step displays a list of found cities:
grafik

Select your city and the device gets added.

grafik

grafik

You can change the device settings at any time:
grafik


Forecast devices
A forecast device is a “child” device of a “Current weather” device.
If you add a forecast device it’s connected to a early added current weahter device (the location). The main device is calling the API, which includes current data and forecasts, and forwards the forecast data to its child device. This way you can save many API calls and you can add as many forecast devices as you want.
If you delete a main device, all depending forecast devices will get unavailable and mus be deleted, too.

To add a forecast device, just use a hourly or daily forecast device type:
grafik

You can set now the time offset of your forecast.
grafik

Iy you set “0” hours/days, you get the forecast of the current time. If you set “12” hours, you will get the forecast 12 hours ahead.

Now you can select the location to use:
grafik

After this step, the device is added.
grafik

2 Likes

OpenWeatherMap API

FAQ:


Devices

  • I get the message this device will soon stop working. Do i have to do something?
    No, you don’t need to do something. Your devices will work as long as OWM is supporting the used API.
    In pairing dialog, only the new devices are available using the OneCallAIP. That’s the current API for free use. So just contiune with your devices and try the new ones (with additional data and real hourly forecast) in addition. If you like the new ones, you can adjust your flows and delete the old devices.

  • Can I add a single forecast device?
    You need a “Current weather” device. This device contains the location setting, API key and reds the weather data. The forecast devie only displays the forecast for a set timeslice.

  • I registeres a new API key (since 08/2022) and I get a device unavailable error “invalid API key”?
    OWM has deprecated the OneCallAPI 2.5. So new user with a new API key will need a subscription for OneCallAPI 3.0. You have to set a payment option at OWM but you still have 1000 calls a day free. You can set a limit to 1000 calls in the OWM profile.
    While adding the current weather/location device, choose the API version 3.0. You can change this API version for existing devices in device settings if you are upgrading to the 3.0 subscription.


Weather data

  • To which times refer the daily forecast temperatures for morning, day, evening and night?
    Morning: 6:00
    Day: 12:00
    Evening: 18:00
    Night: 00:00

Version history:

  • 1.0.0
    Major update introducing OnCallAPI.
  • 1.0.1
    Changed icons and translation
  • 1.0.2
    Bugfix for “Probability of precipitation”
  • 1.0.3
    Small fixes (condition detail trigger)
  • 1.0.4 / 1.0.5
    Added device setting to show wind speed in m/s
  • 1.1.0
    Added air pollution devices
  • 1.1.1/1.1.2
    Small changes for description and icons
  • 1.1.3
    Added dew point
  • 1.1.4
    Re-arranged capabilities. To take effect, a device have to be added again
  • 1.1.5
    Activated Insights for all numeric capabilities
  • 1.1.6/1.1.7
    Fixesd some errors raised with 7.4rc
  • 1.1.8
    Added “Fog” as weather condition.
    Some minor conditions like smoke, dust, haze, sand are still not included to keep the condition list simple. I will add missing conditions if they are used by OWM. I will see it in app crash reports :slight_smile:
  • 1.1.9/1.1.10
    Changed date/time localization based on NodeJS version of 7.4rc
  • 1.1.11
    Added ‘Haze’ to weather conditions
  • 1.1.12
    Changed date/time localization based on NodeJS version of 7.4rc for air quality devices
  • 1.1.13
    Added option to deactivate polling.
    Added flow action for individual polling update.
  • 1.1.14
    Timezone handling for sunrise/sunset
    Small bugfixes
  • 1.1.15
    Fix for deprecated devices: min/max temperature for hourly forecast, wind direction for hourly/daily forecast.
  • 1.1.16
    Fixed SO2 trigger. Please repair the flows because the trigger name has changed.
  • 1.1.17
    Added specific weather condition to ‘highlighted trigger cards’. Simplified descriptions af weather condition capability and trigger.
  • 1.2.0
    Added weather alerts. Add a warning device to a location and receive warnings in difficult weather conditions.
  • 1.2.1 - 1.2.2
    Added capability for weather condition description for use as global flow tag.
  • 1.2.3
    Small bugfiy for async device init.
  • 1.2.4
    Adjusted Beaufort scale. Fixed ‘alarm has changed’ trigger.

According the Daily Forecast, what is the definition of Morning, Day, Evening and Night? What is the time range?

Good question. I checked @ One Call API: weather data for any geographical coordinate - OpenWeatherMap
But no additional info. So I just asked them :grimacing:
I’ll let you know when I’ve a response.

1 Like

That’s not exactly defined by OWM API documentation:
grafik
More informations are not proovided by OWM.
I’m curious about owm’s answer, too :slight_smile:

1 Like

Mystery solved, guys. @DirkG @RonnyW

3 Likes

So easy :smile:

1 Like

after the update to day, i get the message this device will soon stop working. Do i have to do something ? because it still works fine after all these years.

Hello,
you don’t need to to something. Your devices will continue to work as long as OWM is supporting this API. The current weather and hourly forecast (3h interval) is currently supported, but the daily forecast is only available for paid subscription.

The message appears, because the devices are “deprecated”. They are still working but are not available for pairing. For new paired devices, only the new ones with OnCallAPI access are available, because that’s the new default API for free use.

You can keep all like it is - and test the new devices with some more weather information, a real hourly forecast and a daily forecast up to 7 days. Using this API, only the “Current weather” device is requesting the API. Assigned forecast devices don’t need API request. So you can use shorter intervals with your 1000 API request a day.

Greetings
Ronny

PS: I added this question/answer to the FAQ (post #4)

2 Likes

Hi Ronny,

in the overview of the daily weather forecast, the weather condition (Wetterlage) is translated into German language:

But if I want to use weather condition (Wetterlage) as tag in a flow, e.g. to play a summary of the daily weather forecast via TTS over my speakers in the morning, it’s in English.

Is there a way to translate also the tag(s)?

In the app Weather Underground, the forecast of the weather condition is translated. But it’s a string and you’re using a enum (whatever that is :wink:):

Hi @DirkG

OWM (oneCallAPI) is returning three values for teh condition.

  • a string (weather description), alreday translated by OWM
  • a enum for condition
  • a enum for condition details

The description is shown as second value in the sensor screen. This value you can use directly.

The enums are a list of fixed values - and each value has a (translated) description.
What is “enum”?
=> Enumerated type - Wikipedia

What values is OWM providing?
“weather”: [
{
“id”: 500,
“main”: “Rain”,
“description”: “light rain”,
“icon”: “10d”
}
Here you can see the “description” (text in requested language), the “id” (condition detail) and the “main” value (condition).

A list of possible values can be found here:
https://openweathermap.org/weather-conditions#Weather-Condition-Codes-2

In the app, these fixed values are defined as enum list for the capability. At this point, the translation is done by Homey for the sensor view:

But inside, the enum values are used, because they are unique.

In the flows, you will see a list of possible values (with description) where you can select one entry. Inside, the enum value is used to check or compare the device values with the flow tag (for flow conditions).

1 Like

Hi @RonnyW,
I found a little bug. The value of the forecast for the precipitation is shown in typical Homey values from 0,00 to 1,00:

But the correct way to display should be like this (original iOS OpenWeather App):

Thanks for the hint. I added this field while there was no rain in sight :sweat_smile:

1 Like

Hello @Ronni

thanks for the suggestion in your review. A device setting to show windspeed in m/s is now included. It can be activated for each device.
Forecast devices are refreshed with the next interval.
This change only affects the new devices using OneCallAPI.
You could try the new test version 1.0.4 and check if all is working right. Many thanks.

2 Likes

I have updated the app to 1.0.4 and no issues found. :slight_smile:

1 Like

It seems to be working just fine!
Thank you for quick response, and very quick update! :wink:

/Ronni

I’ve published a new test version with a optimized logic for changes between m/s and km/h (or mph). Especially the capability changes are reduced on changes of device settings because they have a heavy impact on performance.

If someone is using imperial units, it would be nice if a feedback is postet to know all is correct for mph values, too.