Author Topic: wunderground driver not staying updated  (Read 5703 times)

Work2Play

  • Newbie
  • *
  • Posts: 8
    • View Profile
wunderground driver not staying updated
« on: May 09, 2012, 03:53:51 pm »
I use the wunderground driver to get the temperature in my area, then set a custom value in the elk, which the elk then sends to my RCS thermostats as the outside temperature.  All that works great normally - I first set it up with the previous weather service, about a week before they shut down!

Anyways - it seems to work for a few hours, updating as expected - then it just stop - the temperature will stick at some overnight temperature.  If I open Elve and look at the device properties, it generally seems like the updates are happening - the days/dates showing are correct; icons are updated; highs/lows, etc - and it shows last forecast update was within about the last 40 minutes - but the apparent temperature just gets stuck.  If I restart the driver, it updates immediately, and all is well for a little while till it freezes again.

Any ideas, or any other info you'd need?

bpwwer

  • Full Member
  • ***
  • Posts: 220
    • View Profile
Re: wunderground driver not staying updated
« Reply #1 on: May 09, 2012, 07:46:29 pm »
The forecast and the current conditions are two different queries to WUnderground.  Each query generates a LastUpdate property.  There's the LastForecastUpdate for the forecast query and a LastUpdate for the current conditions query.   When it is stuck is the LastUpdate time/date also out of date?

If the either of the queries fail, it should generate an error in the log. 

If you're not getting any errors, then try turning on debug for the driver. That will output the results of the queries to the log.  See if the query results look right, if they do, then it's the driver not updating the properties correctly (I thought all those cases were fixed in the current driver).  If the query is return old data, then it is WUnderground or the station that is providing the data.

I just had a the same symptoms but it was because my station (local station feeding WUnderground) was not sending data.  WUnderground simply returns the last data it has for each query.

Deane Johnson

  • Guest
Re: wunderground driver not staying updated
« Reply #2 on: May 10, 2012, 03:20:19 am »
I have been experiencing much the same issue with the driver for some time now.  I don't use it for much, but it seems to run for a couple of days, then the current temp and conditions freeze, and stay frozen.

It seems that disabling the driver and re enabling it fixes it for another couple of days.  I believe rebooting the server also fixes it for a couple of days.


bpwwer

  • Full Member
  • ***
  • Posts: 220
    • View Profile
Re: wunderground driver not staying updated
« Reply #3 on: May 10, 2012, 09:06:52 am »
I'll take a closer look at what mine is doing.  I've had problems also but I think they've been caused by other issues:

1) I was having problems with the driverservice going to 100% cpu usage because of race condition (John has it fixed in the latest release) When this happened all drivers mostly stopped working.

2) The two times I've looked at why I wasn't getting weather updates it was because the station wasn't sending updates to WUnderground.

It's very possible that I have been having the same problem reported here but didn't notice it because of the above.    There's really only a couple reasons why the updates would stop:

1) The driver gets an error sending the query request
2) The driver fails to parse the results
3) The results from WUndergound are not updated

The first 2 should show up in the log as errors. 

John Hughes

  • Administrator
  • Hero Member
  • *****
  • Posts: 2852
    • View Profile
    • Codecore Technologies
Re: wunderground driver not staying updated
« Reply #4 on: May 10, 2012, 12:58:58 pm »
Thanks for taking a look Bob.
John Hughes
Codecore Technologies

Deane Johnson

  • Guest
Re: wunderground driver not staying updated
« Reply #5 on: May 11, 2012, 03:41:58 am »
Bob, I am not certain, but only suspicious that the problem might be set off when the driver does not get a response from Weather Underground.   It may lose it's ability to update at that point.  Mine has not acted up since this thread was started, so I haven't gotten any error messages to post.

Work2Play

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: wunderground driver not staying updated
« Reply #6 on: May 12, 2012, 09:18:23 am »
I think Deane is right.

When I check mine, everything about the forecast is correct, but the current conditions are out of date.  If I restart the driver, it instantly updates. 

Just checked mine - apparent temperature in elve shows 64.2, and the same weather station on wunderground shows 66.2 right now.  The last update times - for forecast are about 15 minutes ago, but the last update for current conditions is about 11:15PM last night.  If I check the logs around that timeframe, I see an entry for Weather Underground that says:
"Error The remote name could not be resolved: 'api.wunderground.com' while loading http://api.wunderground.com/weatherstation/WXCurrentObXML.asp?ID=KCASACRA48"

Seems like once it gets that message, it never tries again until the service is restarted.

bpwwer

  • Full Member
  • ***
  • Posts: 220
    • View Profile
