OpenWeatherMap
- Pako
- Plugin Developer
- Posts: 2294
- Joined: Sat Nov 11, 2006 1:31 pm
- Location: Czech Republic
- Contact:
OpenWeatherMap
I promised to create a plugin to work with OpenWeatherMap.
Here is the first version. 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
Here is the first version. 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 345 times
-
- __init__.py
- Version 0.0 - released 2014-10-12
- (56.16 KiB) Downloaded 288 times
Re: OpenWeatherMap
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!]
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.
-
- Experienced User
- Posts: 89
- Joined: Wed Feb 08, 2012 9:41 pm
- Location: Germany
Re: OpenWeatherMap
Hi,
the ID for Kaiserslautern is not 2827613 but 2894003. Please try this one.
the ID for Kaiserslautern is not 2827613 but 2894003. Please try this one.
- Pako
- Plugin Developer
- Posts: 2294
- Joined: Sat Nov 11, 2006 1:31 pm
- Location: Czech Republic
- Contact:
Re: OpenWeatherMap
@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
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
Re: OpenWeatherMap
@ 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?
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?
- Pako
- Plugin Developer
- Posts: 2294
- Joined: Sat Nov 11, 2006 1:31 pm
- Location: Czech Republic
- Contact:
Re: OpenWeatherMap
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
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
Re: OpenWeatherMap
@Pako:
aaah, ok.
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
I promise to improve - sorry!
...and it fires a event !
OWM.Temperature.Kaiserslautern (14.66, u'2894003')
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
)
aaah, ok.

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

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

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

-
- Experienced User
- Posts: 89
- Joined: Wed Feb 08, 2012 9:41 pm
- Location: Germany
Re: OpenWeatherMap
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?
-
- Plugin Developer
- Posts: 2570
- Joined: Sat Jun 30, 2007 2:51 pm
- Location: Stockholm, Sweden
- Contact:
Re: OpenWeatherMap
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
And then
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')
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
My released plugins
https://drive.google.com/drive/folders/ ... y01eVBKeHM
https://drive.google.com/drive/folders/ ... y01eVBKeHM
- Pako
- Plugin Developer
- Posts: 2294
- Joined: Sat Nov 11, 2006 1:31 pm
- Location: Czech Republic
- Contact:
Re: OpenWeatherMap
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š
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š
-
- Experienced User
- Posts: 60
- Joined: Sun Apr 28, 2013 12:25 pm
Re: OpenWeatherMap
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?
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?
Re: OpenWeatherMap
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 172 times
-
- Experienced User
- Posts: 60
- Joined: Sun Apr 28, 2013 12:25 pm
Re: OpenWeatherMap
Thanks, Works just fine!
Re: OpenWeatherMap
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 ?
When I get current weather . I get no event ?