weather flow?

General discussions about Automagic and automation in general

Moderator: Martin

Post Reply
kingoflimbs
Posts: 4
Joined: 17 Feb 2013 00:48

weather flow?

Post by kingoflimbs » 20 Feb 2013 20:01

I've seen hints of there being flows that interact with weather conditions and forecasts. Does anyone have some they can share?

syndromtr
Posts: 31
Joined: 01 Feb 2013 13:28

Re: weather flow?

Post by syndromtr » 22 Feb 2013 13:40

hi, i had some research on this. i don't have a flow created yet but these steps can help you:

http://automagic4android.com/en/help/components all info is there as usual, http request action + script
you can download xml/rss with http request and by using script, you can get current condition, temperature etc, to variables and then finalize your flow.. an example flow: periodically http request current weather, get current condition using script, compare that text and assign a wallpaper & change wallpaper, or create an info window for weather alerts etc..

here are example xml/rss and info:
http://rss.wunderground.com/auto/rss_fu ... its=metric
http://weather.yahooapis.com/forecastrss?w=2343733&u=c
http://developer.yahoo.com/weather/ optional xml format help

of course you need to get your city/location code from homepages and exchange them with new code..

auto_wiz
Posts: 26
Joined: 30 Nov 2012 23:49

Re: weather flow?

Post by auto_wiz » 04 Mar 2013 00:37

I have 2 flows I use with http://www.wunderground.com. They both use your current passive (no GPS) location and one provides current ambient pressure and one is a general text forecast that I just built in response to another forum post. You will need to register on wunderground for an API key to use either of them.

Unfortunately most of their responses are in JSON format and require a bit of string searching/trimming etc to get out the specific item of info you want. I've pretty much got it licked though so long as you only need simple data, ie. not several days of forecasts, but I can get the first forecast on the response.

I'll de-personalise the flows and tidy them up a bit then post in the flow sharing area.

syndromtr
Posts: 31
Joined: 01 Feb 2013 13:28

Re: weather flow?

Post by syndromtr » 04 Mar 2013 06:42

hi again, after more research i'm also using wunderground api.
here is part of my flow (only to get variables - it's not in json format - it supports xml also)

action: HTTP request: "http://api.wunderground.com/api/API_KEY ... ntalya.xml"
GET - store to variable wea
(in the URL, lang:TR to get Turkish descriptions - wunderground api homepage has help all about those)


action: Script:

cur=evaluateXpathAsString(wea, "//weather");
temp=evaluateXpathAsString(wea, "//temp_c");
tfeel=evaluateXpathAsString(wea, "//feelslike_c");
winds=evaluateXpathAsString(wea, "//wind_kph");
windd=evaluateXpathAsString(wea, "//wind_dir");
updt=evaluateXpathAsString(wea, "//observation_time");
updt=replace(updt, "Last Updated on ", "");

when you add a debug dialog, you can see those variables are always ok and have appropriate strings..

Post Reply