Chapter 12. Interactions

SwitchThat One Interactions allow you to harness and combine your smart devices to automate your smart home in ways that would be impossible just by using the manufacturers’ apps.

With Interactions, you can:

There are two ways you can create Interactions:

  1. Interaction Builder: an easy-to-use visual tool that allows you to quickly build simple Interactions. This approach is recommended for getting started, and a detailed step-by-step guide is presented in Section 12.1, “Interaction Builder”.

  2. Advanced Interaction Editor: for when you need to create more sophisticated Interactions than are possible with Interaction Builder. This approach is for more advanced users who feel comfortable writing simple scripts. You can learn how to use the advanced editor in Chapter 13, Advanced Interactions.

12.1. Interaction Builder

The best way to get started with Interactions is to start creating them, and the easiest way to do this is by using the Interaction builder. The basic principle behind an Interaction created in Interaction Builder is:


An event can be something like ‘at a specific time every day’ or ‘when a motion sensor detects motion’. An action can be something like ‘turn that switch on’, or ‘set my light to that colour’.

12.1.1. Getting Started

To start working with Interaction Builder tap Settings in the menu at the top of the screen, find the Interactions section and tap Interaction Builder You’ll now see the Interaction Builder interface:

The Interaction Builder

The Interaction Builder


Tip

If you can’t see the Settings menu item, make sure you are signed in as an Owner user.

First, enter a name for your Interaction in the Interaction Name box. You can change this name later, so don’t worry if you can’t think of the perfect name now.

Below Interaction Name there are two sections, labelled If This and Then That. This is where you’ll create your Interaction, and we’ll discuss these sections in detail next.

12.1.2. If This

The If This section is where you define an event to trigger your desired action. We’ll take a quick step-by-step look at how this works.

To start with, you can choose between a device event or a general event. Device events are things that might happen to one of your devices, for example a light is turned on or a motion sensor detects motion. General events are to do with things like time or the weather.

Tap Event to select a general event. Event will now be selected and a choice of event types will appear below it.

Choosing an If This event type

Choosing an If This event type


Currently only time-based general events are supports, so tap Times, Days & Dates You’ll be presented with a choice of time-based events:

Choosing a time-based If This event

Choosing a time-based If This event


Tap At this time every day to select your event. Some events can be customised and, when selected, will show a widget to allow you to change the event settings. In this case, you are shown a control that lets you set the specific time of day you want your action to fire.

An If This event is selected

An If This event is selected


For the purposes of this walkthrough, set a time in the near future.

Customising the If This event

Customising the If This event


And that’s it, you’ve now defined your If This event!

Tip

If you make a mistake or change your mind, simply tap the < symbol on the right-hand-side of the selection you wish to change and you will be taken back a step.

12.1.3. Then That

The Then That section is where you choose the action(s) you want to trigger when the If This event occurs. You can define up to 5 actions as part of a single Interaction.

We’ll continue the step-by-step look at how this works.

To start with, you must choose a ‘thing’ to perform the action. You can choose either a device, room or shortcut. For example, you might want to turn a specific device on, or perhaps have all the devices contained in the shortcut ‘Downstairs lights’ turn on. There’s a further category of things, called Other, and this allows you to do things such as send alerts.

For this example, we’ll choose a device so tap Device and a list of devices will appear.

Choosing a Then That device

Choosing a Then That device


Note

Most, but not all, types of device can be used in Interaction Builder. If a device doesn’t appear in this list, then it can’t be used in Interaction Builder.

Tap a device to select it. You’ll be presented with a choice of actions that device can perform. What actions are available will depend on the type of device; for example, a light will have actions to turn it on, off, set the brightness and perhaps its colour. A media player will have actions to play or pause, and perhaps set the volume.

Choosing a Then That action

Choosing a Then That action


Some actions can be customised and, when selected, will show a widget to allow you to change the action settings. For example you might choose the colour that a light should be set to. Choose an action you’d like to test and change its settings as appropriate.

Customising the selected Then That action

Customising the selected Then That action


12.1.3.1. Multiple Then That actions

You might want to do more than one thing in the Then That part of your Interaction, e.g. turn several lights on at once. Interaction Builder let you define upto 5 Then That actions in a single Interaction.

To add a further Then That action you should tap the Add another button, found below the existing Then That action. A new set of Then That buttons will appear allowing you configure the additional action. Further actions can be added in the same way.

