How to trigger HomeKit automations with sensor values
Apple’s Home app allows triggering automation rules with sensor data, but only those that have an event based behavior such as Motion Sensors, Contact Sensors, and Smoke Sensors.
HomeKit itself does, however, support all kinds of sensor data and can trigger an automation when a sensor value crosses a threshold, such as temperature or light level. To do this you need a third party app, though. Here’s how to do it with three good options, Home+, Controller for HomeKit, and the Eve app.
Create a new automation, and from the initial screen tap Create Event Trigger at the bottom.
Tap Add Event…
Tap Accessory State from the list.
Tap Choose to select an accessory.
Tap the sensor to use, this will show all the characteristics available on that device.
Select the one to use, in this case Current Temperature.
You can now specify a specific Value, or a Range. A specific value will trigger when the sensor records that value only. This may be missed if the values change too quickly. To Avoid that use Range. This will trigger when the value enters the range from above or below.
Tap Save at the top.
Double-check the event shows the correct Range, it can mess up sometimes and need to be selected again.
Select a Scene to trigger under Perform Actions.
When happy, ensure Enable Automation is turned on at the top and tap < Automation to go out of the editor.
Controller for HomeKit
From the Automations section, create a new automation.
Enter a name for the automation and tap Add.
Tap Add event-based automation, this will take you to the rule editor.
Tap Add start event at the bottom.
Select Value of a characteristic from the options.
Select the sensor to use from the accessory list, note this list breaks out each characteristic you can use.
You’ll need to select the specific characteristic to use on the next screen, in this case Current Temperature.
You’ll be back on the editor screen, tap the Start Event to edit the value.
Select the value using the slider, or tap the keyboard icon to enter it manually. Note that Controller doesn’t allow you to create a range, but it can edit a range that has been created in another app.
Tap Select scenes to add actions for this rule.
Ensure the rule is Enabled at the top, and tap Back again to exit the editor.
Under the Automation section, select Rules from the top of the screen, and then Add Rule at the bottom of the list.
Review the rule steps and tap Next.
Tap Add Trigger.
You can select a common sensor type from the list, or use Other Value. These options just filter the accessories for easier selection.
Scroll through the list and select the room, then the sensor value you want to use.
Now simply select if you want to trigger when the value is above (>=) or below (<=) a specified threshold, and what that threshold is.
Tap Add at the top.
Tap Next at the top.
Tap Next on the Conditions screen.
Select the scenes you want to trigger with this rule and tap Next.
Enter a Rule Name.
Using this process you can effectively trigger automation rules from any accessory value you like, not just sensor events that Apple’s own app exposes. This greatly increases the flexibility you have over your automation rules and can allow you to explore more intelligent state based home behavior rather than just event based actions.