Please login or register.

Login with username, password and session length
Pages: [1] 2 3

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

soxfan1966

  • Hero Member
  • *****
  • Helpful Post Rating: 3
  • Posts: 388
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 homegenie_weather_generic.zip
2) 1030-OpenWeatherMap_-_Soxfan1966_Version.txt to 1030-OpenWeatherMap_-_Soxfan1966_Version.hgx
Logged

Tuicemen

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

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

mike

  • Hero Member
  • *****
  • Helpful Post Rating: 14
  • Posts: 1057
Re: Updated Weather Program and Widget
« Reply #2 on: December 16, 2020, 02:55:17 PM »

Hi Soxfan,

I would like to try your program!  My std HG openweathermap program works so I have basic setup stuff right.

I imported your .hgx program and imported the .zip to widgets page and although I cannot see it in the list, it did allow your widget module to be added to one of my groups. 

I am not sure, but I think openweathermaps may need 'location' in addition to my API key?  I see you seem to program asking for location in the startup page of the program, but I cannot find anywhere to enter it?  So it is not working yet.

In addition, there seems to be some error message popping up in white box on left top of screen when I try to change settings, but I have not yet found a way to bring it on the creen - only a small portion of the box shows?

Hate to bother you with this but your changes look great and I want to add them if I can!

Thanks.
Logged

soxfan1966

  • Hero Member
  • *****
  • Helpful Post Rating: 3
  • Posts: 388
Re: Updated Weather Program and Widget
« Reply #3 on: December 16, 2020, 04:04:31 PM »

I may need to upload the most recent version of the program and widget but the both should show up in the lists if you added them.  Do you also have the jk utils solar utility program ?
Logged

mike

  • Hero Member
  • *****
  • Helpful Post Rating: 14
  • Posts: 1057
Re: Updated Weather Program and Widget
« Reply #4 on: December 16, 2020, 04:28:38 PM »

I HAD jk utils on zero w HG system but recently updated to pi4 and I did not add it - I will!  tnx
Logged

mike

  • Hero Member
  • *****
  • Helpful Post Rating: 14
  • Posts: 1057
Re: Updated Weather Program and Widget
« Reply #5 on: December 17, 2020, 11:14:38 AM »

I may need to upload the most recent version of the program and widget but the both should show up in the lists if you added them.  Do you also have the jk utils solar utility program ?

I installed prog34 openweathermap and that loaded jk utils.  It shows up in the widget list now;  it said it downloaded info correctly, and shows data when I added the widget to my group.

openweathermap still is working and downloading its weather information.

I cannot get your program to work yet...  a couple clues:

1) when I restart it from its settings page it pops up that white box, mostly offscreen, at top left telling what error but it is too far off screen to read anything other than "read 'property value of" and then a blue "20" on next line?

2) Looking at your widget in widget directory or in group, I see it is not changed to F, is is not rounded numbers as I set in settings, so it seems the program is not working correctly?

Would you mind sending your latest version?  Thank you very much!
Logged

mike

  • Hero Member
  • *****
  • Helpful Post Rating: 14
  • Posts: 1057
Re: Updated Weather Program and Widget
« Reply #6 on: December 18, 2020, 11:14:00 AM »

Soxfan1966, Would you mind sending your latest version?  Thank you very much!
Logged

soxfan1966

  • Hero Member
  • *****
  • Helpful Post Rating: 3
  • Posts: 388
Re: Updated Weather Program and Widget
« Reply #7 on: December 18, 2020, 11:45:00 AM »

Mike,

I have attached my latest program and widget (note that the widget needs to point to my version of the weather program too).

NOTE: The homegenie_generic_weather.txt file needs to be renamed homegenie_generic_weather.zip, and the 1030-OpenWeatherMap_-_Soxfan1966_Version.txt file needs to be renamed 1030-OpenWeatherMap_-_Soxfan1966_Version.hgx before importing them into HomeGenie.
Logged

mike

  • Hero Member
  • *****
  • Helpful Post Rating: 14
  • Posts: 1057
Re: Updated Weather Program and Widget
« Reply #8 on: December 19, 2020, 12:33:47 PM »

So I installed your latest from last post:  still same error I think.  This time I could find it:  clicking on the widget in the widget directory, I can see the whole error message:

TypeError:  Cannot read
'property VALUE' OF NULL:
lINE 7313, COLUMN 20

But your program only has 315 lines?

It shows the error is line 315...  I have never seen those [] brackets used before so I deleted it and its mate on line 1...  then line 3 showed error...  so I commented it out then line 5, then ditto and about every 3rd line showed error as I commented until I could not comment anymore as it got into real code...

Do you think this is something to do with pi4?

Logged

soxfan1966

  • Hero Member
  • *****
  • Helpful Post Rating: 3
  • Posts: 388
Re: Updated Weather Program and Widget
« Reply #9 on: December 19, 2020, 12:36:28 PM »

What are your settings for the program / widget as well asmthe jk.utils program ?
Logged

mike

  • Hero Member
  • *****
  • Helpful Post Rating: 14
  • Posts: 1057
Re: Updated Weather Program and Widget
« Reply #10 on: December 19, 2020, 12:59:25 PM »

Can't find where I entered the JKutil data but I will show its widget in next post.

Hmmm...   I just caught yours posting a message for 5 sec saying it is not configured?  Not sure where to config other than the wheel icon in the group - as I said before, it does not ask for location like JKutil and the orig weather one does...
Logged

soxfan1966

  • Hero Member
  • *****
  • Helpful Post Rating: 3
  • Posts: 388
Re: Updated Weather Program and Widget
« Reply #11 on: December 19, 2020, 01:00:47 PM »

I think the jk.utils settings may be under the Maintenance settings - it's the lat and lon.
Logged

soxfan1966

  • Hero Member
  • *****
  • Helpful Post Rating: 3
  • Posts: 388
Re: Updated Weather Program and Widget
« Reply #12 on: December 19, 2020, 01:01:34 PM »

You are missing the API key setting too
Logged

mike

  • Hero Member
  • *****
  • Helpful Post Rating: 14
  • Posts: 1057
Re: Updated Weather Program and Widget
« Reply #13 on: December 19, 2020, 01:04:13 PM »

guess I can try copying the 10 pages of settings that show 3 at a time like shown if that would help? (top 2 are from your program) last one is from JKutil (shows part of my API key)
Logged

mike

  • Hero Member
  • *****
  • Helpful Post Rating: 14
  • Posts: 1057
Re: Updated Weather Program and Widget
« Reply #14 on: December 19, 2020, 01:05:15 PM »

I think the jk.utils settings may be under the Maintenance settings - it's the lat and lon.

lat/long is set.
Logged
Pages: [1] 2 3
 

X10.com | About X10 | X10 Security Systems | Cameras| Package Deals
© Copyright 2014-2016 X10.com All rights reserved.