Weather Underground Plugin

Questions and comments specific to a particular plugin should go here.
User avatar
kgschlosser
Site Admin
Posts: 5394
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Weather Underground Plugin

Post by kgschlosser » Wed Apr 05, 2017 5:40 pm

all i have left to the coding is to do a little more parsing of the data.

But this is how it is going to function. when you run an action it will do 2 things. it is going to trigger an event where the payload is a formatted string output. and it will return either the actual data received from WU or an object class that represents the data.
The object class is nice because you can do things like... obj.Forecast.Monday_Night.Imperial and it will return that forecast. or if you want to get the forecast for the whole week. obj.Forecast.GetData(str) will return a formatted string of all of the forecasts but you can use dict and it will return a dictionary. or list, tuple or you can even specify your own formatter if you like the data passed to the formatter is a list. and you can also have it update. simply by calling obj.Update() and it doesn't matter what tier you are in. so obj.Forecast.Monday.Update() works all the same. and it will update that current object.

I hope to be releasing a beta of it this evening if all goes well. I am going to add a polling option so it will automatically generate events if the data has changed. tho you are only allowed to make 10 requests per minute i think for free. but I do think that is more then enough.

I also have already done the legwork and had my parser grab any url's for icons and make the connection and downloaded them and turned them into a file like object. so if someone wanted to use them for something like the webserver plugin they are all set to go. or if you wanted to display it on the screen. you can very easily.

There is something really cool that i added that I am not going to tell about. it's a surprise

here are the features it has support for

Code: Select all


Location:
    lat/log
    country/city
    state/city
    zipcode
    airport code
    personal weather station

Features:
    Alerts
    Almanac
    Astronomy
    Conditions
    CurrentHurricane
    Forecast
    Forecast10Day
    Geolookup
    History
    Hourly
    Hourly10Day
    RawTide
    Tide
    Webcams
    Yesterday

languages:
    Afrikaans
    Albanian
    Arabic
    Armenian
    Azerbaijani
    Basque
    Belarusian
    Bulgarian
    British English
    Burmese
    Catalan
    Chinese - Simplified
    Chinese - Traditional
    Croatian
    Czech
    Danish
    Dhivehi
    Dutch
    English
    Esperanto
    Estonian
    Farsi
    Finnish
    French
    French Canadian
    Galician
    German
    Georgian
    Greek
    Gujarati
    Haitian Creole
    Hebrew
    Hindi
    Hungarian
    Icelandic
    Ido
    Indonesian
    Irish Gaelic
    Italian
    Japanese
    Javanese
    Khmer
    Korean
    Kurdish
    Latin
    Latvian
    Lithuanian
    Low German
    Macedonian
    Maltese
    Mandinka
    Maori
    Marathi
    Mongolian
    Norwegian
    Occitan
    Pashto
    Plautdietsch
    Polish
    Portuguese
    Punjabi
    Romanian
    Russian
    Serbian
    Slovak
    Slovenian
    Spanish
    Swahili
    Swedish
    Swiss
    Tagalog
    Tatarish
    Thai
    Turkish
    Turkmen
    Ukrainian
    Uzbek
    Vietnamese
    Welsh
    Wolof
    Yiddish - transliterated
    Yiddish - unicode
If you like the work I have been doing then feel free to Image

loveleejohn
Experienced User
Posts: 133
Joined: Thu Dec 10, 2015 12:09 am

Re: Weather Underground Plugin

Post by loveleejohn » Thu Apr 06, 2017 11:18 pm

So I get kidnapped by life for a day and come back to this suspenseful tale! I'm at the edge of my seat on this one. Vera's usefulness is rapidly beginning to fade. Lol!

User avatar
kgschlosser
Site Admin
Posts: 5394
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Weather Underground Plugin

Post by kgschlosser » Fri Apr 07, 2017 12:21 am

LOL that it is... The only things I had left other then the lights on the Vera is my Honeywell thermostat. Which a while back I did manage to get to connect and to operate from EG directly. I just never went any further with making a nice interface for it because I had the Vera Plugin and someone released a plugin for the Vera. Tho it did take me modifying a bunch of it to actually get it working, and this is the reason why I am pissed off about the Vera dropping out on me again. Because I got that plugin running a year ago, and for the life of me I can't remember what the hell I did. I do remember it was a 2 week ordeal and it was a pain and had a lot of steps in the process. I would rather develop something for it on my own. The other thing is the weather.. Which is now going to be replaced by this plugin, and this plugin does a hell of a lot more then the WU plugin for the Vera. I also had the day/night plugin on the Vera which can easily be replaced by one that krambriw made, so no worries there. I have a Samsung smart washer and dryer that there is a plugin for the Vera, tho i am not upset about not having that because it never worked!. So now it's down to the lights and a couple of scenes that can easily be moved.
If you like the work I have been doing then feel free to Image

