Let's be Alert!

December 05, 2015 • David Holmes

SwitchThat One let you send emails, SMS text messages or even tweets as part of your Interactions. We'll take a look at how this feature could be used to set up a simple burglar alarm, and to tweet about the weather!

If you get stuck, take a look at the Alerting section in the User Guide.

Simple Burglar Alarm

Let's start by making our own simple Burglar alarm that will email or text us if someone enters our house while we are away on holiday. (If you plan to send text messages, you'll need to use one of the supported SMS providers - currently Kapow, Text Marketer, or a service that uses the SNPP protocol).

You will need to go to the 'Settings➞Alerting' screen to register your details, using 'Setup Email alerting' or 'Setup SMS alerting' to enter the details you've been assigned.

Once setup, click on the row in the Alerting table and use the 'Test' feature to confirm that it is working by sending yourself a test message.

We're nearly there now. In 'Settings➞Write a new Interaction' you can create an Interaction that triggers when there is motion and then sends an SMS.

For the 'If this:' part:

Devices['Motion sensor'].on? clamp true for 30.minutes, false for 0.seconds becomes true

and for the 'Then that:' part:

Alerts['sms'].send('012345678', "There's an intruder in the living room!')

You will need to adjust the names above (e.g. 'Motion sensor' and 'sms' to match your motion sensor and the name you assigned your alerting)

Using the 'clamp' functionality limits the number of SMSs that would get sent to once per half hour.


Now let's do something fun combining Alerts and Weather! This time we'll go to 'Settings➞Alerting' as before but set up a Twitter integration. Follow the on-screen steps, or look in the documentation.

Shall we let people know when the temperature is nice and warm? For the 'If this:' part:

Weather.temperature > 30 becomes true

and for the 'Then that:' part:

Alerts['Twitter'].send("The temperature is really pleasant today!!! I'm off to the beach")

We can have a lot of fun with this! We could let our followers know if it is really windy, or other exciting weather types. The possibilities are endless.

Here's a fun one to finish off for the forthcoming Festive Season. For the 'If this:' part:

Now.format("%m-%d %H:%M") becomes "12-25 08:00" and Weather.summary == 'Snow'

and for the 'Then that:' part:

Alerts['Twitter'].send("Waking up to Snow at Christmas -- that's how it should be!")

As you can see, there are lots of fun and practical uses for the SwitchThat One's Alerting functionality.