Minimum temperature in next 12 hours


#1

1) Give a description of the problem
current piston is very lengthy and feels heavy on resources

2) What is the expected behaviour?
simplified piston with less variables

3) What is happening/not happening?
Current piston takes a bit of time to provide result. Can this be made faster by simplyfying.

4) Post a Green Snapshot of the pistonimage

5) Attach logs after turning logging level to Full
(PASTE YOUR LOGS HERE THEN HIGHLIGHT ALL OF THE LOGS AND CLICK ON THE </> ICON TO FORMAT THEM CORRECTLY)

REMOVE BELOW AFTER READING
If a solution is found for your question then please mark the post as the solution.


#2

weather api link

https://api.openweathermap.org/data/2.5/onecall?lat=-37.8781&lon=145.1648&exclude=current,minutely,daily,alerts&units=metric&appid=apikey


#3

another piston for different website

https://api.weather.bom.gov.au/v1/locations/r1r0rr/forecasts/3-hourly

Can these be simplified please?

expected result
min temp: ** ( rounded off whole number in celcius) eg:7
at this time: ** AM/PM (only the hour , considering day light hours) eg:4AM


#4

Since I don’t have an account for openweather, do you have an example of the raw $request output.


#5

I would suggest using a for loop. I am abbreviating but something like this:

time1=now
http get
mintemp=response[0]
mintime=time1
for ($index=1 to 11 step 1)
  if response[$index]<mintemp
    mintemp=response[$index]
    mintime=Time1+$index hours
  end if
end for
@min_temp_open=mintemp
@min_time_open=mintime

You need one extra variable (mintime) but get rid of all the temps.


#6

Perfect!!! Followed your explanation.

I made few rookie mistakes while creating this piston, but fixed them at the end.

Thank you so much.


#7

Thank you for your response. It has been resolved now.

I am trying to figure out simplification of the other piston.
The one with this api
https://api.weather.bom.gov.au/v1/locations/r1r0rr/forecasts/3-hourly


#8

This one turned out well too.

Thank you so much guys!