The following image shows the Then That section of an Interaction where two lights are configured to switch on when the Interaction is triggered.

Defining more than one Then That action

Defining more than one Then That action


If you need to get rid of one or more of the existing Then That actions, then tap the Edit list button, found at the bottom of the list.

Editing the list of Then That actions

Editing the list of Then That actions


Tap the Remove button below any action you wish to remove from the list. Tap Done when you have finished.

12.1.4. Saving and Running the Interaction

The final step is to save your Interaction and (optionally) start it running. If you want this Interaction to start running immediately, then check the Start this interaction running box. The following image shows how the completed Interaction looks in Interaction Builder.

The finished Interaction

The finished Interaction


Tap Save to finish creating your Interaction. You’ll be taken to the My Interactions screen, where you’ll see the newly-created Interaction.

12.2. The My Interactions screen

The My Interactions screen shows all of your Interactions, and allows you to control and edit them. To access My Interactions, tap Settings in the menu at the top of the screen. Find the Interactions section and tap My interactions

The My Interactions screen

The My Interactions screen


Your Interactions are shown as tiles. If an Interaction is running, it will have a green border and a green ‘playing’ symbol in the top-left corner. An Interaction that is not running will have a grey border, and no ‘playing’ symbol.

To access one of your Interactions, tap its tile. The other Interactions will be hidden, and a menu will appear showing the various things you can do to the selected Interaction. You can start, stop, edit & remove an Interaction from this menu, control quick access, and deal with Interaction errors, should they arise. We’ll discuss each of these in the following sections.

Tap an Interaction to show the menu

Tap an Interaction to show the menu


12.2.1. Starting / Stopping an Interaction

To start an Interaction:

  1. Tap on the Interaction to show the menu.

  2. Tap Start

To stop an Interaction:

  1. Tap on the Interaction to show the menu.

  2. Tap Stop

12.2.2. Editing an Interaction

To edit an Interaction:

  1. Tap on the Interaction to show the menu.

  2. Tap Edit in Interaction Builder to open the Interaction in Interaction Builder.

Alternatively you can tap Edit in advanced editor to edit the Interaction using the advanced editor. This is recommended for experienced users only – see Chapter 13, Advanced Interactions for full details.

Note

Note if you edit and save an Interaction using the advanced Interaction editor then you will no longer be able to open it in Interaction Builder.

12.2.3. Quick access to Interactions

Quick access allows you to easily turn an Interaction on/of from anywhere in the SwitchThat One UI, rather than just from the My Interactions screen. This can be useful if you have some Interactions that you frequently enable/disable.

To enable quick access to an Interaction:

  1. Tap on the Interaction to show the menu.

  2. Tap the Quick access item and a tick will appear next to it.

Enable quick access to an Interaction

Enable quick access to an Interaction


You’ll now see a list of Interactions next to the Shortcuts list, visible in the control panel on the right hand side of the screen on larger displays, or, on smaller mobile devices, from the menu accessible by tapping the button on the right hand side of the bottom toolbar.

Quick access to an Interaction using a tablet

Quick access to an Interaction using a tablet


Only the Interactions for which you’ve enabled Quick access will appear in this list.

You can tap on an Interaction to start it running, or to stop it. Interactions that are running will have a little ‘play’ symbol next to them.

If you want to stop an Interaction from appearing in the quick access list, then follow the same procedure for adding it, but this time make sure that the tick does not appear next to the Quick access item in the menu.

Note that if you have not enabled quick access for any Interactions, the quick access list will not appear in the UI.

12.2.4. Removing an Interaction

To remove an Interaction:

  1. Tap on the Interaction to show the menu.

  2. Tap Remove to remove the Interaction. You’ll be asked to confirm you want to do this.

12.3. Further Interaction Builder examples

12.3.1. Sending alerts

You can send an external alert, such as an email, SMS text message or even a tweet, as the Then That action of an Interaction. This enables you to create interactions to do things like warn you by text or email if a motion sensor in your garage is triggered at night.

To user alerts in your Interactions, you must first set up one or more alerting services, which integrate SwitchThat One with your email, SMS or Twitter accounts. See Section 8.4, “Alerting services” for full details of how to setup an alerting service.

