Home Assistant: iOS Focus Mode Automation Triggers

If you are a Home Assistant user and would like to trigger Home Assistant automations based on iOS Focus Mode changes, this post is for you. In iOS 18 and earlier all focus modes except Sleep can use built-in personal automations to trigger Home Assistant actions based on the Focusing being turned on or off. However, for some reason Apple treated the Sleep focus mode in iOS 18 and earlier different, frustrating many users. 

Thankfully iOS 26 beta has remedied this situation, and turning Sleep focus mode on or off can now trigger distinct actions in Home Assistant. As of the publication date of this post, iOS 26 is only at developer beta 1. Apple could certainly change the sleep focus mode settings between now and the public release in September 2025. I’ve observed the sleep focus mode changes in both iPadOS 26 and iOS 26, for US based devices. I don’t know if other regions have gotten the update, but I would hope so.  

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 Shortcuts, covered later.

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. 

  1. In Home Assistant go to Settings -> Devices & Services -> Helpers. Select CREATE HELPER.
  2. Type Toggle in the search box. Click on the Toggle item. Give the Toggle a name (e.g. Sleep Focus Mode) and pick an icon. Click CREATE.
Home Assistant Boolean Helper

iOS Shortcuts

In the iOS/iPadOS 26 developer beta 1 they made changes to the Sleep focus mode configuration. Finally! Apple now treats Sleep focus mode the same as all other focus modes. This means the sleep focus mode now has explicit “Is Turned On” and “Is Turned Off” automation triggers. This will enable us to natively run different Shortcuts based on Sleep mode being turned on or off. This is perfect for setting the Home Assistant boolean helper state. 

New iPadOS 26 and iOS 26 Focus Mode Triggers

Home Assistant Shortcut Creation

For this exercise we will create two separate Shortcuts that use the Home Assistant iOS companion app. One Shortcut will turn the boolean helper “on” and the other will turn it “off”. If you want to download my prebuilt Shortcut click here.

  1. On your iPhone open the Shortcuts app.
  2. In the upper right corner tap the + button.
  3. In the Search Actions box type call service.
  4. Tap on the Home Assistant Service and type bool. Tap on input_boolean.turn_on.
  5. Tap on the arrow next to data.
  6. Tap on Choose and tap on your HA server name.
  7. In the Service Data paste in the JSON below, and modify as needed for your entity name.
				
					{
  "entity_id": "input_boolean.sleep_focus_mode"
}
				
			

8. Disable Show When Run.
9. At the top of the window tap on Call Service, then Rename. Pick a suitable name (e.g. Turn on Sleep Focus Mode).
9. Tap on Done to save the Shortcut.
10. Duplicate the Shortcut and modify the call to use input_boolean.turn_off and name the Shortcut accordingly.
11. After the Shortcuts are built tap on each Shortcut and verify in Home Assistant that the boolean helper state changes.

iOS Shortcut Creation Steps
Home Assistant Turn On Shortcut
Home Assistant Turn Off Shortcut

If want to trigger Home Assistant automations based on more than one focus mode, then you will need dedicated Shortcuts for each focus mode. Each should turn on or off their respective boolean entity. 

Focus Mode Automations

Now that we have our two Shortcuts setup we can configure the focus mode of our choice to run the appropriate Shortcut via Shortcut automations.

  1. Open the Shortcuts app on your iPhone.
  2. At the bottom of the screen tap on Automation.
  3. In the upper right corner tap on +.
  4. Scroll down towards the bottom and tap on Sleep (or the Focus mode of your choice).
  5. Leave the check box on under Is Turned On. Tap Run Immediately. Tap Next.
  6. Search for the Shortcut which turns on your HA boolean helper and tap on it.
  7. You should see a new Automation called When Sleep is turned on.

8. Repeat the process but select Is Turned Off for the “When” and select your “off” Shortcut.
9. You should now have two Shorcuts listed under Personal Automations.

10. Manually turn the Sleep focus mode on and off to verify the Home Assistant helper entity changes state. 

You now have Shortcut automations which can be triggered when the sleep focus mode is turned on or off. If you have an iPhone with the action button, you could easily create another Shortcut that turns sleep focus mode on. If you use the built-in iOS alarm feature, sleep focus mode is automatically turned OFF when the alarm goes 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. 

In my example automation I have 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 iPhone is in the “Home” zone. It then turns on a goodnight scene. This scene closes my blinds and turns off all the lights.

				
					alias: Master Bedroom - Good Night
description: ""
triggers:
  - trigger: state
    entity_id:
      - input_boolean.sleep_focus_mode
    from: null
    to: "on"
conditions:
  - condition: zone
    entity_id: device_tracker.dereks_iphone_16_pro
    zone: zone.home
actions:
  - data: {}
    target:
      entity_id: scene.mb_goodnight
    action: scene.turn_on
mode: single

				
			

I have a separate automation that does the reverse for my morning scene. You could combine both automations together using Home Assistant Trigger IDs, as well. For this situation I prefer to keep them separate. 

Summary

In iOS 18 Apple makes it very difficult to trigger the running of Shortcuts for the Sleep focus mode. Starting in iOS 26 Apple finally made the sleep focus mode on parity with the other focus modes so you can easily trigger Shortcuts when you enable or disable the Sleep focus mode.

In this article I show you how to create Home Assistant automation triggers based on a focus mode being turned on or off. Now that Apple has standardized the focus mode triggers across all focus modes in iOS 26, this procedure works for all focus modes including sleep. 

Related Posts

Subscribe
Notify of
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments