Please login or register.

Login with username, password and session length
Advanced search  


The Buster PiX10Hub is here! Created by the Community, for the Community.:)% #:)

Author Topic: Updated Weather Program and Widget  (Read 651 times)


  • Hero Member
  • *****
  • Helpful Post Rating: 3
  • Posts: 333
Updated Weather Program and Widget
« on: May 22, 2020, 07:00:14 AM »

Good morning all,

I have been messing around with the standard Weather Widget and associated program for the last several weeks.  I had noticed an issue where the forecast for the left most column would be off later in the afternoon (it was advancing to the next day).  There is a post elsewhere that gets into some of the details, but I wanted to share what I have now with people in case they wanted to try this out and provide any feedback.

My updated version provides 3 separate forecasts for each day - morning, afternoon and evening.  This data still comes from OpenWeatherMap.  The standard widget uses the 12pm (noon) time to get the forecast data.  My version allows you to pick between 2 times for each of the daily forecasts:
morning = 6am or 9am
afternoon = noon or 3pm
evening = 6pm or 9pm

Note: The hourly data provided by OpenWeatherMap is every 3 hours, starting at midnight (so midnight, 3am, 6am, 9am, etc).

My version also starts with today, at least while the forecast data for today is still available whereas the standard widget starts with tomorrow, and once past noon it would advance to the following day (the Last Update date on the bottom of the widget would actually display tomorrow's date when this happens, even though its still today).

When the forecast data for today (morning or afternoon) is no longer available, that area in the widget will appear blank.  The attached image shows this for the morning forecast for today.  Once the evening forecast data is not available, then it is advanced to the following day (and the other 2 days also move forward 1 day).

Note: if you look at the code, there are a number of debugging widget DIVs and Program.Notify calls that I commented out but left in the code, if you uncomment those you can see the date/time each forecast for each day was last updated, as well as an option for Debugging mode which allows you to see what date/time for the forecast data is matched with the displayed day.  There are 9 days of data, 1-3 are the morning, 4-6 are the afternoon and 7-9 are evening.  Going to Configure / Widgets and pulling up the new Weather Widget (homegenie/generic/weather) and then click the hamburger icon next to the "bind to module" will allow you to see the Debug fields as long as the Debug option is enabled.

Other Changes:
1) I use the same humidity icon on the widget as HG does on the Dashboard, it looks like 2 raindrops.
2) I am displaying the feels like low forecast temp (there is a known issue with the OpenWeatherMaps data where the high and low temps are the same - no idea why, but there is no getting around it).  The icon for the forecast low is the down arrow followed by ~ to attempt to identify its an approximate low.
3) the current forecast string has been updated to displayed as mixed case as opposed to lower case:  So "Clear Sky" and not "clear sky", no particular reason other than it bugged me.
4) There is a new Widget option for "Fahrenheit Enable" - this will correctly (I believe) allow the display of C or F data and icons without the need to update the standard widget code (a reported bug).
5) There is a new Widget option for "Temperature Rounding Enable" - if set, it will round and truncate the temp values to whole numbers.
* the display of the temperature in the HG Dashboard while using the widget data is done in its own code, I attempted to correct the issue of rounding / truncating with this same change but not convinced it worked, there is a post on the HG board with info on how to make the change to the system programs to round that temp if needed.  Also, the conversion of the temp for F vs C is also in the HG programs, so I had to essentially leave the retrieval of the temperature field used by HG in place and use a new set of fields for the widget, where the widget specific ones are based on the imperial or metric based on the choice of the Fahrenheit enable whereas the HG used ones are always metric and then converted.
6) Precipitation Rate option was intended to allow for user choice if the precipitation info was based on the 1h or 3h values - unfortunately we have not had recent rain for me to verify this but it should work.
7) I mentioned the forecast time options above already (morning, afternoon and evening time choices)
8) The Precipitation Last 3 Days option currently does not do anything (I was / am working on a way to try and display the precipitation for the last 3 days, thought it would be useful this time of year as I need to monitor how I water my lawn).

I think that's it - the code for the program and the widget, while still mostly based on the original, has been cleaned up with my changes and I tried to comment where it made sense to help explain things.

Last note:  If you upload this new program it will be program number 1030 and I added "Soxfan1966 version" to the name.  Its possible for you to have both the standard and my version running (I still have the original version installed but not running).  If you chose to inactivate the standard one, and you use tuicemen's Weather Alerter program then you will need to update that so that it references the new version of the weather program.

I am also going to post this over on the Home Genie Club Forum.  Feedback and suggestions welcome.

Thanks :)

Once downloaded, rename the attached files as follows so you can import them into HG:
1) homegenie_weather_generic.txt to
2) 1030-OpenWeatherMap_-_Soxfan1966_Version.txt to 1030-OpenWeatherMap_-_Soxfan1966_Version.hgx


  • Administrator
  • Hero Member
  • ****
  • Helpful Post Rating: 272
  • Posts: 10111
  • I don't work for X10, I use it successfuly!
    • Tuicemen Forum
Re: Updated Weather Program and Widget
« Reply #1 on: May 22, 2020, 08:19:35 AM »

Nice work! Thanks for sharing. #:)
Please Read Topic:
General Forum Etiquette
Before you post!

Find extra info @ My forum | About X10 | X10 Security Systems | Cameras| Package Deals
© Copyright 2014-2016 All rights reserved.