Hello All,
I've installed the modoule and setup my API key, but when I go to a page that displays the current weather block I get the following error:
Notice: Undefined index: current_observation in wunderground_weather_get_current() (line 489 of /home/user/public_html/sites/all/modules/wunderground_weather/wunderground_weather.module).
When I then go the my wunderground site where I registerd my key I can see that every request that is made results in an error... But I can't get any further information on this. The only way I can tell is by going to the "analytics" tab.
Does anyone know what is going on here? Or can you tell me some steps to debug?
I am also getting the following error in my drupal logs:
TYPE wunderground_weather
DATE Sunday, May 25, 2014 - 18:55
USER sjs205
LOCATION http://www.mysite.co.uk/node
REFERRER http://www.mysite.co.uk/
MESSAGE you must supply a location query:
SEVERITY warning
HOSTNAME xx.xx.xx.xx
OPERATIONS
Many Thanks,
Steven
Comments
Comment #1
sjs205 commentedBit of an update, I notice that the problem could be caused by the location box in the block view.
When I select my weather station, ISOUTHAM6, from the tag list (see sensors_ex1.png) a pair of square brackets are placed after the name (see sensors_ex2.png).
If I remove these square brackets I get another error as follows:
If I then remove my station and just type in Southampton, United Kingdom, and select the option I notice that the square brackets are filled as follows:
This also works...
Does this mean that with this module it is not possible to get ones own weather station data from wunderground, even though it is in the tag list.
Any help would be appreciated.
Many thanks,
Steven
Comment #2
sjs205 commentedUpdated title to suit findings...
Comment #3
jmonarch commentedI was able to remove the error with adding "isset" to the file
(/home/user/public_html/sites/all/modules/wunderground_weather/wunderground_weather.module)
as shown below:
line 489:
if (isset($weather['current_observation'])) {
also don't forget you will need to get a valid API from Wunderground (http://www.wunderground.com/weather/api) and put the api key in the "Wunderground Weather Settings" under configuration.
After this you should be all set.
Comment #4
jmonarch commentedLet me know if the above fix works for you.
Comment #5
wernerglinka commentedI have the same issue. We have a couple of personal weather stations in our community and although the type-ahead show me the correct station "KCAWOODS5, King's Mountain 2100ft, Woodside, CA, US []" I get the error and most importantly no weather data are available. If I select another station nearby, "Woodside, California [/q/zmw:94061.2.99999]" , all is well.
Is there any more info available?
Comment #6
wernerglinka commentedTurns out, this issue is with the auto complete of the location path field, but it can be fixed "manually". The problem with my auto complete response "KCAWOODS5, King's Mountain 2100ft, Woodside, CA, US []" was that it missed the
lparameter.This page of the Wunderground docs explains this.
Here is what I did:
First I did a geo lookup for local Wunderground stations using my zip code:
http://api.wunderground.com/api/<your api key>/forecast/geolookup/conditions/q/CA/94062.jsonJust type this url into the browser to see the json response. The station I wanted was listed, the info looks like this:
Now I did a second geo lookup with the lat/lon coordinates of the station I wanted:
http://api.wunderground.com/api/<your api key>/forecast/geolookup/conditions/q/37.418705,-122.324013.jsonThe response did not show the station I wanted but one that was just 1km away from it. Must be something with the digits after the decimal point...
I added the
lproperty of this station to my initial auto look up result. It now reads:KCAWOODS5, King's Mountain 2100ft, Woodside, CA, US [/q/zmw:94062.4.99999]And that was it. Now this module works just as expected.
Comment #7
jeroen_drenth commentedwernerglinka is right that the issue is caused by the missing parameter. I've created a patch that adds a fallback when the parameter is missing. It uses the wunderground weather function Geolookup to get the parameter by longitude, latitude. You will have resubmit the location in your blocks to resolve the issue.Please let me know if it works.
Comment #8
jeroen_drenth commentedPlease use this one!
Comment #9
wernerglinka commented@jeroen_drenth, thank you for the patch. I tested it with several personal weather stations by typing in the station ID, e.g. KCAWOODS5. It returned the proper location every time. Now the module works exactly as expected!
Thanks again,
Werner
Comment #10
wernerglinka commentedFWIW, I wrote a short blog post about using this module here: http://glinka.co/blog/adding-weather-info-drupal-site . It might help someone down the road.
Comment #11
jeroen_drenth commentedThanks Werner! I've committed the patch to dev.
Comment #12
jeroen_drenth commented