Re: wunderground driver not staying updated
« Reply #7 on: May 12, 2012, 02:55:39 pm »
Good guess Deane!

Looks like the code that tried to fail-over to a second or third station ID was broken in case where you only defined one (and probably two) stations. When it failed, it would try and use the next station which was undefined.  I think from that point forward, it would keep trying to use the undefined station.

I've sent an update to John but in the meantime, you can probably work around it by using the same station ID for all three stations.  I think that will prevent it from getting stuck.

Work2Play

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: wunderground driver not staying updated
« Reply #8 on: May 12, 2012, 10:27:27 pm »
Thanks for the update!  I'll try that fix right now.

Frunple

  • Hero Member
  • *****
  • Posts: 774
    • View Profile
Re: wunderground driver not staying updated
« Reply #9 on: May 13, 2012, 01:08:35 pm »
Not to pile on here but my sunrise/sunsets have always been different from EMS to the website (see attached). Also, any chance of adding "night precipitation chance" to the driver? You can see tomorrow has a 40% chance and tomorrow night has a 60% chance.

bpwwer

  • Full Member
  • ***
  • Posts: 220
    • View Profile
Re: wunderground driver not staying updated
« Reply #10 on: May 13, 2012, 07:50:40 pm »
Not to pile on here but my sunrise/sunsets have always been different from EMS to the website (see attached). Also, any chance of adding "night precipitation chance" to the driver? You can see tomorrow has a 40% chance and tomorrow night has a 60% chance.

Please realize that the driver is using a free feed from Weather Underground. They don't provide as much information in the free feed as they do to the web site or to subscription feeds.  The nighttime chance of precipitation is one of the things that isn't available from the free feed.  The driver does expose pretty much everything that is available from the feed.

Sunrise/Sunset values are only available for the current day from the feed and there was a request to get them for the entire forecast period.  The driver now does the calculations internally for sunrise and sunset.  It looks like it might not be handling daylight savings correctly since both are off by almost 1 hour.   I'm seeing the same thing on mine so I'll take a look at the calculations and see if I can figure out what's wrong.

John Hughes

  • Administrator
  • Hero Member
  • *****
  • Posts: 2852
    • View Profile
    • Codecore Technologies
Re: wunderground driver not staying updated
« Reply #11 on: May 13, 2012, 08:34:00 pm »
Regarding sunrise/sunset, the DateTime driver will get the values for the next occurrences but it does not currently support it for concecutive days.

Bob, sunrise/sunset calculations are a real pain when dealing with time zones since some time zones only offset by 30 minutes (not in USA) and there are different time zone rules depending on the year. This info is all available in the OS and I have already code this logic into Elve using NOAA's algorithm.

You can get the info using: (you must know the long/lat coordinates and the timezone)

Code: [Select]
using CodecoreTechnologies.Elve.DriverFramework.Utilities;

SunData sd = SunriseSunsetCalculator.Calculate(dt, latitude, longitude, timeZone, SunZenith.Official);
John Hughes
Codecore Technologies

bpwwer

  • Full Member
  • ***
  • Posts: 220
    • View Profile
Re: wunderground driver not staying updated
« Reply #12 on: May 13, 2012, 09:45:13 pm »
Thanks John,

The code does use the OS timezone info so it should be correct (in theory).  I just fixed the problem with the calculations and think they are working now.  The biggest problem was that the algorithms have the longitude and timezone offsets backwards (I.E. they expect the west longitudes to be positive and the US timezone offsets to be positive).  The data for lat/long data comes from the weather feed and the timezone info from the OS.  It must have been just dumb luck that it was close at the time when I was originally testing.

I just uploaded a fixed version to my web site.

At some point I'll try to update it to use the version in the utilities.  There shouldn't be any difference in the calculation but it would be good to keep it consistent. 

John Hughes

  • Administrator
  • Hero Member
  • *****
  • Posts: 2852
    • View Profile
    • Codecore Technologies
Re: wunderground driver not staying updated
« Reply #13 on: May 13, 2012, 09:53:54 pm »
The biggest problem was that the algorithms have the longitude and timezone offsets backwards (I.E. they expect the west longitudes to be positive and the US timezone offsets to be positive). 

I think I ran into the same issue when porting the NOAA code to C# so the Elve code may be the same way.
John Hughes
Codecore Technologies

Frunple

  • Hero Member
  • *****
  • Posts: 774
    • View Profile
Re: wunderground driver not staying updated
« Reply #14 on: May 14, 2012, 06:31:58 am »
I just uploaded a fixed version to my web site.

Where is that? I still only see 1.1 as the newest.