OpenWeatherMap

Questions and comments specific to a particular plugin should go here.
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

OpenWeatherMap

Post by Pako » Sun Oct 12, 2014 7:14 am

I promised to create a plugin to work with OpenWeatherMap.
Here is the first version.
OWM01.png
Still a lot of work waiting for me (especially working with forecasts).
But I think that even this first version it may bring some benefit.
Every opinion is welcome!

Pako
Attachments
__init__.py
Version 0.1 - released 2014-10-16
- bugfix
(56.24 KiB) Downloaded 205 times
__init__.py
Version 0.0 - released 2014-10-12
(56.16 KiB) Downloaded 156 times

pubsfried
Posts: 7
Joined: Thu Jul 26, 2012 5:53 pm
Location: DE-66424 Homburg

Re: OpenWeatherMap

Post by pubsfried » Sun Oct 12, 2014 8:58 pm

Hi Pako,
many, many thanks for your quick efforts, I really appreciate your work!

I did a first check and hope I did all right:
EDIT: 1a. Registered and obtain API key @ openweathermap.org
1b. Add a folder to the plugins folder C:\Program Files\EventGhost\plugins\OpenWeatherMap
2. Copied the file __init__.py to this folder
3. Restarted EG and added the plugin to the tree.
4. Added the ID=2827613 of my town of interest (as shown in the api link) in the plugin's config form + added the city's name "Kaiserslautern" .
API link: http://api.openweathermap.org/data/2.5/ ... id=2894003
5. (Open Weather Map - Folder was added to tree)
6. Configured and ran the Macro Enable City - 'Open Weather Map: Enable city: 2894003'
6a. EDIT: Enter the API key you obtained from openweathermap.org
7. Ran the macro Get current weather - 'Open Weather Map: Get current weather'

[SOLVED with 1a, 6a: But this only ended with the event log entry...
OpenWeatherMap: {u'message': u'Error: Not found city', u'cod': u'404'} ]

EDIT: I set the polling period to 10 min., but no events appeared the last 30 minutes.


[Solved with 1a, 6a: What did I wrong? I assume the 404 is a 'page not found'
The api link worked fine at the same time in Firefox, also http://openweathermap.org/city/2894003 was up and running.
Many thanks in advance!]
Last edited by pubsfried on Fri Oct 17, 2014 7:09 pm, edited 1 time in total.

HTPCanwender
Experienced User
Posts: 59
Joined: Wed Feb 08, 2012 9:41 pm
Location: Germany

Re: OpenWeatherMap

Post by HTPCanwender » Sun Oct 12, 2014 9:13 pm

Hi,
the ID for Kaiserslautern is not 2827613 but 2894003. Please try this one.

User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: OpenWeatherMap

Post by Pako » Mon Oct 13, 2014 4:27 am

@pubsfried:
I do not know, why you are using id = 2827613.
HTPCanwender is right, it has to be properly 2894003.
And I see that it is not necessary to explain how you can figure it out.
Note:
You do not have to use the action "Enable city" (if you have the appropriate city did not disabled).
By default, everything is enabled.

Pako

pubsfried
Posts: 7
Joined: Thu Jul 26, 2012 5:53 pm
Location: DE-66424 Homburg

Re: OpenWeatherMap

Post by pubsfried » Mon Oct 13, 2014 7:34 am

@ HTPCanwender:
I changed the mailing above already while you were writing, sorry. But same result. I checked with the other city before, but same result.

@Pako:
Any more ideas to solve this?

User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: OpenWeatherMap

Post by Pako » Mon Oct 13, 2014 8:37 am

I have no idea why it does not work for you.
Perhaps only one idea: You have registered and obtained API key you entered in the appropriate field?
Unfortunately, I can not see your computer.
For me, it behaves normally.
Can someone please write if it works elsewhere?

Thanks, Pako
Attachments
OWM02.png
OWM03.png

pubsfried
Posts: 7
Joined: Thu Jul 26, 2012 5:53 pm
Location: DE-66424 Homburg

Re: OpenWeatherMap

Post by pubsfried » Mon Oct 13, 2014 6:19 pm

@Pako:

aaah, ok. :idea: the api key field was blank ...
I registered @ OWM, got my Api key and everything worked well. So I get a result for "(o) Show window with a table" like you showed in your mailing before

Read first, then ask - I thought you just poll the weather data using the http://api.openweathermap.org/data/2.5/ ... id=2827613 and haven't read about the registration and the API @ OWM :oops: I promise to improve - sorry!

...and it fires a event !
OWM.Temperature.Kaiserslautern (14.66, u'2894003') :D

Is there already a way to fire events in EG pending on the weather data, like if temperature is >16, if condition is "sunny", or do I need to setup a phyton script for this ? Little example would be helpful (maybe also for the other newbies here :-) )

HTPCanwender
Experienced User
Posts: 59
Joined: Wed Feb 08, 2012 9:41 pm
Location: Germany

