IOS doesn't allow any application to change the focus mode. This application gives the name Focus to Shortcuts app. Shortcuts is able to switch.
To do the configuration, you have three steps:
1 - Configuration of the application
First opening
First opening of the application
Tap on Request Focus Access
Allow Focus access
This request appear
Tap on "Allow"
Allow Notification
This request appear
Tap on "Allow"
Allow Focus access
This request appear
Tap on "Allow Full Access"
Main screen
Tap on "Manage Focus" to set them
Allow Focus access
Set the Focus you want use.
Set the name according the configuration on your phone
⚠️ Be careful, to the space at the end
After, tap Back
Settings calendar
Select you main calendar
Decide if you want use the Do Not Disturb Focus when the event is an all-day event
Decide if you want use the Do Not Disturb Focus when the event is in tentative status
Decide if you don"t want use the Do Not Disturb Focus when the event title is "put your word"
Decide if you want use the Holiday Focus when the event title is "put your word"
(optional) Select the public holidays (if exist, depend the country and you mail box)
Public Holidays
If you selected a public holidays calendar, tap on Select public holidays.
⚠️ you have this icon, il you have no event selected in public holidays calendar
Public Holidays
Select all days when you want be in holiday Focus mode
Tap back twice
Days & Times
On the main page, tap on "Manage Days and Times"
Decide the morning time - work only if you selected sleep focus.
Decide the evening time - work only if you selected work focus.
Decide the sleep time - work only if you selected sleep focus.
Chose you days - work only if you selected work focus
Tap "Back"
System
Tap on "System".
You can chose the theme.
Chose the notifications you want.
⚠️ All notification means a notification on all execution.
Tap on "Back"
The configuration of this application is finished.
on the bottom, you can see which Focus should be.
2 - Configure the shortcut to allow the change of focus
You can download the shortcut template or create from zero.
The template can run with 5 different focus mode : Do Not Disturb, Work, Personal, Holiday and Sleep. Rename if yours have a different name.
To create one from zero, follow the step below
Create a new shortcut.
Search and select FOE.
Select "Select Focus mode".
Add an "If"
Put in the If the variable "Select Focus Mode"
Put in the if after "is" the name of Focus (same on the phone, same on the FOE app)
You can delete the "Otherwise"
Add action "Set Focus"
In this action, select the Focus, the one you put in the "If"
Tap to change Off by On
Repeat the previous step as much as you have a Focus mode.
3 - automate the shortcuts
Create an automation in shotcuts app.
Choose Time of Day
⚠️ unfortunately it is not possible to have a recurrence on the same day. You must create the execution for each hour you want it. (eg every 15 min)
Chose the time, Repeat Daily, run immediatly and next.
Select your shortcut
Repeat for all time you want the execution
And that is it. Your phone will switch automatically of Focus mode based on your configuration in the app.