
























If you are using Home Assistant and want to determine if the Apple Sleep focus mode is on or off so you can use it in automations, this post is for you. While on the surface this may seem like a trivial task, due to Apple’s limited Focus APIs and personal iOS automations, one has to get very creative to solve this riddle. Literally all other Focus modes are easy to track via iOS Personal Automations. Sleep is “special”.
—
June 2025 Update: In Developer Beta 1 of iOS 26 Apple has changed the sleep focus mode automation to have the same on/off triggers as other focus modes. This lets you automated based on sleep focus mode turning on or off without any ‘hacks’. Check out my new post: Home Assistant: iOS Focus Mode Automation Triggers
—
My solution involves using a Mac and a third party tool called Shortery. I’m using the Pro version, which is a one time $8.99 USD purchase. If you have an iPhone and a Mac signed into the same iCloud account your devices can mirror your Focus mode. So enabling the Sleep focus on your iPhone, for example, would enable it on the Mac as well. My Mac never sleeps, so it’s always available when I’m home to do background tasks.
So why is a somewhat convoluted solution needed? Here’s a few reasons:
Given all of these issues and my requirements, I came up with a Mac based solution for the Sleep Focus mode that works really well. In the future there may be better solutions. For example, with iOS 17 Apple can read the unique IDs of MagSafe chargers and show you different StandBy screens depending on which dock you are charging on. I hope they add personal automation triggers that can tap into these MagSafe IDs. This would let you trigger a Home Assistant automation, or set a Boolean toggle, when you place your phone on your bedside charger, for example.
After a lot of work, I found a solution to the problem that addresses all of my use cases:
Tips for manually creating the shortcut:
{
"entity_id": "input_boolean.sleep_focus_mode"
}
3. Create another Shortery trigger, copying the settings below. Make sure you select Any Focus and Inactive.
2. On your iPhone or Mac turn on Sleep focus mode. Almost instantly the entity card should show Sleep Focus mode is on. Turn Sleep focus off (don’t select another Focus mode, just turn off sleep), and verify the entity card shows Sleep Focus mode off.
3. On on your iPhone or Mac turn on Sleep focus mode. Almost instantly the entity card should show Sleep Focus mode is on. With Sleep focus still active, select another Focus mode (except Driving) and observe the Sleep focus entity turn off.
Setting up Home Assistant to know if the Apple Sleep focus mode is on or not is a bit of pain. Due to Apple API restrictions and iOS Personal Shortcut design decisions, triggering when Sleep focus mode is active or inactive is difficult. All other Focus modes can easily trigger on/off status on iOS using Personal shortcuts. So for Sleep mode I’ve leveraged my Mac and the Shortery app. The solution works well, but I hope in the future Apple provides a better solution.
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。