Author Topic: [Release] LH_Weather (v1.30)  (Read 56928 times)

Triscopic

  • Moderator
  • Hero Member
  • *****
  • Posts: 729
  • ˙ǝıl ɐ sı ǝʞɐɔ ǝɥʇ
[Release] LH_Weather (v1.30)
« on: 2010-10-30 23:02:34 »
(You must be logged in to view these screen shots and download the plugin)
LH_Weather
Latest Version: 1.30

Desciption:
LH_Weather is a plugin that provides weather connectivity for LCDHost. Drawing it's feed from Yahoo! weather the plugin is able to display all the information you might expect in either Metric or Imperial measures. Additionally you can display weather & time related images.

Here are two screenshots of the same theme, the only thing edited was the location (so as to shift from day to night without waiting for dawn!)

Night time in London:Day time in LA:

Each item of text show on the weather panel is a separate object and can be positioned anywhere. The images (including the background) are also controlled by the plugin, and can be made to vary by weather type and time (either day or night). Additionally you can ignore the weather component and simply set up an LH_WeatherImage to change only on a day/night cycle allowing you to create backing panels or even, as shown here, replace your entire background dynamically.

Download
(Download disabled as the current version is bundled with LCDHost)

The zip file includes the source code and two icon "sets" (the standard Yahoo! weather images and the standard Yahoo! background bar) each with it's own definition file. Many more weather icon sets are available from www.deviantart.com or generally on the web (e.g. http://www.webresourcesdepot.com/free-weather-icons-collection/)
« Last Edit: 2011-05-18 22:13:49 by Triscopic »

Triscopic

  • Moderator
  • Hero Member
  • *****
  • Posts: 729
  • ˙ǝıl ɐ sı ǝʞɐɔ ǝɥʇ
Re: [Release] LH_Weather
« Reply #1 on: 2010-10-30 23:02:48 »
Known Issues:
The plugin currently requires a direct connection to the internet to function, i.e. it will not work if you have to go through a proxy. I am looking into fixing this limitation.

Usage guide:
This plugin is not quite as simple as the other "drag-drop-display" plugins included in LCDHost. Here is a simple guild to get you displaying weather on your G19.

1. Firstly make sure you've installed the plugin. Put the dll file in your LCDHost's plugin folder then open the plugins tab, select the dll from the list and tick the "Allow this plugin to load" box, then press load. In future LCDHost will remember that you've chosen to trust this plugin and will load it automatically, although if you need to patch it later you will need to re-tick this box.

2. Next extract the images set folders included in the package. Ideally you'll want to create your own set later on, in which case you should be able to use the included imagemap.txt files as a template. In any case you can place these icon sets anywhere you like, but I recommend placing them in the theme folder you intend to use.

3. Open LCDHost and go to the layout designer window. Expand the weather list in the classes box, and add a weather connector. You really should only add one weather connector to a layout.

4. Type your location into the location box. The box below it will display the best match for what you have currently typed in. If you're not getting the right answer (for example if you live in Perth, Perthshire, Scotland the best fit for just "Perth" will be quite a few miles away), just keep typing. Usually "city name" or "city name country" is enough, but state / region / county can help.

5. Once your desired location is displayed, select your units (Metric or Imperial) then drop a Weather Text object on the layout. You can add it anywhere (there is no need to make everything a child of the connector, although this does help when you want to maintain the layout). New text items default to showing the city name. Leave this and add a second text box and this time change the value type to "Wind: Chill" - this is the "feels like" temperature outside, i.e. the temperature taking into account the wind chill factor, right now (according to Yahoo, anyway).

6. Now add a Weather Image object. These are a little trickier as they require you to have correctly set up an icon set. In step 2 you extracted two working set from the LH_Weather download file, so for now you don't need to worry about making a working "set".

  • Your new icon should already be showing a message in the grey box below the "File" setting, something like "Weather Code 11 received for Day; resolved to image:" this text tells you the image is already picking up weather codes from yahoo (via the connector) and is working out whether it's day or night (using the sunrise/sunset data from Yahoo). All it needs is a way to combine the code and the time of day into a choice of image. This is the purpose of the image map file.

7. Click the browse button ("...") next to the file box and find the "Yahoo! Icons" set. Select the imagemap.txt file in this folder. Immediately an icon will appear in the window (resize it now to make it bigger), and you'll notice that the feedback box now shows an image name after the "resolved to:" text, indicating the weather code & day/night combination has been found in the list.

Congratulations you now have live weather information on your G19 screen.

