I’m running Home Assistant on HA Green hardware, and have a couple of Apple/Siri Shortcuts on my iPhone that work with Home Assistant (things like Night Routines, etc). I seem to be running into issues with the Render Template action responding back with “Could not run Render Template. The operation took too long to complete. Please try again.” around 70% of the time.
An example Render Template I have, checks the state of a input Boolean for an if condition:
I’m not pulling large amounts of data, or anything that should cause the request to timeout, so I’m a little perplexed as to what could be causing it. Also running the Shortcut on my local network, but do have Nabu Casa for remote access.
Any thoughts on where I should be looking to get this sorted? Nothing seems to appear in the HA logs to indicate. It does seem to be a bit more reliable if I have recently opened the Home Assistant iOS app on the device, so wondering if there’s a background app power saving issue?
I had the same problem. Looks like the HA app needs to re-establish its WebSocket connection and re-authenticate when it’s been idle. I ended up solving it by bypassing the HA app and calling the HA REST API directly from a Shortcut using a “Get Contents of URL” action.
First, generate a Long-lived access token from HA. To get the token:
Open HA in a browser
Click your profile icon (bottom left)
Click the security tab.
Scroll to the bottom → Long-Lived Access Tokens → Create Token
Give it a name like “Siri Shortcut” and copy it somewhere safe
Very smart, I didn’t know such action existed in iOS. For ppl with a certificate, the address is without a port, e.g. https://homeassistant.your-domain.com/api/template.
I’m wondering why the “render template” action works so poorly. During testing, my phone wouldn’t go idle because I was constantly using it, and yet the action usually failed.