With iOS 11, Apple has enabled more complexity in the triggers for HomeKit scenes and events, making them adaptable to a wider variety of circumstances -- such as only turning off the lights in your home when everyone has left.
The central shift is support for conditional triggers -- a simple example being that if a lighting scene is set to run when someone returns home, it can be limited to running after dark. A cooling scene might run only when someone is home and a certain temperature is hit.
This links with another addition, multi-person geofencing, to make HomeKit much more suitable for couples and families. Previously location-based scenes were tied to a single device and, in essence, one person.
In iOS 11, scenes can be set to run only when one person comes or goes, or when everyone in the same HomeKit group does -- naturally, this assumes everyone has an Apple mobile device. Air conditioning for instance can remain on until the last person leaves the house, and resume when the first person returns. Forgetful family members might have the lights turn on and off in their room without affecting anyone else.
Apple has also added relative time offsets, which can trigger actions before or after an event. Window blinds might open 30 minutes after sunrise, say, while lights might come on an hour before sunset. Along similar lines, there are also "end" events -- opening a sensor-equipped door to the basement could trigger a ceiling fan, but then have the fan turn off after a fixed amount of time.
In fact people will finally be able to create one-time events, as well as ones linked to specific dates and times. This should be useful for holidays or going on vacation.