Incorporating the weather in your sequences

A couple of weeks ago we added a new option in the variable value condition which allows you to check if a variable contains a particular value. This can be useful if you have variables which hold a string of text and there’s something in particular you’re looking for in that text, without it needing to be an exact match.

One example a user came up with for this was to use the Weather Underground service at IFTTT to pull the current weather into their sequences. The set up is quite simple, and can allow you to add some handy conditions to your sequences.

Accessing parameters from a webhook call

Let’s get started by setting up the sequence in SEQUEmatic. There’s a handy feature which allows you to access values from webhook parameters directly in your sequence. All you have to do is enclose the parameter names in curly brackets like this – {weather_conditions}.

Firstly, add the IFTTT webhook trigger to your sequence. For any parameters you want to access in your sequence, you should specify their names in the step. In the example below we will be passing the current weather condition in the first parameter and the current temperature in the second parameter.

With this configuration, you can access the value of those two parameters when updating a variable or checking a condition by referencing them as {weather_condition} or {temperature}. Note that these values are only available for the current sequence, so to use them in other sequences you should store them in one of your SEQUEmatic variables.

You can do this easily using the change variable step as follows. Add a step to change a variable. Set a name for your variable, such as temp, and then set the change to ={temperature}. If we break this down, the = sign tells SEQUEmatic to set the value of the variable and {temperature} will take the value passed in the second parameter from IFTTT.

You can add another step to capture the weather conditions as well. Overall your sequence should look something like this.

With the weather conditions now stored safely in your variables, you can reference them in any other sequence using the variable names! Here’s an example of what you might see in your variable page after the sequence has run:

Setting up the IFTTT applet

The final step to get this working is to put the correct URL in the IFTTT applet. Firstly, take the URL provided in the first step of your sequence. In our example this is:

http://sequematic.com/trigger-ifttt-webhook/ABCDEFGHIJK/12345/forecast

And now you need to add IFTTT ingredients for the two parameters. Parameters should be added on the end of the URL, separated by a forward slash / . So, to pass the current conditions and current temperature, your URL would look like this:

http://sequematic.com/trigger-ifttt-webhook/ABCDEFGHIJK/12345/forecast/{{CurrentCondition}}/ {{CurrentTempCelsius}}

You can view the full IFTTT applet below. Just click the thumbnail to view the full image.

Using the contains condition

Now you have this set up, how can you build the weather into your sequences?

An example of a comparison might be that if it’s cloudy then you want to open your blinds. There are many different weather conditions which can come from the Weather Underground service, so it may not always be cloudy, but instead something like partly cloudy. Using the contains feature we mentioned at the start of this post you can cover all the different cloudy variations. Here’s what your sequence might look like:

Every day at sunrise this sequence will check if it’s cloudy and then either open or close the blinds

If you have any questions setting up the sequence and IFTTT applet, or some ideas on how to use it differently, please post in the comments below!