iOS Automation for "When DND is turned on/off" Doesn't Work

I thought I had come up with an amazingly clever idea…

I wanted to set up my iPad and iPhone so that when I enable/disable DND, it will run a shortcut which will SSH to my MacBook and enable/disable DND there as well.

I started by making two shortcuts to enable/disable DND on my Mac via SSH. Those work fine. I had to grant permission on my Mac the first time they ran, but if I trigger the shortcuts, they work every time.

Then I made two automations in the one for when DND is enabled and one for when it is disabled. I set them to run the respective shortcuts.

They do not work reliably. I get errors such as “Extension Communication Timeout”.

It seems to fail more often when I turn DND on on the iOS device vs when I turn it off, but neither of them are reliable.

Of course, I can modify the shortcuts to run the SSH command and then enable/disable DND on the iOS device, but most of the time when I turn DND on/off on iOS, it is through Control Center, which is much more convenient. But at least it would be reliable!

I don’t have a solution for you, but I’m intermittently getting the same error on a DND-triggered shortcut. No idea if it’s the same problem; my shortcut is just of the “morning” variety. The equivalent evening shortcut (triggered by turning DND on) doesn’t seem to be affected by the same issue. Hopefully they’re just bugs that will get ironed out eventually…

But mainly came to say: you’re right that it’s an amazingly clever idea and will happily steal it if you get it working!

1 Like

This is a guess.

It might be that DND itself is interfering with the SSH (I don’t know why).

In the script, try turning DND OFF, wait 2 secs, do the thing, then put it where you want it to be based on the initial trigger.

Of course, the problem may then become an infinite loop… if that happens you might set a flag somehow (a file stored in files app?) to say ‘if file exists, don’t run this script)…

First action after the ‘if’ is create the file. Last action before exiting If is to delete it.

I don’t think it is DND. I think there’s just a bug where the SSH connection isn’t being made reliably for some reason. SSH commands have always seemed rather “touchy” in my experience. But it might be worth a try, if only to see if I can get an infinite loop going :slight_smile:

Similar issue. I have a simple automation set up to show an alert when I open an app. When I dismiss the alert, the automation opens the app.

I get the alert, and the app opens. So far, so good.

Unfortunately, after a few minutes I get a notification that the automation has timed out. While it doesn’t affect the task, it is annoying.

Just an idea: rather than calling the actions straight from the trigger, try setting them up as a separate shortcut and run the shortcut from the trigger. That way you can also test if it’s the shortcut or the trigger that causes the trouble.

Yup. That’s what it is. The automation just runs the shortcut. But the shortcut works fine on its own. Just not with the DND automation.

The extension communication timeout error is appearing for people under all sorts of conditions. It appears quite a few times on Reddit, Apple support forums, etc.

Given the breadth of circumstances where it occurs, I think it is almost certainly going to have to come down to Apple applying a fix.

IIRC @RosemaryOrchard hinted that she needed to use “Exit Shortcut” action to avoid such errors in iOS 13. Maybe the shortcut awaits input or keeps running for some reason.

I’ve read that approach elsewhere too, along with running shortcuts in the background, running them from other shortcuts, and adding delays in. From what I’ve read so far across the web, the results have always been mixed across the user base trialling the workarounds as to how often these steps seem to address a particular flavour of an issue. Nothing so far seems to have worked for everyone every time.