If you are a Home Assistant user and would like to trigger Home Assistant automations based on iOS or iPadOS focus mode changes, this post is for you. I’ve completely revamped the content for iOS 27 and iPadOS 27, the latest version of the Home Assistant companion app, and the new HA automation engine.
Using sleep mode automation triggers in iOS 27 beta is tricky, so I’ll cover my workaround. Hopefully Apple will fix this before the September 2026 release. Sleep focus mode automation triggers are supported on iPadOS 27 and even on macOS Tahoe. As a workaround, you can create the sleep focus mode automation trigger on iPadOS 27 or Tahoe then enable the automation on your iPhone (while disabling it on the other platforms). I’ve submitted a bug report to Apple, via FB23691328 to bring parity to iOS 27.
While this post is focused on iOS 27, the concepts are the same for iOS 26. Apple has changed the Shortcuts app UI a bit, so the steps may be slightly different. For anything other than the Sleep focus mode, this post should still work.
Automation Architecture
There are several ways to attack the goal of triggering Home Assistant automations based on iOS focus mode changes. In my opinion, the best way is to use Apple Shortcut automation triggers to change a Home Assistant boolean helper state. Then within Home Assistant you can use this boolean helper to trigger automations, scenes, etc. This keeps the configuration complexity limited to Home Assistant.
Yes, the Home Assistant companion app can be used to run automations and do a lot of other things directly in Home Assistant from your iPhone. However, IMHO, this can lead to confusion and could lead to a more fragile setup. If the automation suddenly stops working it makes troubleshooting easier if all the complexity is in Home Assistant. All your iPhone does is change the state of a boolean helper.
This post will focus on how I use the Home Assistant automations with the Sleep focus mode:
- Bedtime: I just swipe to control center and turn on the Sleep focus mode. A Shortcut personal automation trigger recognizes the Sleep focus mode is turned on and makes a call to Home Assistant to turn on a boolean helper.
- Morning: I have two Shortcuts to cover days with or without an alarm set. On days with an alarm the alarm automatically turns off the Sleep focus mode which then triggers a Shortcut automation that changes the state of the Home Assistant sleep focus mode boolean helper to off. For days without an alarm I have a second Shortcut which I cover below.
As you can see, this is very simple and actually works with any focus mode change. If you don’t like using the control center at bed time, you could easily create a Shortcut to turn on sleep focus mode and map it to the iPhone action button.
For days without an alarm set I have a second Shortcut automation. If it’s between 4am and 9am, sleep focus mode is on, and the power is disconnected, then turn Sleep focus mode off. This triggers the previously mentioned Shortcut automation which makes a call to Home Assistant to change the state of the sleep focus mode boolean helper to off. If you want to download this Shortcut from iCloud click here.
BTW, I used the new iPadOS 27 Shortcuts app to create this just by using a natural language prompt. It nailed it on the first try. The only tweak I did was to use the on-device model for the time conversion instead of the cloud model. This is the exact input I used:
Trigger on power being disconnected. Then if sleep focus mode is on and the time is between 4am and 9am, then turn sleep focus mode off.
Home Assistant Helper Entity
Although I focus on the sleep focus mode in this post, the same triggers can be used any iOS focus mode. If you want to trigger Home Assistant automations based on more than one focus mode, just create more helper entities, one per focus mode and name them accordingly. You will also need separate Shortcut automations for each focus mode.
You could get fancy and pass the current focus mode name and state to a Home Assistant text helper, then parse the text helper in Home Assistant to trigger automations. That would allow you to only use one helper entity instead one one per focus mode.
The first step is to create Home Assistant helper entity (input_boolean) that will track the state of the sleep focus mode (or any focus mode). Then within Home Assistant you can use this boolean helper to trigger automations.
- In Home Assistant go to Settings -> Devices & services -> Helpers. Select CREATE HELPER.
- Select the Toggle option. Give the Toggle a name (e.g. Sleep Focus Mode) and pick an icon. Click CREATE.
Focus Mode ON Automation
Please make sure the Home Assistant companion app is installed wherever you are making this shortcut. If you want to download my prebuilt Shortcut from iCloud click here. Note: For Sleep mode you will need make the automation on iPadOS 27 or macOS Tahoe, then enable it on iOS 27. All other focus modes work on iOS 26 and later.
- On your device open the Shortcuts app.
- Under Library tap on Automation.
- Tap on the + button to create a new automation.
- Tap on Edit (iOS 27) or Edit Actions (iPadOS 27).
- Tap Automation, then tap Focus.
- Tap Do Not Disturb and select the Focus Mode you want to use. For Sleep mode you will need make the automation on iPadOS 27 or macOS Tahoe.
- Add another action and search for Home Assistant.
- Look for the Control switch action. Tap Choose.
- Find the boolean helper you created and tap on it.
- Tap Target State to turn the switch on.
- Tap on the Shortcut name at the top and give it a name (e.g. HA – Sleep Focus ON). Change the color and icon if you want.
- Run the automation and verify in Home Assistant that the boolean helper state changes to ON.
Focus Mode OFF Automation
This is the same procedure as above, just with the opposite action. If you want to download my prebuilt Shortcut from iCloud click here.
- On your device open the Shortcuts app.
- Under Library tap on Automation.
- Tap on the + button to create a new automation.
- Tap on Edit (iOS 27) or Edit Actions (iPadOS 27).
- Tap Automation, then tap Focus.
- Tap Do Not Disturb and select the Focus Mode you want to use.
- Tap Turned On, then tap Is Turned Off.
- Add another action and search for Home Assistant.
- Look for the Control switch action. Tap Choose.
- Find the boolean helper you created and tap on it.
- Tap Target State and leave the switch off.
- Tap on the Shortcut name at the top and give it a name (e.g. HA – Sleep Focus OFF). Change the color and icon if you want.
- Run the automation and verify in Home Assistant that the boolean helper state changes to OFF.
Home Assistant Automations
Now that all of the configuration has been done on your iPhone, we can now turn to Home Assistant. The sky is the limit here, so I’m just showing you one example of what you can do. I’ve included the YAML, which can be fully edited in the visual editor. Just create a new automation, switch to YAML view and paste the code. Switch back to the Visual mode and change the entities as needed.
Using the new 2026.7 Home Assistant automation interface I created an automation called “Master Bedroom – Good Night” which is triggered by the sleep focus mode boolean entity turning on. It also checks that I’m actually home, by making sure my person entity is in the “Home” zone. I then have it turn off all of the lights in the master bedroom, master bathroom, closet, and close the blinds. You could also build a scene and just call the scene.
alias: Master Bedroom - Good Night
description: ""
triggers:
- trigger: switch.turned_on
target:
entity_id: input_boolean.sleep_focus_mode
options:
for: "00:00:00"
conditions:
- condition: zone.in_zone
target:
entity_id: person.derek_seaman
options:
for: "00:00:00"
zone: zone.home
actions:
- action: cover.close_cover
metadata: {}
target:
area_id: master_bedroom
data: {}
- action: cover.close_cover
metadata: {}
target:
area_id: mb_closet
data: {}
- action: light.turn_off
metadata: {}
target:
area_id: master_bedroom
data: {}
- action: light.turn_off
metadata: {}
target:
area_id: master_bathroom
data: {}
- action: light.turn_off
metadata: {}
target:
area_id: mb_closet
data: {}
- action: light.turn_off
metadata: {}
target:
area_id: office
data: {}
mode: single
Summary
In this article I showed you how to create Home Assistant automation triggers based on any focus mode of your iPhone turning on or off. This works with all focus modes, with the caveat that in the iOS 27 beta 3 you need to do a workaround to use the sleep focus mode. Hopefully Apple will fix this before the final release in September 2026. These automations are a powerful way to trigger complex Home Assistant automations based on any focus mode state change.




