genielabs / HomeGenie

HomeGenie, the programmable automation intelligence
https://homegenie.it
GNU General Public License v3.0
388 stars 154 forks source link

OpenWeatherMap and H🧞1.3-stable.6 #382

Closed tuicemen closed 1 year ago

tuicemen commented 5 years ago

@genemars Please don't take this the wrong way. 😉 This is just an attempt to make issues I reported in #378 for the OpenWeatherMap program easier to find. For users using metric most of these are irrelevant. With the new H🧞 build (1.3-stable.6)there are still a number of unresolved issues with the OpenWeatherMap program. The following are related to the metric to Fahrenheit conversion in the widget. if the user specifies not to use metric then: 1: metric symbols like °C still remain even though temperature values change correctly. 2: Wind speed values nor symbol (km/h) ever change . 3: the min and maximum temperatures for the three day forecast are the same and still report °C 4: rain/snow values remain in metric in the widget as does the symbol(mm)

Other issues 1: (marked as enhancement in issue #378 )Although HG is capable of displaying Humidity values in the UI and for macros (scripts), the OpenWeatherMap program currently doesn't collect these the program is missing two lines (which if add allow both to work) 2: All values are not converted to imperial messures for using with other programs or scripts (they remain in metric)

For users needing the humidity values for scripts (macros) and such, attached is a working OpenWeatherMap program with the humidity code added.😎 34-OpenWeatherMap.zip For users wishing to change the °C symbol in the widget to °F here is how to do that.😎 1: Go to configure/widgets and click on homegenie/environment/weather 2: Select the java code and scroll to line 74 3: Change ℃ to ℉ 4: Do the same for lines 88 & 89

genemars commented 5 years ago

cool, you found an emojii for HG :smile:

tuicemen commented 5 years ago

I thought you'd get a kick out of that!😄

tuicemen commented 5 years ago

Playing around with the open weather map API I see now why the min max vales are the same and not reporting what I expected . It appears the current weather API is being used here which supplies different info for temperature max and min then what the daily forecast API does Quote from Open Weather API

Please, do not confuse min/max parameters in current weather API and forecast API. In current weather API temp_min and temp_max are optional parameters mean min / max temperature in the city at the current moment to see deviation from current temp just for your reference. For large cities and megalopolises geographically expanded it might be applicable. In most cases both temp_min and temp_max parameters have the same volume as 'temp'. Please, use temp_min and temp_max parameters in current weather API optionally.

tuicemen commented 5 years ago

I've added a pull request to at least fix the humidity display issue. While trying to work out the 3 day Hi/Low values I also added a fetch for the current day Hi/low temperature values.

tuicemen commented 5 years ago

Since the forecasted daily hi and low temperatures are always the same I started to play a bit more with the API. seems the daily temperature is also reporting the same as the hi/lows. The issue is how the API is reporting. I thought about replacing the forecasted hi/lows with forecasted temperature and humidity. I was able to do this as seen here: HiLowFix This requires some simple changes to the widget and program So if this is acceptable to the users I'll put in a pull request with the relevant changes.

andros19 commented 5 years ago

Since it would be absolutely useless to have the same temperature reported as low temperature I believe that what you have done is much better than before. Therefore it would be very nice to share this with all the users. Thanks for keeping up with the work.

On Wed, May 15, 2019, 17:06 Tuicemen notifications@github.com wrote:

Since the forecasted daily hi and low temperatures are always the same I started to play a bit more with the API. seems the daily temperature is also reporting the same as the hi/lows. The issue is how the API is reporting. I thought about replacing the forecasted hi/lows with forecasted temperature and humidity. I was able to do this as seen here: [image: HiLowFix] https://user-images.githubusercontent.com/25393840/57781553-70538700-76f8-11e9-870a-1fcf74ab60ca.png This requires some simple changes to the widget and program So if this is acceptable to the users I'll put in a pull request with the relevant changes.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/genielabs/HomeGenie/issues/382?email_source=notifications&email_token=AHMYWP3QQTO5RFE3MUHTEEDPVQKFXA5CNFSM4HGIRWCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODVOYUNA#issuecomment-492669492, or mute the thread https://github.com/notifications/unsubscribe-auth/AHMYWPZ4IHS263AEVNMTQMDPVQKFXANCNFSM4HGIRWCA .

tuicemen commented 5 years ago

I'll do a bit more tweaking with the code as I just noticed I do have a error popping up about not finding a min. This doesn't stop things from working it is just annoying as soon as I pin point that I'll post the changes.

tuicemen commented 5 years ago

Ok got rid of the error. for those not wishing to wait for this to get implemented into HG you need to edit the OWM Program and add this line: Program.Parameter("Conditions.Forecast." + day + ".Humidity").Value = data.humidity; after the line: Program.Parameter("Conditions.Forecast." + day + ".Temperature").Value = data.temperature; note: these additions need the previous changes I included in the above 34-OpenWeatherMap zip file OWM Widget changes: The changes to the widget HTML are: change ▼ in lines #50, 71 and 92 replacing that with 🌫️ The JavaScript code changes are: replace line 84 with: var Humidity = HG.WebApp.Utility.GetModulePropertyByName(module, 'Conditions.Forecast.' + f + '.Humidity').Value; replace line 85 with:
humidity = parseFloat(HG.WebApp.Utility.GetLocaleTemperature(parseFloat(Humidity.replace(',','.')))); replace line 88 with: widget.find('[data-ui-field=forecast_' + f + '_tmin]').html(Humidity + '%');

I've added the Program code to a current pull I've requested. Once I find where the code for widgets is located in HG Code I'll create a pull request for that as well. Since there is no road map that I'm aware of so it may take me some time to find it's location.

Note: the widget code supplied doesn't include the temperature thermometer but keeps the current up arrow

tuicemen commented 5 years ago

Ok that wasn't to difficult to find. I added the changes to the files and added the changes to the pull request. Once /if the pull is implemented most issues reported here will be resolved.

andros19 commented 5 years ago

I have done the changes as instructed and the result was exactly as promised. Great work. !!👍

Now remains to change the HomeGenie Plus app but I gues this can be done only by @genemars since the code for the app is still not available.

Στις Τετ, 15 Μαΐ 2019 στις 10:01 μ.μ., ο/η Tuicemen < notifications@github.com> έγραψε:

Ok that wasn't to difficult to find. I added the changes to the files and added the changes to the pull request. Once /if the pull is implemented most issues reported here will be resolved.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/genielabs/HomeGenie/issues/382?email_source=notifications&email_token=AHMYWP32QONALMMVD7JFG23PVRMYVA5CNFSM4HGIRWCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODVPUHHI#issuecomment-492782493, or mute the thread https://github.com/notifications/unsubscribe-auth/AHMYWP5G4J5WIPJPF7MZ62DPVRMYVANCNFSM4HGIRWCA .

tuicemen commented 5 years ago

@andros19 Glad to see my write up was easy to follow and you had success.

The Plus app seems to be pulling the min value from somewhere else as it never matched what the server was reporting. @genemars seems to be MIA at present hopefully it won't be long before he is active again.

tuicemen commented 4 years ago

The weather widget is one of the first things new users notice with Home Genie. However with some things not displaying correctly even after a api key setup many new users look at it as just window dressing. Since this widget and program is a show case I'm a bit dissapointed that it has still failed to be updated even with a couple of pull requests added.

mralapete commented 4 years ago

I wouldn’t get too disappointed about an author choosing not to include a PR. If you look at previous PR’s not all were included for one reason or another. If demand dictates changes or the author deems it so the PR is implemented You are free to change your own setup locally of course so it’s not a major issue for you.

tuicemen commented 4 years ago

The PRs not being implemented doesn't bother me if they are simply adding features. However if they include bug fixes that part at least should be looked at. Maybe I miss understand the idea behind pull requests these include the code to save the author time and make easy implementation of fixes and or features.

mralapete commented 4 years ago

Possibly and it was marked as a bug but it was less than a month ago since you made the PR. Patience is one thing you learn when it comes to HG.

You may want to post your PR at https://github.com/Bounz/HomeGenie-BE the version I use where things are a little more active but again weather isn’t a big thing there either as that version is still using WU.

Personally I don’t really use the weather function like that and many users don’t either.

tuicemen commented 4 years ago

Check the date again on my PR. It was last year but thats irrelevant. The weather function is more popular then you think, at least with the X10 crew. When I was programing x10 HA programs and AHP addons weather triggering was a popular request.
I'm not worried about the speed things get fixed with the code nor wish to come off as demanding things get implemented hope my post doesn't come off like that.

mralapete commented 4 years ago

Indeed but not very popular with the main core of HG users as can probably be seen from the GitHub and the HomeGenie Club and clearly not a priority for the author as you mentioned it was in fact April 2019 when you posted your PR.

At least you can implement your own changes locally. That’s the beauty of HG.

Speaking of X10 thanks to another poster we’ve discovered an issue with X10 which I’m currently amending, building and recompiling. All I’ll have to do is drop the recompiled file into a local folder and it’s good to go. When I get around to it I’ll do a PR and maybe if Gene approves it he’ll include it in his next release.