A smart home not only provides convenience but also enhances security. In this automation guide, we will show you how to create an alarm system using devices you likely already have in use.

Automations

  • Events
    Contact Sensor Open
    Movement recognized
  • Conditions
    Nobody is at home
  • Actions
    Play siren
    Turn on lights in red

As AirPlay 2 speakers are exclusively available in the Apple Home app, but only one trigger can be added there, we will use both Apple Home and Controller for HomeKit for this automation. Additionally, in this case, we will start not with the usual automation creation but with the scene.

Create Scene

To create the scene that should be executed in case of an alarm, open Apple Home and create a new scene by tapping the plus icon in the top-right corner. If suggested scenes appear, tap “Custom” at the bottom.

Name the scene “Alarm” and choose a suitable icon.

Next, add accessories to be controlled in the event of an alarm using the “Add Accessories” button. Select colored lights and speakers for this purpose.

Turn on the colored lights and set the color to red.

For the speakers, choose “Media” and select “Play Audio,” set the volume to 100%, and tap “Choose Audio”.

Next, tap “Apple Music,” choose a siren as the title, and enable the “Repeat” switch.

Test the scene using “Test This Scene” to ensure everything works as expected. Finally, save the scene by tapping “Done.”

Events

  • Events
    Contact Sensor Open
    Movement recognized
  • Conditions
    Nobody is at home
  • Actions
    Play siren
    Turn on lights in red

Now we can create the actual automation. Open Controller for HomeKit and create a new automation using the plus icon in the top-right corner.

Add automation

Choose any accessory as a trigger for the alarm. We use a window sensor when it’s opened.

Use the “Add Starter Trigger” button to add additional triggers for each device serving as a trigger for the alarm. We add various contact sensors and motion detectors.

Give the automation a suitable name and icon.

Conditions

  • Events
    Contact Sensor Open
    Movement recognized
  • Conditions
    Nobody is at home
  • Actions
    Play siren
    Turn on lights in red

To prevent the alarm from being triggered when someone is at home and simply opens a window or moves around the house, add a condition using the “And the following conditions are met” button. Select “Presence” and then “Nobody is at home.”

Note: For Apple Home to detect the residents’ presence, each resident must carry an iPhone, be invited to Apple Home, and have location sharing enabled.

Actions

  • Events
    Contact Sensor Open
    Movement recognized
  • Conditions
    Nobody is at home
  • Actions
    Play siren
    Turn on lights in red

To trigger the alarm if a window or door is opened or motion is detected and no one is at home, link the scene created in Apple Home. Tap “Then execute these scenes” and choose the Alarm scene.

Finally, activate and save the automation.

When no one is at home and a window or door is opened or motion is detected, the lights will turn red, and an alarm will sound through the speakers.

Send Notification

In the event of an alarm, timely notification is crucial. In the Apple Home app, navigate to the accessory settings of the used sensors and enable notifications under “Status and Notifications”. To prevent notifications from being sent with every status change, it is recommended to activate the “When nobody is home” option under “People.”

This option must be activated for all sensors used in the automation. You will then receive a notification from Apple Home when the sensor status changes.

For more control over the notification content and when it should be sent, refer to the Custom Notifications chapter in our Controller course. There, you also have the option to send a critical notification.