Night-time automation sometimes fails to fully execute

I have an automation that is supposed to run every night to put the SmartThings Home Monitor (STHM) into Armed (stay) mode and set the “location’s mode” to Night if I’m at home.


  • 11:30 pm
  • location mode is Home


  • change security mode to Armed (stay)
  • send a push notification to my phone
  • change the location mode to Night

Ever since I switched over to the new app (almost a year ago now), this automation has worked sporadically. For a while, it was working most of the time, like 20 days in a row, and then it would fail. When it fails, the automation IS triggered and the location mode is changed to Night, but I get no push notification and the security mode is not changed (it remains as Disarmed).

I have a similar automation for the morning that seems to run correctly every day.

I have been working with SmartThings support trying to figure this out for more than six months now, but it’s still an issue. I have tried resetting the STHM a couple of times, I have tried recreating the automation a number of times, I have tried reordering the THEN commands, and I have tried changing the start time from midnight to 11:30.

Any other thoughts as to how I can fix this issue?

is “location mode is Home” set as a precondition?

1 Like

I think so, but it doesn’t show me on the app. Is there a way to know without deleting it and resetting it?

click on that field in the automation

Ah, there it is. Yes, it is a precondition.

Okay, an update on this.

Apparently automations don’t work like one would expect. If I remove the command to change the location mode to Night then the automation runs perfectly. So, the only thing I can figure is that the precondition of “location mode is Home” runs before every command under the THEN block of code, rather than once before executing all of the commands. So, once the mode changes to Night, it is no longer Home, and therefore none of the other commands run. Except sometimes they do, so it’s like the commands under the THEN block are run in random order. I don’t get it. Why would something be setup to run this way?

Anyway, since I don’t really need the mode to be set to Night for anything right now, I can just leave it out and have an automation that works for my needs.

1 Like

I had trouble last night with automations… I have a Greenhouse Heater which it turned on when a Temp sensor drops below 34 degrees F… Has been working fine for a number of days during our recent cold spell. This morning it switched heater plug ON then immediately switched it OFF and it stayed OFF until I noticed when I awoke at 7AM . The temp was then 26.9 degrees F… Manually switched everything ON until back to temp above 34F… Eventually the automation started to work again and is OK now , without any changes !!!
I have notice that a RULE such as Turn ON when Below 34F only seems to operate when the previous reading was above 34F , in other words SMARTTHINGS wants to see the temperature FALL from above 34F to be Below 34F , rather than just be below 34F … which I think is incorrect.
My location was set to AWAY and precondtion set OFF and not included in the automation … not really sure why you would use this feature yet.

This flaw in Automation logic has been documented many times. It appears SmartThings is waiting for a sensor to send a message which fulfills the condition before firing. In your case, it was the (lack of) falling temperature. Another common case is turning off lights in an empty room after a given time, e.g., “no motion on sensor X after 10 pm” . In this case, if motion has ceased in the room prior to 10 pm, there will not be a “motion has stopped” message after the 10 pm condition has been met, and the automation will never fire.

Yes, that’s annoying. It seems like you could probably make that automation run more reliably by using webcore.

Don’t really agree … The sensor sends in the temperature of 29degrees which is obviously below 34degrees and the condition is met and SHOULD trigger … The logic of looking at the previous state should be irrelevant. It is a matter of semantics … The rule says “Is below xx degrees” NOT a rule that says “Falls below xx degrees”.

The motion case is slightly different because no condition is sent just that time has elapsed. But I take your point.

Out of curiosity, did you look in the IDE at the messages sent by the temperature sensor? Was there a history of messages showing the temperature below the Automation condition?

I’m a smartthings novice … So I wasn’t aware of the live logging.
However I just logged on to Groovy … and much to my suprise my devices, device handlers and apps have all disappeared … Is this a normal occurrence ? :frowning:

Oh … it’s just updated itself … It took 5 minutes

Oh again … that logging is good … thanks for pointing me in that direction

1 Like