getWeatherFeature() Error Checking

smartapp

#1

Hello,

Just created a Smart App to check if the potential for frosted car windows exist in the morning. I have this app check at a specified time and only if the conditions for frost are present, send a text message. My code works fines, not sure about my frost algorithm yet, but I have no error checking.

I know what the proper response should be when using getWeatherFeature(“conditions”, zip). However, how do I check for bad or no data? I have no idea what these conditions look like and can’t determine how to properly check for them? My concern is that the getWeatherFeature() stops working and I never know it. I’d like to set up an option that notify’s me if an error occurs.

Any suggestions are appreciated.

Thanks


#2

Try this but perhaps looks for different keyword


#3

Was able to find an example that appears to meet my needs:

data = getWeatherFeature( “conditions”, zipcode )
if (data.response.containsKey(‘error’)) {
//do something
}