I love this and your blog. For your consideration I humbly recommend a slight tweak that I do.
For fewer helpers, I have been (pre-iOS 27, although I’m running the betas now too and haven’t changed this system) using a text helper. The shortcuts go “when sleep turned on – get name of focus – write that name to HA text helper”. I then use HA automations / triggers / conditions on this helper name. 1 helper all of my focus modes.
Examples: Yard work, turns off outdoor camera notifications spam because it’s me walking around the house mowing etc. Pool turns off just backyard camera notifications so I can be chilling out back but not have motion lights changing at night and/or I’m still notified when food delivery in front of house etc.
Work focus = when my MacBook mic is in use to stop robot vacuum so it doesn’t disrupt a conf call (then unpause when mic input stops again = call over)
Hope there is something useful in there for you. Trying to give back for all that you have shared. Sorry for the caveman typing. I’m on my phone still waking up with morning coffee and my RSS feeds. 😉
Yes you can certainly go that route as well. Unfortunately on iOS/iPad 27 beta 3 many of the Home Assistant companion Shortcut actions are broken. I would guess you are using the “Perform Action” to set the text helper state? That’s one of the broken actions in my setup so I can’t test it.
Ps. For my morning focus on days without sleep alarm (ie weekends). I have shortcut that flips morning focus on when I disconnect iPhone from power between xX:XX and xx:xx time in the mornings. I like this to happen as automatically as possible.
Great idea! I’ve amended my post with a new Shortcut (made by iPadOS 27 AI natural language query) to handle the days without an alarm, using your idea as an inspiration.