Useful hints:
  • I recommend keeping icon sets in their own folder. There are 48 weather codes, so you could easily have almost 100 icons in a set.
  • Image map files need to be in the same location as their images. The file can be called whatever you like.
  • Creating an image map is easy. I would suggest you start from the example map in Yahoo Icons, but basically you just need a code, a day image name and a night image name each separated by a tab and each on it's own line. I prefer to create them in excel and save to tab-seperated text file, but whatever works for you.
  • The image map file uses a semicolon ";" to denote comments. It's quite helpful to include the weather code's meaning at the end of each line after a semi-colon.
  • The weather code 3200 is the standard code for "weather is undefined". If no image can be found for a certain code in the definition file, the weather image object will then try to find a code for 3200 and display that before giving up and showing no icon. This means if you just want to use a single day/night icon you can just define icons for the 3200 code only.
  • More information on the weather codes can be found on Yahoo's weather api page
« Last Edit: 2010-11-13 17:44:49 by Triscopic »

Voxicles

  • Jr. Member
  • **
  • Posts: 71
  • Mhmm
Re: [Release] LH_Weather
« Reply #2 on: 2010-10-30 23:23:31 »
Looks amazing!

Hmm, I'm having trouble getting it to work correctly.  I'm only getting my location, and no weather information, i have the connector as the parent, and then the image and text as children, I set the image location to one of the images you included, but nothing shows up :(
« Last Edit: 2010-10-31 04:33:46 by Voxicles »
- Vox

Founding Member - Final Encounter Gaming - FinalEncounter.net

SirReal

  • Administrator
  • Hero Member
  • *****
  • Posts: 735
    • linkdata.se
Re: [Release] LH_Weather
« Reply #3 on: 2010-10-31 08:56:05 »
Attachment size restrictions have been upped to 5MB.

Ender91

  • Sr. Member
  • ****
  • Posts: 336
  • Alpha & Omega
Re: [Release] LH_Weather
« Reply #4 on: 2010-10-31 10:25:58 »
Awsome! Exactly what I was wondering for....

@ Voxicles: to display the image chowing the current weather, you have to selecte the .txt in the folder, which resolve the requested picture and the availlable one (i think...).

Triscopic

  • Moderator
  • Hero Member
  • *****
  • Posts: 729
  • ˙ǝıl ɐ sı ǝʞɐɔ ǝɥʇ
Re: [Release] LH_Weather
« Reply #5 on: 2010-10-31 12:12:29 »
Yes, it was getting late when I released this so I didn't have time to write the guide which is now up. If you're selecting an image file, it won't work. You need to select the image map file (in my examples this is called "imagemap.txt"), this tells the weather image what images to load in for each combination of status code and day/night time.

SirReal

  • Administrator
  • Hero Member
  • *****
  • Posts: 735
    • linkdata.se
Re: [Release] LH_Weather
« Reply #6 on: 2010-10-31 12:17:30 »
This is quite impressive looking. Well done.

Triscopic

  • Moderator
  • Hero Member
  • *****
  • Posts: 729
  • ˙ǝıl ɐ sı ǝʞɐɔ ǝɥʇ
Re: [Release] LH_Weather
« Reply #7 on: 2010-10-31 12:31:09 »
Thanks. It was a lot of work, and I am quite pleased with it.

Voxicles

  • Jr. Member
  • **
  • Posts: 71
  • Mhmm
Re: [Release] LH_Weather
« Reply #8 on: 2010-10-31 17:54:40 »
Ah, thanks for the walkthrough.  I've got it working beautifully now.  I suppose i could have figured it out eventually, but I was tired :p  Thanks for all your hard work.  I'm sure SirReal likes the help a lot also!
- Vox

Founding Member - Final Encounter Gaming - FinalEncounter.net

Triscopic

  • Moderator
  • Hero Member
  • *****
  • Posts: 729
  • ˙ǝıl ɐ sı ǝʞɐɔ ǝɥʇ
Re: [Release] LH_Weather (v1.1)
« Reply #9 on: 2010-11-03 18:48:26 »
Updated to v1.1
Changes:
  • Fixed Weather Image memory leak
  • Added 5-Day forecast data from an undocumented Yahoo feed. Thanks Yahoo. Thanks.
  • Added ability for Weather Image objects to display either current conditions or the summary condition from the 5-Day forecast. 5-Day forecast images do not use the day/night cycle, they stay with the day image.
  • Added optional "Open in browser" button binding; bind a key and when pressed the full yahoo forecast page will open in your default browser
« Last Edit: 2010-11-03 18:54:39 by Triscopic »

Jarth

  • Newbie
  • *
  • Posts: 21
Re: [Release] LH_Weather (v1.1)
« Reply #10 on: 2010-11-03 21:32:22 »
Great work m8.

Got it working now, just about perfect. (Doubted they would have any info online for Greenland, but goes to show. ;) )