User avatar
kgschlosser
Site Admin
Posts: 5394
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Weather Underground Plugin

Post by kgschlosser » Fri Apr 07, 2017 12:23 am

Now this thing is kicking me in the bb's. i am trying to format the forecast properly and it keeps on putting Thursday at the end when the forecast is for Thursday Friday Saturday and Sunday. I am still working that bit out. if someone has a personal weather station they would be willing to share the WU Id for i can make sure that bit of it works.
If you like the work I have been doing then feel free to Image

loveleejohn
Experienced User
Posts: 133
Joined: Thu Dec 10, 2015 12:09 am

Re: Weather Underground Plugin

Post by loveleejohn » Fri Apr 07, 2017 12:52 am

Wow, sounds like you're head over heels into the automation world kg. Lol. Laundry is where I draw the line! :| .... JK!! Only until I build my first robot! :lol: I have no idea if it would help or hurt to share the wonkers vbs weather script I found online a few years back. Let me know and I'll shoot it over to your inbox right away.

User avatar
kgschlosser
Site Admin
Posts: 5394
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Weather Underground Plugin

Post by kgschlosser » Fri Apr 07, 2017 2:10 pm

nah I am almost done with the WU plugin.. i am doing some code cleanup. I am trying to get a really nice way of allowing the user to get the data back in any way they like. only because it is a huge amount of information especially the 10 day hourly forecast :shock:

I have got gas fireplace controllers. I also have pieces to monitor the water level in the sump pumps in my basement. and the moisture content in the dirt on the unfinished side of my basement. i made a controller for my hot tub. all of these i designed. My house is room aware to the remote controls i am using. every room has the same remotes and they can be used in any room. and will control the devices in that room automatically without the need to "tell" the remote what devices to use. it does it automatically. all through the use of EG.
If you like the work I have been doing then feel free to Image

User avatar
kgschlosser
Site Admin
Posts: 5394
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Weather Underground Plugin

Post by kgschlosser » Fri Apr 07, 2017 3:05 pm

well i was gonna finish this up today but apparently the WU site is having some issues. it did give me the ability to add error handling for this problem. but I am going to have to wait until it is back up
If you like the work I have been doing then feel free to Image

User avatar
kgschlosser
Site Admin
Posts: 5394
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Weather Underground Plugin

Post by kgschlosser » Fri Apr 07, 2017 11:37 pm

ok this is the first Beta. I have not finished up all of the actions just yet. But here is a brief rundown


when you install the plugin the config dialog for the plugin will open... if you do not have an API key from WU then copy the text from inside of the API entry box. this is a link on how to obtain it. there are varying levels of the API. so go for the gold i say. get the best one.. the API outline is misleading but you get the very best one for free as well for up to 10 queries a minute. and if you are doing more then 10 queries a minute then you have a serious weather addiction and should seek help for this. :D

once you have the key place it in the box. if you want to use you have the option to use Personal Weather Stations (this would be for all available in your area)

that should just about cover the install

now use.. this was a bit tricky, because of the sheer amount of data from WU. when running an action 2 things happen first is an event is generated the second is a result is returned.

fill in the fields according to what you want. the script will automatically know if you enter lat, long or city/state. when entering an airport code do not enter anything in the second location field. just enter the airport code into the first and leave the second blank.

if entering a Personal Weather Station (PWS) leave the first 2 fields blank.

So this is how it works. if you do not have the xml string option checked the payload for the event (eg.event.payload) as well as the result from the action (eg.result) is going to be a WU weather object.
what this means is you can access all of the various bits in an almost identical way the API outlines.

for example

if you wanted the temperature for the forecast for today. you would have a python command after the action with the line.

for imperial

Code: Select all

print eg.result.Apr07.High.english
for metric

Code: Select all

print eg.result.Apr07.High.metric
now if you only did this. it's going to be a weather object that contains the english and metric. This is something I am still working on. and is going to change

