Current weather

Post your questions and help other users.

Moderator: Martin

Akt
Posts: 133
Joined: 25 May 2014 08:57

Re: Current weather

Post by Akt » 23 Feb 2017 02:41

http://automagic4android.com/flow.php?i ... 8d7ff073c4

Dear scotty,
I tried to make an forecast flow, but I have some questions to ask.
By executing this flow , I only get first forecast shown.
I want to get all the forecast shown in the list along wuth days shown corresponding to the forecast.
Can you help me in writing the script to extract the required information?
Thanks.

User avatar
Scotty
Posts: 78
Joined: 26 Aug 2016 20:29
Location: Southern California

Re: Current weather

Post by Scotty » 24 Feb 2017 16:51

Akt wrote:Thanks scotty.
What else can be written in place of conditions?
See this page.

Akt
Posts: 133
Joined: 25 May 2014 08:57

Re: Current weather

Post by Akt » 25 Feb 2017 01:29

Hi scotty,
Thanks for the link.
Can you also help me in my last query also.
In short,
If there are more than one xpath in evaluateXPathAsString in one xml, then it shows only the first xpath of the xml, but I want all the xpath to be shown.
Can you help me in writing the script for this ?

User avatar
Scotty
Posts: 78
Joined: 26 Aug 2016 20:29
Location: Southern California

Re: Current weather

Post by Scotty » 25 Feb 2017 20:29

Akt wrote:Hi scotty,
Thanks for the link.
Can you also help me in my last query also.
In short,
If there are more than one xpath in evaluateXPathAsString in one xml, then it shows only the first xpath of the xml, but I want all the xpath to be shown.
Can you help me in writing the script for this ?
Sorry, I don't understand what you mean by the sentence beginning If there are...

Again: the http request retrieves all of the information that you ask for (exactly WHAT it retrieves depends on what you ask for - conditions, forecast, etc.)

ALL OF that information is stored in a variable (or a file, if that's what you select).

Then, you design the script to extract the info that you actually want to use (for example, perhaps you want to use the current temp in a condition, and the wind speed in a widget). So, in my bare bones flow (posted above), the script contains a single line:

global_CurrentTemp=evaluateXpathAsString(weather, '//temp_f');

That line looks at the variable weather, finds the string temp_f, and extracts the data (the temp, in F). This new variable (global_CurrentTemp) can be used as you see fit (condition, widget, etc.).

If you want to extract additional variables, you simply add additional lines to the script. For example, the following will extract the temp in both F & C (and will write each value to its own variable):

global_CurrentTemp=evaluateXPathAsString(weather, '//temp_f');
global_CurrentTempC=evaluateXPathAsString(weather, '//temp_c');

Akt
Posts: 133
Joined: 25 May 2014 08:57

Re: Current weather

Post by Akt » 26 Feb 2017 11:58

Hi scotty, you did not understand now also, but I found my solution and my flow is complete.
Thanks for your help in making my flow.

jmckeejr
Posts: 34
Joined: 03 May 2015 12:29

Re: Current weather

Post by jmckeejr » 16 Feb 2019 15:34

I would like to know if anyone has a flow to get the current zip code or location that can be parsed to zip code or city? I want to be able to have my weather widget update with location instead of only being for the location that I provide. Any help appreciated. I did see another thread about this but I am having trouble getting Google api to work for location

EDIT: I over thought this, weather underground accepts the latlong position for weather so it's working great. I would just love to be able to add custom fonts. Is this possible?

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Current weather

Post by Desmanto » 16 Feb 2019 18:28

Oh, you got the solution already. But as your question before, you can find the city from the latlong using osm, I have shared the flow. Look at here : viewtopic.php?f=5&t=7457

By custom fonts, do you mean the custom font in Automagic's widget or the message dialog? Built-in widget is kinda limited, have to accept what it is.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

jmckeejr
Posts: 34
Joined: 03 May 2015 12:29

Re: Current weather

Post by jmckeejr » 23 Feb 2019 20:02

I found you can actually choose custom fonts you have stored on device through the text options on widget creation page.

Post Reply