Re: OpenWeatherMap

Post by HTPCanwender » Tue Oct 14, 2014 8:37 pm

I tried the plugin without using the API field and I did not register at OWM. But I get a result from the plugin. Is this ok?
Attachments
OWM.png

krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: OpenWeatherMap

Post by krambriw » Wed Oct 15, 2014 5:38 am

Dear Pako, I have just added your plugin to my configuration and it is running without api key but after a while I get an error 'UnboundLocalError'

Kind regards, Walter

Code: Select all

2014-10-15 07:08:39  EVENT: OWM.Status.Stockholm (u'Sky is Clear', u'2673730')
2014-10-15 07:08:39  EVENT: OWM.Temperature.Stockholm (5.9400000000000004, u'2673730')
2014-10-15 07:08:39  EVENT: OWM.Pressure.Stockholm (1014, u'2673730')
And then

Code: Select all

2014-10-15 07:26:41  EVENT: OWM.Sunrise.Stockholm u"2673730"
2014-10-15 07:26:41  Exception in thread Thread-1356:
2014-10-15 07:26:41  Traceback (most recent call last):
2014-10-15 07:26:41  File "threading.pyc", line 532, in __bootstrap_inner
2014-10-15 07:26:41  File "threading.pyc", line 484, in run
2014-10-15 07:26:41  File "C:\Program\EventGhost_1699\plugins\OpenWeatherMap\__init__.py", line 978, in SunriseTime
2014-10-15 07:26:41  sunrise = self.oldValues[id][sunrise]
2014-10-15 07:26:41  UnboundLocalError: local variable 'sunrise' referenced before assignment

User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: OpenWeatherMap

Post by Pako » Thu Oct 16, 2014 8:39 am

Dear Walter!
This is obviously a bug and fortunately it is quite clear how it should be.
Thank you for reporting !
You can download the fixed version.

Best regards,
Luboš

george tirebuyer
Posts: 41
Joined: Sun Apr 28, 2013 12:25 pm

Re: OpenWeatherMap

Post by george tirebuyer » Fri Sep 01, 2017 12:31 pm

I get this error trying to load the plugin in 0.5.0rc4
05:25:45 Traceback (most recent call last) (0.5.0-rc4):
05:25:45 File "C:\Program Files (x86)\EventGhost\plugins\Open Weather Map\__init__.py", line 509, in Create
05:25:45 self.itemHeight = self.lb.GetItemHeight()
05:25:45 AttributeError: 'CheckListBox' object has no attribute 'GetItemHeight'
05:25:45 Traceback (most recent call last) (0.5.0-rc4):
05:25:45 File "C:\Program Files (x86)\EventGhost\eg\Classes\TaskletDialog.py", line 162, in ProcessingTask
05:25:45 self.Configure(*args, **kwargs)
05:25:45 File "C:\Program Files (x86)\EventGhost\eg\Classes\ConfigDialog.py", line 106, in Configure
05:25:45 treeItem.Configure(*args)
05:25:45 File "C:\Program Files (x86)\EventGhost\eg\Classes\ActionItem.py", line 80, in Configure
05:25:45 return self.executable.Configure(*args)
05:25:45 File "C:\Program Files (x86)\EventGhost\plugins\Open Weather Map\__init__.py", line 1353, in Configure
05:25:45 mainSizer.AddGrowableCol(1)
05:25:45 File "wx\_core.pyc", line 15368, in AddGrowableCol
05:25:45 PyAssertionError: C++ assertion "!m_cols || idx < (size_t)m_cols" failed at ..\..\src\common\sizer.cpp(1980) in wxFlexGridSizer::AddGrowableCol(): invalid column index


It works for me in version 0.4.1 Is this a plugin problem or a bug?

User avatar
topix
Experienced User
Posts: 420
Joined: Sat May 05, 2007 3:43 pm
Location: Germany
Contact:

Re: OpenWeatherMap

Post by topix » Sun Sep 03, 2017 4:17 pm

Here is an updated version of the plugin. It should now work with EG 0.4 and 0.5
Attachments
OpenWeatherMap_0_2.egplugin
(17.65 KiB) Downloaded 84 times

george tirebuyer
Posts: 41
Joined: Sun Apr 28, 2013 12:25 pm

Re: OpenWeatherMap

Post by george tirebuyer » Tue Sep 05, 2017 10:20 am

Thanks, Works just fine!

Medy
Posts: 42
Joined: Sat Nov 15, 2014 8:33 pm
Location: Germany

Re: OpenWeatherMap

Post by Medy » Mon Dec 04, 2017 6:56 pm

Can someone explain how i can create events , lets say for example temperature with this ? Im not familiar with python.

When I get current weather . I get no event ?

jachin99
Experienced User
Posts: 554
Joined: Sat Feb 13, 2016 8:39 pm

Re: OpenWeatherMap

Post by jachin99 » Mon Dec 04, 2017 11:25 pm

Edited

Post Reply