This is the forum archive of Homey. For more information about Homey, visit the Official Homey website.

The Homey Community has been moved to https://community.athom.com.

This forum is now read-only for archive purposes.

[Published] OpenWeatherMap app v0.0.8

anneanne Member
edited January 2018 in Apps

OpenWeatherMap for Homey

This app allows you to poll the OpenWeatherMap API for localised weather data and use this in your Homey home automation flows. Several instances (locations) can run simultaneously.

Current weather

The 'current weather' data comes from the OWM current weather data, refer to http://openweathermap.org/current. It includes visibility, sunrise and sunset data which are not included in the forecast tables. Note that the max. and min. temperatures in the current data indicate the possible range in which the actual temperature is expected, it can be seen as a measure for the standard deviation of the current temperature.

Forecast up to 5 days

The five day forecast data (refer to http://openweathermap.org/forecast5) includes forecasts in 3-hour intervals up to 5 days in the future. During pairing you can choose the 3-hour interval you want to have weather data from. Interval 0 gives you data from the currently running 3-hour interval (between one hour ago/two hours ahead) which should be close to the current weather. Interval 8 gives data 24 hours ahead, etc. In this dataset the maximum and minimum temperatures are the expected maximum and minimum temperature, as you would expect.

Long term weather

The long term weather forecast gives data for up to 15 days in the future, in daily intervals (refer to http://openweathermap.org/forecast16). Included in the data is the daily, morning, evening and night temperature.

The OpenWeatherMap polling is inspired by the 'openweather-apis', refer to https://github.com/CICCIOSGAMINO/openweather-apis.

Please use the forum for questions and comments related to the app: https://forum.athom.com/discussion/4225/.

Screenshots

The mobile interface looks as follows:

The pairing view:

Settings can be changed after pairing.

Flow cards

For nearly all parameters trigger and condition cards are included, see screenshot for most flowcards available for the current weather:

Requirements

To use the app, you need to get a (free) OpenWeatherMap API key at http://openweathermap.org.

«13

Comments

  • [ saved for later updates ] 
  • Hey Anne, great!
    Could you possibly also make some conditions for it? I made a OpenWeatherMapp myself a long time ago (sdk1, and very poorly written). Maybe you can steal some of the conditions as I have flows like this currently.

    https://github.com/jasperbollen/org.jb.openweathermap 
  • Nice! Actually, for a while I was waiting for you to finish the app ;-) 

    I was inspired by Athom's 'T-shirt' challenge, if you publish an SDK2 app before the 1st of december, Athom has a T-shirt for you. So this is the initial version, I do intend to add more features. I'll look at your code, thanks! And of course if you want to make PR's, by all means :+1: I am no pro, just a hobbyist getting to terms with SDK2 ;-)
  • great @anne ;
    i will test it as soon as it is available in the store!
  • Nice @anne . Works perfect
  • Hi Marco,  glad you like it  :)  

    The next version will have a verification of the API key during pairing, support for multiple locations, and some more settings for optional English weather descriptions and imperial units, and maybe some flow conditions...

    The free API allows five 3-hour forecasts per day, I guess I'll look at that as well at some point...  ;)
  • anneanne Member
    edited December 2017
    Mmm, it seems the OpenWeatherMap internationalisation leaves something to be desired when it comes to the dutch translations... The description below is supposed to be dutch, but it is in fact danish ;-) Anyway, it is an issue in the API, not the app.

    ...
    weather
    0
    id620
    main"Snow"
    description"let sne bruser"
    icon"13n"
    base"stations"
    ...
  • Nice app! Thanks...looking forward to the updates with forecasts..
  • anneanne Member
    edited December 2017
    As indicated above, an update including forecast data (up to five days, in 3-hour intervals) will be in the app store shortly. An interesting exercise with the new version is to compare the current data with the forecast data in the current 3-hour interval (interval 0, you can check the timestamp of the data in the mobile interface).

    I have noticed that OpenWeatherMap hardly ever reports rain in the current data for my location, the forecast seems closer to reality. There is not that much difference in the actual versus the forecast data when it comes to the temperature and the other parameters.

    In general I am interested to hear about the use cases/flows that you have for weather data. Let me know, and I will look at including it in a next update where I plan to add flow options. :+1:

    Update: the app (up to v0.0.6) crashes as soon as it can't resolve the OpenWeatherMap URL, for instance when the internet is unreachable. I have fixed it, the fix will be included in the next update.
  • Ik kreeg van deze organisatie volgende mail. Weet iemand daar iets meer van ?

    Your API key is blocked.
    Dear Customer,
    Your OpenWeatherMap API key 16ea2a0e42d7c5980cfbcc7dcaee509a is temporary blockeddue to the continual sufficient exceeding of the calls per minute limit by performing 8862 requests within a minute but the limit for the Free account is 60 rpm.

    To unblock your API key and restore the normal operation with the weather API we ask you to surpress the loading from your API keys or upgrade your subscription. Contact usinfo@openweathermap.org for any help with choosing the proper type of the subscription.

    Best regards,
    OpenWeatherMap team
    info@openweathermap.org
  • heb ik ook gekregen tja leuk die apps maar niet te gebruiken op deze manier tenzij je betaald
    er maar af geknikkert
  • shideban & satbopper

    Could you please keep it in English, thanks :-)
  • Possibly a bug in the app repeating API calls. 
    @anne
  • Sunrise and Sunset (shown on OpenWeather-Webpage) not included. Could this be done so that these values can used on Homey?
  • Mmm, looks like a problem with the polling interval. If it is not set the node js function will default to 1 ms. 

    However, the parameter is set to a fixed value in the app which is much higher, unless you run 20.000 instances, which I don’t think Homey is capable of...

    I haven’t heard about/from others running into this, but I will have a look. 


  • I got the same e-mail today after the auto update of the new beta!
  • jkarlenjkarlen Member
    edited December 2017
    Hi! First of all, awesome app!! finally a weather app that works great.. but need some help. I want to trigger a flow on terms if its raining or not. I get all the correct info about temperature, description of weather comment etc etc. but i don´t get a value of how much its raining. for example can the description about the weather say heavy raining and the rain meter shows 0 mm. I cant trigger a flow in homey on the description as far as i know. So, the thing am searching for is trigger a flow with question: does it rain? true or false. 
  • anneanne Member
    edited December 2017
    @satbopper it has nothing to do with paid/unpaid, it is a bug. With the unpaid API key you can make 60 API calls per minute which is plenty. I haven’t seen the issue myself, with over 100 installs it seems to be a rare occurrence.

    No need to be so negative, you don’t seem to understand that app development is driven by positive responses/constructive criticism and nothing else. 

    @CyberSponk most users use the app ‘sun events’ for the sunrise/sundown times, I don’t think it belongs in the weather app?

    @jkarlen I am glad someone likes the app ;-) I have a similar experience with the ‘current’ OpenWeatherMap data, it rarely reports rain for my location. 

    I have been running the current data in parallel with data from the forecast table (interval 0, I think it corresponds to the forecast for between 1 hour ago to two hours ahead of the current time), this seems to be somewhat more accurate, but still not really useable. 

    Note that for both the current and forecast tables rain is reported in mm/hour. 

    Anyway, fortunately the weather description is generally accurate (both current and forecast), I will add flowcards based on that (as @JasperB figured out long ago ;-))


  • CyberSponkCyberSponk Member
    edited December 2017
    @anne Only seen on the Owm-Page that they have this Information and missed them in you App ;-).
  • anneanne Member
    edited December 2017
    @CyberSponk I guess it can be used to get sunrise/sundown information for just about any location on the planet... I don’t know if anyone would ever use it, I’ll put it on the list of ‘stuff to add at some point’ ;-)

    There are some other parameters I might add later, e.g. ‘visibility’ which is only in the ‘current’ weather data. And there’s the 16-day forecast I haven’t looked into at all yet which could be added. 

    I wonder how many people are interested in a forecast beyond the 5 days that are currently possible?

    In the meantime it turns out that the standard http library I am using has a small memory leak which may affect some users, I’ll probably move to a different library first and see if this helps with the other bugs as well. 
  • anneanne Member
    edited January 2018
    Hi all,

    I have submitted an up update for the OpenWeatherMap (http://openweathermap.org/) app, hopefully it will appear in the app store shortly. As new capabilities have been added, you will need to remove your OWM sensor and create (pair) new ones.

    The app now includes data from the current weather table, the 5-day forecast (3-hour intervals) and the 16-day forecast (daily intervals). To make a clear distinction between the different sets of data I have created a 'device' for each. During pairing you can choose whether you want current of forecast data, and for the forecast data you can either choose the number of 3-hour intervals or the number of days in the future. The 16-day forecast includes morning, evening and night temperatures. 

    For each device I have defined a _lot_ of triggers and conditions. I think the condition card that triggers on the general weather category ('cloudy/rainy/clear/drizzle/misty/thunderstorm/snow/extreme') is particularly useful.

    I have optimized the polling frequency based on the update times of the data sets, and I have used a different mechanism that is less likely to cause problems. 

    @Cybersponk I have included the sunrise/sunset times (only available in the 'current' data set)  :)

    Let me know what you think.

    Update: the updated app is available in the store. :+1:
  • Hej Anne,
    I installed app this morning (about 8). It seems it have problem to get data from OpenWeatherMap - message "...pending first data"
    API test in my browser is OK.
    I rebooted Homey but still the same.

    App version: v0.0.8
    Homey Firmware Version: 1.5.6-rc.8
    Do you know what can be the problem?

  • Hi Anne,

    What does the date and time stamp In the current wheather represent?
    I noticed the presented time is lagging more than 1 hour regarding the actual time.

    Thx, Rob
  • Berna3rd, if you want to know the weather conditions at the location Homey is at, you don't need to fill in any city or zip code. These fields (actually either the city or the zip code, only one is used) you can use if you want to have weather data for another location than Homey's location.

    You get the error because the city or zip code is not in a format that is understood by the OWM API.

    OetAelse, according to the API documentation for the current weather (https://www.openweathermap.org/current) it indicates the time of the last update of the data. For the forecast data I believe it indicates the time and date for the forecast.
  • Hi, for 3 days I haven't received any data from the 5 days and 16 days forecast. Current weather works. The weeks before everything worked perfectly fine. I uninstalled everything and started new with new keys, same thing with 3/16 days, current weather works.

    Can anybody help me?

    Thanks
  • VleegeVleege Member
    edited February 2018
    I was wondering if it is possible to filter on in depth weather conditions like 'heavy rain' or 'frost'.
    Couldn't find it in the AND column card 'The weather is'. Found it on the OWM website (https://openweathermap.org/weather-conditions) although frost isn't a condition they support, fleet is, which would also an option.

    Maybe I'm just blind of maybe it isn't in the package right now. In that case I would love to see it in a future release. TiA

    I just noticed I was using the 5 day forcast in which the cards are different from the current weather. After playing around with the cards I found out that with some logic min. temperature and rain all pieces fall in place.
    Although this leaves me with one question; will a flow always notify me when weather changes? So when it is raining more than lets say 10mm/hour and it changes to 20mm/hour will the flow triggered again?
    I my logic it will... but I would like to hear it from experienced users of the OWM app.
  • @Daniel1234 all the app does is construct an openweathermap URL, and returns the result, there is no magic involved. What location are you using? Homey's location? This is based on Homey's lat/lon coordinates, and the API will always give a response (of course provided the API key is valid).

    With city/countrycode or zipcode it is a bit trickier. I haven't built in a test for the correct format. The problem is that the format depends on the country, and there may be cases where you do get a match, but it's not the one you think... For instance Cambridge, US instead of Cambridge, UK ;-)

    You can try the following URL to test the 16 day forecast. Just insert your API key:

    https://api.openweathermap.org/data/2.5/forecast/daily?q=amsterdam,nl&units=metric&lang=en&mode=json&APPID=<insert your API key here>&cnt=16

    Same for the 5 day forecast:
    https://api.openweathermap.org/data/2.5/forecast?q=amsterdam,nl&units=metric&lang=en&APPID=<insert your API key here>&cnt=16

    And you can test different locations. For cities use 'q=<city,countrycode'>. Zip codes are trickier and differ from country to country. For the Netherlands something like 'zip=1024,nl' works. In the next release I am going to 'hide' the City and Zip code settings, it seems it confuses users, most will want to use Homey's location anyway.

    @Vleege it is certainly possible. What do you have in mind?

    I didn't include all the different weather descriptions/conditions as you would get a drop-down with ~50 different options, I didn't see the point in matching nine (!) different 'drizzle' conditions... In most cases all you want to know whether it rains or freezes or there's an extreme weather event I guess? 

    The data is not that accurate to begin with, so the very specific weather descriptions are a bit like matching the temperature with a couple of decimals ('if temp = 2,34 degrees') or something like that, it doesn't really make sense I think.

    So I side-stepped this by only matching the category (thunderstorm, drizzle, rain, snow, extreme, etc.). But perhaps a shorter list of specific conditions could be useful.



  • anne said:
    I didn't include all the different weather descriptions/conditions as you would get a drop-down with ~50 different options, I didn't see the point in matching nine (!) different 'drizzle' conditions... In most cases all you want to know whether it rains or freezes or there's an extreme weather event I guess? 

    The data is not that accurate to begin with, so the very specific weather descriptions are a bit like matching the temperature with a couple of decimals ('if temp = 2,34 degrees') or something like that, it doesn't really make sense I think.

    So I side-stepped this by only matching the category (thunderstorm, drizzle, rain, snow, extreme, etc.). But perhaps a shorter list of specific conditions could be useful.
    You're certainly right. When looking at all the conditions the OWM website describes the drop down list would be too long plus making it hard to choose from. You would need a caption for every single condition describing what it means.
    I think the logic build in Homey combining with the tags you made available will do exactly what I want to achieve.
    It will come down how I manage to get just one notification at certain weather conditions when they change but this will be possible I think with some of the apps available.

    I have 2 scenarios in mind:
    1.) When it is going to freeze I would like to get a notification to unplug the submersible pump (dompelpomp) so it won't pump water through the hose, which could freeze. Later on the notification will be replaced by a switch so I won't have to look after anymore.
    2.) When it is extremely rainy (I guess >20mm/hour) I would like to get a notification to close the drain in the koekoek (say that again in English <span>:wink:</span>)

    But before all this "magic" will function just like I would like it to be I guess I will have to experiment with your app (for which I'm very happy you build (at last he says it)) and get familiar with it behavior.
  • :+1: I think it is indeed a matter of getting a 'feeling' for the accuracy and usefulness of the data from the different tables. 

    About your question:
    I was wondering if it is possible to filter on in depth weather conditions like 'heavy rain' or 'frost'.
    Couldn't find it in the AND column card 'The weather is'. Found it on the OWM website (https://openweathermap.org/weather-conditions) although frost isn't a condition they support, fleet is, which would also an option.

    Maybe I'm just blind of maybe it isn't in the package right now. In that case I would love to see it in a future release. TiA

    I just noticed I was using the 5 day forcast in which the cards are different from the current weather. After playing around with the cards I found out that with some logic min. temperature and rain all pieces fall in place.
    Although this leaves me with one question; will a flow always notify me when weather changes? So when it is raining more than lets say 10mm/hour and it changes to 20mm/hour will the flow triggered again?
    I my logic it will... but I would like to hear it from experienced users of the OWM app.
    Yes, the app will trigger a flow as soon as a parameter has changed. In your example if the rain forecast changes from 10 mm to 20 mm the flow will be triggered. 


  • Thank you very much for your help. I love the app, and in January everything worked fine. I hope I can get it started again. With Homey, the current weather works perfectly fine. 
    Now, I tested the same key with your link for the 5 days forecast. My browser shows me all the data. But when I use the key in the app, it finds the location but




    5 days forecast


    I just don't know what I do wrong. Do I need different API keys? Do I need a special one for the 5 days forecast?

    Kind regards...


Sign In or Register to comment.