Found a problem with the connector. When writing my location, i started with "Nuuk Greenland".
Got all the right info, except the images. Did not get the right Weather code's..

By changing the location-text to: "Nuuk, Greenland", it shows the Current Conditions perfect, though still lack the prognosis.


« Last Edit: 2010-11-03 21:44:49 by Jarth »

Triscopic

  • Moderator
  • Hero Member
  • *****
  • Posts: 729
  • ˙ǝıl ɐ sı ǝʞɐɔ ǝɥʇ
Re: [Release] LH_Weather (v1.1)
« Reply #11 on: 2010-11-03 22:37:20 »
The key question is what does it say in the grey-ed out box below lo0cation (this is the "best guess" location from what you've typed in). For me both "Nuuk Greenland" and "Nuuk, Greenland" behave the same (as they should), and both display "Nuuk, Greenland" in the grey box. Indeed, I've bound one of my unused G-keys to the weather and pressing that key opens up yahoo's weather forecast and it all matches fine.

The only thing I can think of is that perhaps you're getting a delay between pulling down the standard forecast feed and the 5-day feed.

Basically yahoo only publish api information and support for the basic weather feed (today & tomorrow). But, if you know what to look for in the response for the basic feed you can pull out enouh data to then download a second feed containing the full 5-day data. This means there can be a short delay between getting the initial data and the remaining 3 days. Do you have a slow connection? Are you getting stuck on the "N/A" icon for days 3, 4 & 5 or is it getting data eventually?

P.S.: I'm ashamed to say that until today I had no idea people lived in Greenland. According to wikipedia you're sort of Danish but colder cooler. Is that right?
« Last Edit: 2010-11-03 23:30:41 by Triscopic »

Triscopic

  • Moderator
  • Hero Member
  • *****
  • Posts: 729
  • ˙ǝıl ɐ sı ǝʞɐɔ ǝɥʇ
Re: [Release] LH_Weather (v1.1b)
« Reply #12 on: 2010-11-03 23:29:56 »
Ok, I've made a small update...

Updated to v1.1b
Changes:
  • The icon for 5-Day forecast for "Today" now changes to a night time icon after sunset, just like the Yahoo weather pages do.
  • Removed a number of debug messages
  • Fixed a bug preventing the change of units triggering an update
  • Added two new entries to the Weather Text list
    • Day 1: "Today/Tonight" - this will display either "Today" or "Tonight" debending on the time of day
    • Day 2: "Tomorrow" - this just displays the static text "Tomorrow".
    Note that due to limitations within the drop down list this will mean that other 5-Day forecast weather text items will display the wrong thing after this update. You just need to change the selected item back to what it should be and re-save the layout to fix this, so it's no big deal.

Jarth

  • Newbie
  • *
  • Posts: 21
Re: [Release] LH_Weather (v1.1)
« Reply #13 on: 2010-11-04 00:25:57 »
The key question is what does it say in the grey-ed out box below lo0cation (this is the "best guess" location from what you've typed in). For me both "Nuuk Greenland" and "Nuuk, Greenland" behave the same (as they should), and both display "Nuuk, Greenland" in the grey box. Indeed, I've bound one of my unused G-keys to the weather and pressing that key opens up yahoo's weather forecast and it all matches fine.

The only thing I can think of is that perhaps you're getting a delay between pulling down the standard forecast feed and the 5-day feed.

Basically yahoo only publish api information and support for the basic weather feed (today & tomorrow). But, if you know what to look for in the response for the basic feed you can pull out enouh data to then download a second feed containing the full 5-day data. This means there can be a short delay between getting the initial data and the remaining 3 days. Do you have a slow connection? Are you getting stuck on the "N/A" icon for days 3, 4 & 5 or is it getting data eventually?

P.S.: I'm ashamed to say that until today I had no idea people lived in Greenland. According to wikipedia you're sort of Danish but colder cooler. Is that right?

Thx m8.
Think your right on the delay. But Greenland being Greenland, i take what i can get. ;) The forecast for day 1 and day 2 come on and off, again, Greenland might not be the ideal place for testing. ;)

Hehe, no problem mate. If it were not for Greenland being "ruled" or rather inside the Danish commonwealth for so many years, i would not know what to find here either.

SirReal

  • Administrator
  • Hero Member
  • *****
  • Posts: 735
    • linkdata.se
Re: [Release] LH_Weather (v1.1b)
« Reply #14 on: 2010-11-04 08:05:06 »
Note that due to limitations within the drop down list this will mean that other 5-Day forecast weather text items will display the wrong thing after this update. You just need to change the selected item back to what it should be and re-save the layout to fix this, so it's no big deal.

I think I know what's going on, and I think it's a bug. LCDHost shouldn't be saving all the entries, just the selected one, so it can match up that one on load if it exists.