[RELEASE] Enhanced Weather Underground Driver

I have 2 issues:

  1. The WU data is only updating if I go into the DH and hit the poll button. I have auto poll checked on and set to 10min.
  2. The forecast doesnt seem to be following my custom coordinates, its somewhere else, maybe where my primary hub is. The long/Lat in the currents states isn't matching the custom input Long/Lat.

Uh yeah, WU have cracked down on some ppl without a PWS lately - try finding a weather station near you in WU and use that PWS ID. If that doesn't work, then you are out of luck, I'm afraid.

1 Like

try clearing the "state data", then hit save prefs and see how that goes?

make sure you have the "-" symbol in the right place, eg in Santa Barbara, CA it'll look like this:

Screenshot 2023-01-09 at 8.53.41 am

but in Melbourne, Australia, it looks like this:

Screenshot 2023-01-09 at 8.54.44 am

This is the site I use for custom coordinates:

Thank you! That worked. I did not realize I could browse a map and see other station ID's. Selecting one close to me gave me the location in the fields which previously displayed "null". I consider this issue resolved.

1 Like

Awesome! :+1:

Yep, I have the coordinate signs correct. Did some troubleshooting adding a few log.debug lines in the code.

  1. The auto polling issue resolved by unchecking the 3-day and 7-day forecast buttons. My PWS WU data is not continuous day to day because power goes out sometimes. Maybe that is messing it up with a Null object.
  2. When enabling Custom coordinates the "polllatitude" and "polllongitude" are throwing Null values, so something is broke here. If disabled they fine but show local hub location as expected, not where the PWS is. So forecast is messed up. Might have to do with Data types?
  3. Temperature is an integer but I couldnt find anywhere in the code where its gets rounded, Im assuming WU sends it this way which is annoying.

Thanks.. :grinning:

Okay, one more question. And again, thank you for all the hard work obviously put into this app.

So, when I add the sunriseTimeLocal and/or the sunsetTimeLocal tile... I am getting back the unformatted server time. However, the time formatting does work correctly in the 3-day forecast tile.


That's because the local time is calculated from those values WU provides.

        int Tstart = "${device.currentValue('sunriseTimeLocal')}".indexOf('T')
        int Tstop1 = "${device.currentValue('sunriseTimeLocal')}".indexOf(':', Tstart)
        int Tstop2 = "${device.currentValue('sunriseTimeLocal')}".indexOf(':', Tstop1+1)
        sunriseLocal = "${device.currentValue('sunriseTimeLocal')}".substring(Tstart+1, Tstop2)
        strSunrise = "${convert24to12(sunriseLocal)}" 
        if(txtEnable == true){log.info "Sunrise = $strSunrise"}
    
        Tstart = "${device.currentValue('sunsetTimeLocal')}".indexOf('T')
        Tstop1 = "${device.currentValue('sunriseTimeLocal')}".indexOf(':', Tstart)
        Tstop2 = "${device.currentValue('sunriseTimeLocal')}".indexOf(':', Tstop1+1)
        sunsetLocal = "${device.currentValue('sunsetTimeLocal')}".substring(Tstart+1, Tstop2)
        strSunset = "${convert24to12(sunsetLocal)}"
        if(txtEnable == true){log.info "Sunset = $strSunset"}

Hmm, there is a bug - I just reproduced your result. I'll see if I can fix it.

Probably from the code I gave you a month or so ago! :rofl:

No it was actually @swade trying to make my code better that broke it. :rofl:

Release: v6.10.4 - Fix broken Custom GPS Coordinates Option

Anyhoo, I've reverted to my known good code. :+1:

EDIT: for those who are curious - here's my version of your code:

def locationCoOrds(){	
    if(gpsCoords){
			state.latt1 = latitudeCust
			state.long1 = longitudeCust
			sendEvent(name: "latitude", value: state.latt1, isStateChange: state.force )
			sendEvent(name: "longitude", value: state.long1, isStateChange: state.force )
			}
		else{    
			state.latt1 = (location.getLatitude())
			state.long1 = (location.getLongitude())
			sendEvent(name: "latitude", value: state.latt1, isStateChange: state.force )
			sendEvent(name: "longitude", value: state.long1, isStateChange: state.force )
			}
    if(txtEnable == true){log.info "latitude: ${device.currentValue('latitude')}"}
    if(txtEnable == true){log.info "longitude: ${device.currentValue('longitude')}"}	
	}

and I'm not sure why this code didn't work - but this is what I reverted from:

def locationCoOrds(){
    
    def polllatitude
    def polllongitude
    
    if(gpsCoords){
        polllatitude = device.currentValue('latitudeCust')
        polllongitude = device.currentValue('longitudeCust')
		}
		else{    
        polllatitude = location.getLatitude()
        polllongitude = location.getLongitude()
		}
	sendEvent(name: "latitude", value: polllatitude)
	sendEvent(name: "longitude", value: polllongitude)
    if(txtEnable == true){log.info "latitude: $polllatitude"}
    if(txtEnable == true){log.info "longitude: $polllongitude"}
}

Just loaded, looks fixed, will keep an eye on it. Thanks much!

1 Like

:+1:

No worries.

Try this:

if(gpsCoords){
polllatitude = latitudeCust
polllongitude = longitudeCust

That should work and get rid of using state to duplicate variables.

1 Like

I think I'll just leave it alone for now - right now I need to do some day job stuff. :crazy_face:

Is anyone else getting this error in the logs? This error happens daily, for me:

dev:2292023-03-09 06:06:10.409 AMerrororg.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'null' with class 'null' to class 'int'. Try 'java.lang.Integer' instead on line 1037 (method poll)

dev:2292023-03-09 12:00:00.108 AMerrororg.codehaus.groovy.runtime.metaclass.MissingMethodExceptionNoStack: No signature of method: user_driver_dJOS_Wunderground_Driver_711.resetPollCount() is applicable for argument types: () values: [] (method resetPollCount)

It mentions line 1037, so it seems to have to do with the HTML Tiles Logic and specifically Rain History.

The first issue is because the code is not getting rain values. Is the weather station being used show rain values? Do you get the 1st error more than once a day?

The second error is from older routines still trying to run at midnight. To resolve this, on the device page hit the Clear State button, wait a couple of seconds and then scroll down and hit the Save Preference button. Hitting the Save Preference button may even fix the 1st error if you are seeing rain values from the weather station.

Let us know how it goes. @dJOS and I monitor this thread to provide support.

1 Like

And yet I somehow missed his post. :man_facepalming:

Hello, I'm new to HE, I'm moving over from STs. I have everything working and found your cool app. I've installed it from the package and can't get it to return data from a poll. I entered my station ID and API from my WU "member settings" "devices" page. My station is online and sending data. Do I perhaps need a new API? Can you have two or more APIs?

Here is my log:

[warn] WU weather api did not return data from poll1 - 401
[dev:58] formatLanguage = en-US
[dev:58] formatUnit = e
[dev:58] longitude: -80.731000
[dev:58] latitude: 39.914800
[dev:58] WU: Poll called
[dev:58] WU Driver State Cleared.
[dev:58] java.lang.StringIndexOutOfBoundsException: String index out of range: -1 on line 898 (method poll)
[dev:58] DegreeSign = °F

1 Like

Nevermind! I generated a new API and it's working fine now.

1 Like