Apologies, @DanT or @pebneter, hoping to grab a hint about what to do next. This is what I’ve done so far:
Core:
- Activated pipedreams
- Activated OpenWeatherAPI, tested API key successfully for 7 day forecast (in both browser & pipedreams)
- Upgraded Apilio to enable API access
Code:
Node 1:
Setting aside for now the actual trigger (“Node 0”, which I presume I can trigger in IFTTT on a date/time basis to run weekly), in PipedIream, I have the following in my first node:
import { axios } from "@pipedream/platform"
export default defineComponent({
props: {
openweather_api: {
type: "app",
app: "openweather_api",
}
},
async run({steps, $}) {
return await axios($, {
url: `https://api.openweathermap.org/data/3.0/onecall`,
params: {
lat: `mylat`,
lon: 'mylon',
cnt: '7',
units: 'metric',
appid: `${this.openweather_api.$auth.api_key}`,
},
})
},
})
Node 2:
This is followed by the Apilio node, which evaluates successfully once the account was upgraded:
import { axios } from "@pipedream/platform"
export default defineComponent({
props: {
apilio: {
type: "app",
app: "apilio",
}
},
async run({steps, $}) {
return await axios($, {
url: `https://api.apilio.com/api/v1/boolean_variables`,
auth: {
username: `${this.apilio.$auth.username}`,
password: `${this.apilio.$auth.password}`,
},
})
},
})
Back in Apilio, I created:
SunInForecast - a boolean variable, currently set in False state
ExpectingNiceWeather - condition linked to SunInForecast, must be true
NotExpectingNiceWeather - condition linked to SunInForecast, must be false
I presume then back in Pipedreams, I have to create a PUT request to store each of the 7 days temperature? Recall that I seek to ultimately schedule potential days to go cycling if the temperature is “good” (say, the feels_like parameter is > 5 degrees celsius.) Alternatively, the date/time trigger could run on a daily basis and evaluate the 7th day out on a rolling basis (e.g., each day, check the 7th day out - so each day is evaluated on its own as opposed to analyzing 7 days at a time.)
Here’s an example response from OpenWeather evaluated via Pipedreams:
steps.code{1}
$return_value{8}
lat:mylat
lon:-mylon
timezone:`mytimezone`
timezone_offset:-99999
current{15}
dt:16766734234529
sunrise:167234234024
sunset:234234
temp:5.38
feels_like:12.38
pressure:1212
humidity:12
dew_point:-5.00
uvi:0
clouds:30
-more-
minutely[61]
hourly[48]
daily[8]
0{20}
1{18}
2{18}
3{18}
4{18}
5{19}
dt:12312312
sunrise:123123123
sunset:123123
moonrise:12312312312
moonset:1671232320
moon_phase:0.06
temp{3}
feels_like{6}
pressure:1212
humidity:23