Why are routine automations behaving inconsistently?

I thought a really boring automation “keep this room within a temperature range based on what time it is?” should be something that would work without having to think too much.

But frustratingly, I cannot get this to work sensibly at all.

Can someone please tell me what is going wrong here and how to fix it?

P.S. The suggested topics are over 5 years old. How is it that the SmartThings devs have ignored this for 5!!! years?

The configuration is simple. A Meross MS100F T&H sensor which reports Temperature and Humidity every 10 mins or so and a IR panel running on a Tapo P100 Smart plug.
The four routines are:

During day-time (sunrise to sunset), if temperature exceeds 18C, turn off the panel.
During day-time (sunrise to sunset), if temperature is below 17.5C, turn on the panel.
Similar setup up for night-time, but to activate below 18.5C and deactivate above 19C.

Every time the routine is edited, it runs fine for 24-ish hours and then stops running.

Do the time period conditions in the Routines have the Run at start time options enabled (they probably should)?

I did not enable it. The wording made me think that this would only trigger it at start of the period rather than repeat throughout the period. I want it to keep triggering throughout the time period rather that only at start of the time period. Am I interpreting this incorrectly?

Greater than and less than comparisons only trigger Routines when they first become true, not every time the temperature changes while they remain true. It didn’t have to be like that but that is the choice SmartThings made for Routines.

If, for example, you are testing for a temperature below 17.5 C during the day, that will only make the Routine do anything if the temperature falls below 17.5 C during the day. If is already below 17.5 C at sunrise nothing will happen.

The Run at start option adds an extra trigger at the start of time periods.

So, for the same example, if the temperature is 16.5 C at sunrise the Routine will run at sunrise and see the comparison is true and do whatever is necessary.

I am not saying this is your issue, but not having the extra Run at start checks can certainly cause the sort of symptoms you describe.

There is a potential edge condition here.
What if the temp just before sunset is 17c so the panel is on, but doesn’t hit 18c by sunset that would leave the panel running all night?

If you want to ensure it’s off at sunset you might need a separate trigger to ensure that.

Yes, there are four routines overall. Two for night (since we want the temperature band to be 1C warmer at night than during day). So the panel should be shut-off after sunset when the temperature exceeds 19C and turn-on after sunset when temperature falls below 18.5C

That is a very weird interpretation by SmartThings. I’ve turned the ‘Run at start’ on all four routines and am monitoring for next 36 hours without editing the routines. Hopefully, this was the magic bullet. Thanks!

Hello @smarthome_ak,
It sounds like a SmartThings routine persistence bug—your rules work after editing but stop triggering once the sensor updates roll over. A common fix is to rebuild the automation using virtual switches or Edge drivers instead of direct routines, so the logic keeps firing reliably beyond 24 hours.

Best Regards,
Elizabeth Sherman

So, after a few days of letting this run… @orangebucket, you were absolutely right.

I set the system up such that all four routines have the “Run at start time” option on.
This ensure that all four continue triggering during their active period when the temperature conditions are met properly. Problem solved. Thanks to all who provided inputs.

Why SmartThings chose this approach is beyond me… if I set “Repeat” to “Everyday”, I expected behaviour like the alarm clock app, where it occurs during the designated period, “EVERY DAY”.

What “Run at start time” actually does is check for condition already met at start time.

Ex. when your routine says “from 9 to 5, if temperature below 15°C, turn heater on”, this actually works as “from 9 to 5, if temperature drops below 15°C, turn heater on”. So if it is already below 15°C at 9 o’clock, this never triggers. With “Run at start time” enabled, it will.

1 Like

You need a 2nd automation to cover this scenario.

Precondition: < 15°C

Trigger: 9:00

Action: turn on heater

No, no you don’t. That’s the whole point of “Run at start time”.

1 Like

Yes that should be true, but a 2nd automation will fix your problem.

Again: The problem is solved without the workaround of adding a second automation. “Run at start time” solves this properly.

1 Like

So, this is the classical ‘edge-trigger’ vs ‘level-trigger’ problem then.

I would normally like this to be interpreted this as ‘level-trigger’ on both time and temperature, but SmartThings is taking it as edge-trigger on temperature, and won’t run at all if the temperature is already below.

SmartThings treats all conditions (not the preconditions!) as change-of-condition, edge trigger if you think electrically. This is equally true for on/off, open/closed positions, etc.

1 Like

It is more the case that the underlying Rules are event handlers that would typically default to triggering on every device event (regardless of whether the state changed) unless explicitly told otherwise, including by some automatic handling that is rather vaguely described.

The Routines choose to explicitly override default behaviour in some cases. One obvious one is ‘preconditions’ which under the bonnet are just conditions with triggering turned off.

A more relevant one in this case is that the various ‘greater than’ and ‘less than’ conditions in the underlying Rules that have been set to suppress triggers unless they have changed from false to true. That is not the default behaviour of Rules.

One could argue that it is actually a reasonable choice, it being the lack of triggers at the beginning and end of time periods that is the real problem.