Let’s look at an example of how to send an alert from an Interaction. Create a new Interaction in Interaction Builder and, first of all, configure the If This section for whatever event you’d like to trigger sending an alert.

In the Then That section, tap Other and then tap Alerts. If you don’t see the Alerts button then that means you haven’t setup any alerting services (See Section 8.4, “Alerting services” for details of how to do this).

You’ll see an action for each type of alerting service you’ve configured: Send email, Send SMS and/or Send tweet. Each action only appears in the list if at least one corresponding alerting service has been setup.

Using alerts in Interaction Builder

Using alerts in Interaction Builder


Tapping on an action will show a widget allowing you to configure the alert that will be sent when the If This event of the Interaction is triggered.

12.3.1.1. Configure sending an email

Tap Send email and a widget will appear where you can enter the To address, subject line and the body text of the email you’d like to be sent.

If you’ve set up more than one email alerting service, there’ll also be a box where you can choose which one to use to send the email.

12.3.1.2. Configure sending an SMS text message

Tap Send SMS and a widget will appear where you can enter the destination telephone number and the body of the text message you’d like to be sent.

If you’ve set up more than one SMS alerting service, there’ll also be a box where you can choose which one to use to send the text message.

12.3.1.3. Configure sending a tweet

Tap Tweet and a widget will appear where you can enter the text of the tweet you’d like to be sent.

If you’ve set up more than one Twitter alerting service, there’ll also be a box where you can choose which one to use to send the tweet.

Note that Twitter places restrictions on how often you can tweet the same message (or ‘status’ as Twitter describe it.) Generally speaking, attempting to tweet the same message more than once within a 24 hour period will fail (consult Twitter’s documentation for full details). You should bear this in mind when creating an Interaction that generates tweets.

If an Interaction causes multiple tweets within a short period of time, all but the first will be rejected by Twitter, and the rejected tweets will cause your Interaction to generate errors. In such cases you should consider changing your Interaction to either avoid sending tweets too frequently, or to use an alternative alerting service (e.g. email or SMS).

See Section 12.4, “Dealing with Interaction Errors” for full details of Interaction errors and how to deal with them.

12.4. Dealing with Interaction Errors

If SwitchThat One encounters a problem with an Interaction while it is running then it will generate error messages, which can be used to understand the cause of the problem and, if possible, fix it.

Some possible reasons for an Interaction to generate errors are:

  • A device used in the Interaction has been renamed. The Interaction will no longer be able to find the device, as it will still be using the original name. You’ll need to edit the interaction to make sure it’s working with the correct device.

  • A device used in the Interaction has been removed from SwitchThat One. You’ll need to edit the Interaction to work with an alternative device, or remove the Interaction entirely.

  • The Interaction was meant to send an alert, but sending failed for some reason. Perhaps SwitchThat One was unable to contact your email SMTP server, or Twitter rejected a duplicate tweet.

If one or more Interactions have errors, a warning will be shown in a number of places within SwitchThat One:

  • Next to Settings in the menu at the top of the screen.

  • Next to My interactions on the Settings page

  • The Interaction itself will be highlighted in red in the My Interactions screen

Interaction errors shown in the menu and on the Settings screen

Interaction errors shown in the menu and on the Settings screen


Interaction errors as seen on the My Interactions screen

Interaction errors as seen on the My Interactions screen


12.4.1. Viewing an Interaction’s errors

To view the errors that an Interaction has generated, visit the My Interactions screen, find the Interaction and tap it to show the menu.

Viewing Interaction errors

Viewing Interaction errors


Tap View Errors and you’ll be taken to a screen listing all the errors that have been generated by this Interaction.

Detailed list of errors generated by an Interaction

Detailed list of errors generated by an Interaction


The list shows each unique error message, the number of times the error has occurred and the first and last times that it occurred.

You should use this information to determine whether (and how) the Interaction needs be edited to fix the problem, or if the Interaction must be removed entirely.

Tap Edit in Interaction Builder or Edit in advanced editor to edit the Interaction. Tap Remove if you can’t fix the Interaction and it must be removed entirely.

If you choose to edit the Interaction, you’ll also need to clear the errors, otherwise they’ll still be visible. You can clear the Interaction errors in a couple of ways:

  • When editing the Interaction tick the Clear all Interaction errors box before saving the Interaction.

  • Visit the View Errors screen for the Interaction and tap Clear errors