Weather Underground Web Smartapp: the "poor guy" weather station with event based switches automation [Deprecated. See Weather Company version below]

log.debug mymap

this will dump that:

6‎:‎04‎:‎25‎ ‎PM: debug [response:[features:[conditions:1], termsofService:Login | Weather Underground, version:0.1], current_observation:[wind_gust_mph:0, precip_1hr_metric: 0, precip_today_metric:0, pressure_trend:+, forecast_url:Local Weather Forecast, News and Conditions | Weather Underground, history_url:http://www.wunderground.com/weatherstation/WXDailyHistory.asp?ID=KNJMONRO19, estimated:[:], weather:Clear, windchill_string:NA, station_id:KNJMONRO19, UV:0, observation_epoch:1532653459, wind_gust_kph:0, precip_1hr_in:0.00, observation_time:Last Updated on July 26, 9:04 PM EDT, feelslike_string:85 F (30 C), temp_f:80.2, local_tz_long:America/New_York, relative_humidity:84%, temp_c:26.8, image:[title:Weather Underground, link:http://www.wunderground.com, url:National and Local Weather Radar, Daily Forecast, Hurricane and information from The Weather Channel and weather.com], solarradiation:–, visibility_mi:10.0, observation_location:[full:Trenton, New Jersey, elevation:49 ft, state:New Jersey, longitude:-74.44, latitude:40.36, country_iso3166:US, country:US, city:Trenton], wind_mph:0, heat_index_c:30, precip_today_string:0.00 in (0 mm), observation_time_rfc822:Thu, 26 Jul 2018 21:04:19 -0400, feelslike_f:85, heat_index_f:85, feelslike_c:30, heat_index_string:85 F (30 C), ob_url:Local Weather Forecast, News and Conditions | Weather Underground, dewpoint_string:75 F (24 C), local_tz_offset:-0400, wind_kph:0, windchill_f:NA, windchill_c:NA, wind_degrees:3, pressure_in:29.90, dewpoint_c:24, pressure_mb:1012, icon:clear, local_time_rfc822:Thu, 26 Jul 2018 21:04:25 -0400, precip_1hr_string:0.00 in ( 0 mm), icon_url:National and Local Weather Radar, Daily Forecast, Hurricane and information from The Weather Channel and weather.com, wind_dir:North, dewpoint_f:75, nowcast:, display_location:[zip:08831, magic:1, full:Monroe Township, NJ, elevation:21.9, state:NJ, wmo:99999, longitude:-74.44000244, latitude:40.34999847, state_name:New Jersey, country_iso3166:US, country:US, city:Monroe Township], visibility_km:16.1, temperature_string:80.2 F (26.8 C), local_tz_short:EDT, local_epoch:1532653465, wind_string:Calm, precip_today_in:0.00]]

And you can then see that the weather station they are using is at:

observation_location:[full:Trenton, New Jersey, elevation:49 ft, state:New Jersey, longitude:-74.44, latitude:40.36, country_iso3166:US, country:US, city:Trenton],

to compare to the city you indicated (here is what get when I use your string to call the API):

display_location:[zip:08831, magic:1, full:Monroe Township, NJ, elevation:21.9, state:NJ, wmo:99999, longitude:-74.44000244, latitude:40.34999847, state_name:New Jersey, country_iso3166:US, country:US, city:Monroe Township],

So I believe that you should get the same information without entering the city, state if your hub is setup with similar location.
You can compare the longitude latitude you see in the coordinate of your “My Location” in the IDE and what you have in the display_location:

They should be close.

Hope it helps

1 Like

OK Trenton is about 14 miles from me. When I use the Town of Monroe Township I get this. Which is Twin Rivers about 1,000 feet from here.

[response:[features:[conditions:1], termsofService:Login | Weather Underground, version:0.1], current_observation:[wind_gust_mph:0, precip_1hr_metric: 0, precip_today_metric:0, pressure_trend:+, forecast_url:Local Weather Forecast, News and Conditions | Weather Underground, history_url:http://www.wunderground.com/weatherstation/WXDailyHistory.asp?ID=KNJEASTW10, estimated:[:], weather:Clear, windchill_string:NA, station_id:KNJEASTW10, UV:0, observation_epoch:1532658352, wind_gust_kph:0, precip_1hr_in:0.00, observation_time:Last Updated on July 26, 10:25 PM EDT, feelslike_string:72.1 F (22.3 C), temp_f:72.1, local_tz_long:America/New_York, relative_humidity:96%, temp_c:22.3, image:[title:Weather Underground, link:http://www.wunderground.com, url:National and Local Weather Radar, Daily Forecast, Hurricane and information from The Weather Channel and weather.com], solarradiation:–, visibility_mi:10.0, observation_location:[full:Trenton, New Jersey, elevation:144 ft, state:New Jersey, longitude:-74.47, latitude:40.22, country_iso3166:US, country:US, city:Trenton], wind_mph:0, heat_index_c:NA, precip_today_string:0.00 in (0 mm), observation_time_rfc822:Thu, 26 Jul 2018 22:25:52 -0400, feelslike_f:72.1, heat_index_f:NA, feelslike_c:22.3, heat_index_string:NA, ob_url:Local Weather Forecast, News and Conditions | Weather Underground, dewpoint_string:70 F (21 C), local_tz_offset:-0400, wind_kph:0, windchill_f:NA, windchill_c:NA, wind_degrees:158, pressure_in:29.92, dewpoint_c:21, pressure_mb:1013, icon:clear, local_time_rfc822:Thu, 26 Jul 2018 22:44:14 -0400, precip_1hr_string:0.00 in ( 0 mm), icon_url:National and Local Weather Radar, Daily Forecast, Hurricane and information from The Weather Channel and weather.com, wind_dir:SSE, dewpoint_f:70, nowcast:, display_location:[zip:08520, magic:2, full:Twin Rivers, NJ, elevation:36.9, state:NJ, wmo:99999, longitude:-74.470000, latitude:40.260000, state_name:New Jersey, country_iso3166:US, country:US, city:Twin Rivers], visibility_km:16.1, temperature_string:72.1 F (22.3 C), local_tz_short:EDT, local_epoch:1532659454, wind_string:Calm, precip_today_in:0.00]]

hi all, just installed this this but cant find where to add my location and it dosent seam to be using my most local date.

am i missing where to add lat/long or post code?

Hi Mark

it uses by default your hub location. if you want to specify a different location, you could change the line calling the weather api in both the smartapp code and the dth.

Help…New to smartthings and the Groovy programming language. Trying to get the smartapp to trigger some switches when I have a high temperature. Installed smartapp and device handler per instructions. When I try to setup a trigger in the simulator I get a very long string of errors starting with:

grails.validation.ValidationException: Validation Error(s) occurred during save():

  • Field error in object ‘physicalgraph.app.InstalledSmartApp’ on field ‘state’: rejected value [COMPLETE]; codes …

In the phone app I just get an “Error saving page”.

I copy/pasted the code directly from the Github into my smartthings IDE

Any help would be much appreciated.

Check what I have done here and adapt the code to your need: https://github.com/philippeportesppo/AirMentorPro2_SmartThings/tree/master/smartapps/philippeportesppo/iaq-vent.src

You can post your code snippet in a PM to me and I will help you this weekend if you cannot make it by your own

It was a long weekend…I’m not sure what a CO2 vent has to do with a weather underground smart app/device handler. Maybe I’m just confused. Also, I guess I’m too new to smartthings community and I can’t PM you my code. Do you have any other suggestions?

the CO2 bent smartapp shows how to turn on off switch based on event.

I am PM you now. Please reply with your code copy/paste.

Thanks @geoengineer44 for pointing out the issues with the DTH. This has been normally fixed in the latest https://github.com/philippeportesppo/WeatherUndergroundWeb_SmartThings on the master branch.

im using the current (as well as alerrts)conditions, but logging the observation time, i find it going back in time and not updating for ageses. the loging is for “$mymap.current_observation.observation_time”

image
and
image

I know I’m late to the party, but perhaps I am missing something. Where and how do I specify which weather station I want to use? I own two personal weather stations, yet I don’t see how I can force it to use a specific one based on its unique station ID (such as KMDBALTIXXX).

never too late to do good :wink:

Try something like this:
def params = getWeatherFeature(“conditions”,“pws:KNJHGIGHT6”)

That should do the trick :wink:

Thank you for the suggestion. When I tried it, it worked for a bit and then stopped. Everything is blank and nothing refreshes. What I’m trying to do is use my personal weather station (and another outdoor sensor) as devices in my SmartThings account. I want to be able to use them as basic temperature and humidity sensors, which I can implement within automations and routines. Since they are both Ambient Weather brand, I tried another route of using a smart app which a developer made that requires an API and application key. That didn’t work either.

FWIW - WU’s API will be discontinued in Dec. I would not put much effort into it.

I am not sure.

See https://apicommunity.wunderground.com/weatherapi/topics/end-of-service-for-the-weather-underground-api

There seems to be another API to be roll-out for paying customers and we basically are paying customers through the ST API.

So since we go through Smartthings API that relies on the WU service, I am not sure we are going to suffer a disruption. This needs ST to confirm (@Dianoga ??).
After all, we don’t really care ST uses WU or whoever as long as ST provides access to the API.

(Funny fact: if you go to WU right now, you can no longer access the API as before, but using the API hyperlink in ST documentation of the getWeatherFeature, this still go to the right pages.)

This as well will apply since many ST users using the WU API also are WU providers.

“If you are a Personal Weather Station owner, you will receive more information about our plan to offer free access to the data you provide to Weather Underground. We’ll reach out once that plan has been finalized.”

Pretty sure this was not in the first notice I saw (a Reddit link).

I am still little confused. Where do you add this params? DTH or code in SmartApp?

Both or DTH only, it’s up to you:

The smartapp statement is used to name the DTH so that it will appear as “Weather in xxxx”
The default behavior is to use your hub location and I can only find the location by calling it.

In the DTH, it is really used to query the weather conditions.

Hope it helps and please remember that the DTH queries every 10min and using so, I never had a problem of refresh. Querying too often might cause an excess to the limit ST contracted with WU.

Thanks for your prompt reply. I tried to add to either DTH or App code, I still have error. Please see below. In DTH, which line number should I add to?

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
script_dth_metadata_4610f828_c3a1_4355_a67c_ecdb4d5aee08: 17: Invalid variable name. Invalid character at position: 11 of value: ” in name: KCAPASAD23”
. At [17:49] @ line 17, column 49.
therFeature(“conditions”,“pws:KCAPASAD23
^

1 error

I don’t have your code but I suppose that you are not using the right double quotes around the second string or forgot to close the string by one double quote.

For some reasons, copying pasting from this forum leads to incorrect double quotes. you have to ensure you are using " and not the up/down ones.