How to Prevent Delayed Script Execution from Apple Watch Companion App?

Hi everyone,

I use the Home Assistant Companion app on my Apple Watch to trigger a script. Sometimes, when my watch is out of network range, the script’s call gets delayed and executes later when the watch reconnects to the network. Sometimes it trigger actions at a time when I no longer need them.

For example, the last time this happened, the script to open the door was executed over an hour after I triggered it, but the runtime in the Traces showed the runtime less than a second.

Is there a way to set a timeout or expiration for the script so it doesn’t execute if it’s delayed for too long? I’d like to make sure actions only run if the script was triggered within a specific time window (e.g., the last 10 seconds).

Thanks in advance for your help!

I have a similar issue. I wonder if it’s a recent change to the watch app. In my case scripts are run multiple times, and often quite some time after my watch no longer has a connection.

What I’ve added to my scripts as a partial workaround is a delay at the end of the script combined with the “single” mode, so only one instance of the script can run at one time. But it’s definitely not perfect.

I started a thread to see if there’s any way to debug why scripts are run here.

1 Like