Code: Select all

print eg.result.Apr07.High
so if you wanted to print the forecast for today you have to access it via a MonthDay structure and for night it would be MonthDay.Night

Code: Select all

print str(eg.result.Apr07)
this will print all of the forecast

Code: Select all

print str(eg.result)
and this will print the forecast for tonight

Code: Select all

print str(eg.result.Apr07.Night)
you have to have the str() surrounding the result data. this is what converts that weather object into a formatted text of the forecast. You can also use unicode(). but in the event you wanted to use some other data container type. then you would use the following at any level of the weather object

dict, tuple, str, list, unicode can be passed to GetData()

Code: Select all

eg.result.GetData(dict)
for the hourly forecast data you would use MonthDayHour there is no Night for the hourly for obvious reasons.

so if you wanted to have this show up in something like the OSD action then in the text field of the OSD action you would do the following

Code: Select all

{str(eg.result)}

IMPORTANT The amount of data that is received from WU is immense EG is not stuck!!!! It's thinking. so wait. if a scientific calculator has more processing power then your PC then this will take a really long while and either this plugin is not going to be for you or it's time to upgrade that calculator.

PLEASE REMEMBER this is a new plugin. it is not 100% complete. and there are going to be bugs in it. the parsing of the data received is a very involved process and a hell of a lot of trial and error.

I wouldn't be surprised if this plugin tops 3000 lines of code when finished
If you like the work I have been doing then feel free to Image

loveleejohn
Experienced User
Posts: 133
Joined: Thu Dec 10, 2015 12:09 am

Re: Weather Underground Plugin

Post by loveleejohn » Sat Apr 08, 2017 1:17 am

So excited to see this on here! :D Sadly I can't use it yet since it's in .egplugin format and for some reason that I cannot remember I can't use that on my computer. I'm running the latest version though. I'll have to wait till your next release I guess. Fingers crossed!

User avatar
kgschlosser
Site Admin
Posts: 5394
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Weather Underground Plugin

Post by kgschlosser » Sat Apr 08, 2017 2:11 am

.egplugin is just a zip file. so if you are having problems change the extension to zip and open it.. then copy the only folder in the zip into your plugins folder. do not copy the info.py just the plugin folder
If you like the work I have been doing then feel free to Image

User avatar
kgschlosser
Site Admin
Posts: 5394
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Weather Underground Plugin

Post by kgschlosser » Sat Apr 08, 2017 2:12 am

also .egplugin is how plugins should be released from now on. so we need to figure out why you are having an issue with it
If you like the work I have been doing then feel free to Image

User avatar
kgschlosser
Site Admin
Posts: 5394
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Weather Underground Plugin

Post by kgschlosser » Sat Apr 08, 2017 5:54 am

ok next version added parsing to a couple more actions. as well as fixed an issue with the conversion of object to tuple and dict
If you like the work I have been doing then feel free to Image

loveleejohn
Experienced User
Posts: 133
Joined: Thu Dec 10, 2015 12:09 am

Re: Weather Underground Plugin

Post by loveleejohn » Sat Apr 08, 2017 1:24 pm

kgschlosser wrote:also .egplugin is how plugins should be released from now on. so we need to figure out why you are having an issue with it
I read this somewhere a while back but I'm not sure how to use the .egplugin yet. Do I double click the download to install it or am I supposed to drag it to my eventghost folder?

loveleejohn
Experienced User
Posts: 133
Joined: Thu Dec 10, 2015 12:09 am

Re: Weather Underground Plugin

Post by loveleejohn » Sat Apr 08, 2017 1:29 pm

kgschlosser wrote:.egplugin is just a zip file. so if you are having problems change the extension to zip and open it.. then copy the only folder in the zip into your plugins folder. do not copy the info.py just the plugin folder
I had to follow these steps to install the plugin. Next I'll see if I can test it out for ya.

loveleejohn
Experienced User
Posts: 133
Joined: Thu Dec 10, 2015 12:09 am

Re: Weather Underground Plugin

Post by loveleejohn » Sat Apr 08, 2017 1:41 pm

For some reason I'm getting the following errors while attempting to configure the plugin. I've cleared out my API key for the screenshot but I used it while testing. I tried every possible combination of the radio box options for Personal Weather Stations and WU Best Forecast. I'll read your instructions again. Maybe I'm missing something.
WeatherUnderground configuration error.PNG

Post Reply