Homepod homekit siri shortcut running script randomly

Hello! I am wondering if someone can help me troubleshoot a script which is seemingly running randomly…!

It is a ‘bedtime’ script and does a few obvious things with lights. It functions correctly as part of a couple of automations, however it is also firing occasionally (perhaps 3 times a week) and I can’t figure out what’s triggering it!

I think it might be linked to siri/homepod/shortcuts, but can’t be certain.

The automation triggers I have for the script are:

  1. zigbee button (works fine)
  2. iOS shortcut action (this works, but always feels… glitchy…)

The script is running at weird times (not bed time!) without either of the above being requested by anyone in the house.

Troubleshooting steps so far:

  • check logbook… this is all I can see

    So I can see that my user is triggering it… that’s about it.
  • cloned the script and deleted the original… same behavior with the clone!

Any advice? Thanking you

I’m confused - are you talking about a script or an automation?

Could we see the code?

As am I…!

The problem is a script running (seemingly) randomly.

It’s not a human requesting the script, so I guess the problem must be with automation somewhere…

I think my ask today to the forum is advice troubleshooting. Is there a way to see all automations that have a script as an action? Or is there any advice with the logs and where I can look?

All I can see in the logbook is that the script is “triggered by action Scripts: Bedtime1” and my username associated.

Apologies, I know this is very vague. It’s like a nightmare ticket in to IT service desk… “it’s broken but I can’t articulate why…!”

1 Like

Could we see the code for Bedtime1? There may be a clue.

Anything in the traces?

This means it’s coming from the UI or something that is logged in as you. Not an automation from HA.

Are you using Alexa Smart Home Skill?

Not Alexa, but I use Apple’s iOS shortcuts with a homeassistant action (logged in as me). This is where my suspicion lies.

I have an ‘evening’ Shortcut which triggers the bedtime1 script. This works, but my (Apple) Homepod always hangs and says it doesn’t get a response (assuming from homeassistant server). I slightly wonder if it’s retrying hours/days later…

That shortcut is likely your problem then. It’s either that, you manually running the script via the UI, or something else logged in as you running it.

bedtime1 script:

sequence:
  - type: turn_on
    device_id: 2c7ee01503375d0ba5a07151ca357ec1
    entity_id: 7ac5645a2dfecf9de1d2b97fc591b1cf
    domain: light
    brightness_pct: 40
  - type: turn_on
    device_id: 6a3156ff17179111e802e420655eac76
    entity_id: 0efbb4d13a3a1ba50b7abc72c9f103d5
    domain: light
    brightness_pct: 40
  - type: turn_off
    device_id: 41e8f0bb1d7e5db8023e860c78d0d529
    entity_id: 194c8d8ac45c13b61de7736f8d3cf314
    domain: light
  - delay:
      hours: 0
      minutes: 10
      seconds: 0
      milliseconds: 0
  - type: turn_off
    device_id: 7d2a24cedfea185de328ebe0e185d5bb
    entity_id: df0ca45d97edd6234d0650bcc2825cc4
    domain: light
alias: Bedtime1
description: Night time routine
icon: mdi:weather-night

All I can see in the traces is " Executed: 3 April 2025 at 07:04:34" and the related logbook entry (just “turned on”).

Appreciate the help

Disable the shortcut temporarily and see if the problem persists.

1 Like

This is my thinking also.

So I cloned the script (original was script.bedtime and now I have script.bedtime1) thinking that if something was trying to run the script it wouldn’t know about the new clone… but it still happens!

What I think I’ll do is remove it from the only iOS Shortcut that triggers the script and see if it continues.

are you sure the new one is running? Is there a trace?

Pretty sure. I can see its history.

The original script.bedtime has been deleted, also.

Is the entity_id the same? How did you call the script from the shortcut?

The entity is script.bedtime1 so different from the previous script.bedtime.

iOS shortcut action:

I trigger this shortcut by voice on my homepod. It reads weather, calendar, etc, then runs the bedtime1 script to adjust my lights.

Wait, if you just copied it and added it to the shortcut, how does that rule out the shortcut being the problem? You essentially just renamed it keeping everything the same. If you want to rule out the shortcut. Remove the original and make a new script but don’t link it.

Because I thought something else was triggering it but I couldn’t figure out what. So the rename was to ensure that only this shortcut knew about the script.

I do want this shortcut to trigger the script, of course :slight_smile: but only when I run the shortcut…

1 Like

OK script trigger removed from the iOS shortcut. Will monitor for a week or two.

Not sure the shortcut is the culprit, but this should tell me.

1 Like

Have you noticed any more unusual behavior? I am also seeing scripts run without my interaction. The only new thing in my setup is the Google Nest Speaker.

Like you my script runs when it should but it also runs by itself. I don’t have any outside connections to the script like you do with Apple Shortcuts. But it still triggers by itself.

It seems it’s turning itself on and off. The script requires a message and one is not provided.

The context there states that supervisor is doing the action.

My money is on Siri/Google, but I do not know if that runs though supervisor like it shows. Google Home has bedtime routines too, and can activate the script by voice. If it is not your intent to have it run by voice assistants, I’d turn them off for this script. Renaming it to something less likely to be spoken would also help.