Rule doesn't trigger after being resumed if the trigger device changed state while paused

Setup:

  • Rule "Bedroom Lightning" triggers on: Bedroom Presence (virtual switch) turns *changed*
  • Rule "Sunrise Routine" pauses "Bedroom Lightning", then resumes it 15 minutes later

What happens:

  1. Bedroom Presence is PRESENT
  2. Sunrise Routine pauses "Bedroom Lightning"
  3. While paused, Bedroom Presence changes to AWAY
  4. Sunrise Routine finishes and resumes "Bedroom Lightning"
  5. Sunrise Routine then runs actions of "Bedroom Lightning"— nothing happens (expected, since presence changed while the rule couldn't react)
  6. Later, Bedroom Presence changes back to PRESENT — "Bedroom Lightning" does not trigger

What I found in the logs:
The device event itself was logged fine ("Presence switch on"), but there was no "Triggered:" line for the rule at all — the rule simply didn't react to this change, even though it was resumed and this looked like a completely normal trigger event.

The next device was logged ("Presence switch off"), there was a "Triggered:" line for the rule.

My guess: the rule's internal trigger state got out of sync during the pause (it "remembers" the wrong last-known state from before the pause), so the next real change doesn't look like a change to the rule.

Question: is this expected, or should a resumed rule re-sync its trigger state so the next real change is caught normally? Or is there a way to manually reset the trigger state?

You might want to grab screenshots of your actual rules and logs showing the events. If you are using private booleans to prevent duplicate instances, it could be they are not getting reset. It could be that the already running rule had set a delay that had not cleared. Or any number of other things. Without seeing the actual rules and logs, it is really difficult to do anything but guess.

When your issue happens, go to the rule's status page (the circled i icon, top-left from the app config page, or extreme right in the app list) and scroll to event subscriptions. Show us what that section contains. If you don't see one for the trigger you expected, that's your issue. If there is, then that would be a different problem.

I've tried to simplify it as much as possible. The missing trigger is at 06:43
The Sunrise Routine looks silly, but Ive added some double actions with delays to try to create a workaround for the problem.

Rule "Bedroom Lightning"

TRIGGER: Bedroom Presence, TV — any turns *changed*

Stop Repeating Actions
IF (Bedroom Presence is on AND Mode in [Day, Night]) THEN
While (Bedroom Presence is on AND TV is off AND Mode in [Day, Night]) Repeat every 0:15:00 (stoppable)
Color Temperature: His Lamp, Hers Lamp: MainCT -> Level: MainLevel -> Fade: 2
END-REP
While (Bedroom Presence is on AND TV is on AND Mode in [Day, Night]) Repeat every 0:15:00 (stoppable)
IF (Variable MainLevel >= 30) THEN Color Temperature: His Lamp, Hers Lamp: MainCT -> Level: 30 -> Fade: 2
ELSE-IF (Variable MainLevel < 30) THEN Color Temperature: His Lamp, Hers Lamp: MainCT -> Level: MainLevel -> Fade: 2
END-IF
END-REP
ELSE-IF (Bedroom Presence is off OR Mode in [Away, Sleeping]) THEN
Off: His Lamp, Hers Lamp
END-IF

Rule "Sunrise Routine"

TRIGGER: Sunrise Trigger on Hub_I_C4(off) turns on

ACTIONS: Pause Rules: Bedroom Lightning
On: Sunrise Simulation Lamp (Bedroom)
Resume Rules: Bedroom Lightning --> delayed: 0:15:00
Dim: Strepies (Hue Bulb): 1
Dim: Strepies (Hue Bulb): 1
Run Actions: Bedroom Lightning --> delayed: 0:15:00
Run Actions: Bedroom Lightning --> delayed: 0:15:02
Run Actions: Bedroom Lightning --> delayed: 0:15:15
Off: Sunrise Simulation Lamp (Bedroom) --> delayed: 0:15:00

The logs:

06:18:00.055  Event: Paused by 'Sunrise Routine'

06:33:00.514  Event: Resumed by 'Sunrise Routine'
06:33:01.015  Event: Actions run by 'Sunrise Routine'
06:33:01.032  Action: Stop Repeating Actions
06:33:01.069  Action: IF (Bedroom Presence(off) is on(F) AND Mode in [Day, Night](T) [FALSE]) THEN (skipping)
06:33:01.082  Action: While (Bedroom Presence(off) is on(F) AND TV(off) is off(T) AND Mode in [Day, Night](T) [FALSE]) Repeat every 0:15:00 (skipped)
06:33:01.087  Action: Color Temperature: His Lamp, Hers Lamp: MainCT(1935) -> Level: MainLevel(23) -> Fade: 2 (skipped)
06:33:01.089  Action: END-REP (skipped)
06:33:01.101  Action: While (Bedroom Presence(off) is on(F) AND TV(off) is on(F) AND Mode in [Day, Night](T) [FALSE]) Repeat every 0:15:00 (skipped)
06:33:01.109  Action: IF (Variable MainLevel(23) is >= 30(F)) THEN (skipped)
06:33:01.112  Action: Color Temperature: His Lamp, Hers Lamp: MainCT(1935) -> Level: 30 -> Fade: 2 (skipped)
06:33:01.119  Action: ELSE-IF (Variable MainLevel(23) is < 30(T)) THEN (skipped)
06:33:01.176  Action: Color Temperature: His Lamp, Hers Lamp: MainCT(1935) -> Level: MainLevel(23) -> Fade: 2 (skipped)
06:33:01.178  Action: END-IF (skipped)
06:33:01.180  Action: END-REP (skipped)
06:33:01.189  Action: ELSE-IF (Bedroom Presence(off) is off(T) OR Mode in [Away, Sleeping](F) [TRUE]) THEN
06:33:01.192  Action: Off: His Lamp, Hers Lamp
06:33:01.620  Action: END-IF

06:33:03.600  Event: Actions run by 'Sunrise Routine'
06:33:03.616  Action: Stop Repeating Actions
06:33:03.654  Action: IF (Bedroom Presence(off) is on(F) AND Mode in [Day, Night](T) [FALSE]) THEN (skipping)
06:33:03.667  Action: While (...) Repeat every 0:15:00 (skipped)
06:33:03.672  Action: Color Temperature: ... (skipped)
06:33:03.674  Action: END-REP (skipped)
06:33:03.687  Action: While (...) Repeat every 0:15:00 (skipped)
06:33:03.694  Action: IF (Variable MainLevel(23) is >= 30(F)) THEN (skipped)
06:33:03.697  Action: Color Temperature: ... Level: 30 -> Fade: 2 (skipped)
06:33:03.704  Action: ELSE-IF (Variable MainLevel(23) is < 30(T)) THEN (skipped)
06:33:03.707  Action: Color Temperature: ... Level: MainLevel(23) -> Fade: 2 (skipped)
06:33:03.709  Action: END-IF (skipped)
06:33:03.711  Action: END-REP (skipped)
06:33:03.721  Action: ELSE-IF (Bedroom Presence(off) is off(T) OR Mode in [Away, Sleeping](F) [TRUE]) THEN
06:33:03.723  Action: Off: His Lamp, Hers Lamp
06:33:04.151  Action: END-IF

06:33:17.071  Event: Actions run by 'Sunrise Routine'
06:33:17.088  Action: Stop Repeating Actions
06:33:17.126  Action: IF (Bedroom Presence(off) is on(F) AND Mode in [Day, Night](T) [FALSE]) THEN (skipping)
06:33:17.139  Action: While (...) Repeat every 0:15:00 (skipped)
06:33:17.144  Action: Color Temperature: ... (skipped)
06:33:17.146  Action: END-REP (skipped)
06:33:17.160  Action: While (...) Repeat every 0:15:00 (skipped)
06:33:17.168  Action: IF (Variable MainLevel(23) is >= 30(F)) THEN (skipped)
06:33:17.170  Action: Color Temperature: ... Level: 30 -> Fade: 2 (skipped)
06:33:17.177  Action: ELSE-IF (Variable MainLevel(23) is < 30(T)) THEN (skipped)
06:33:17.180  Action: Color Temperature: ... Level: MainLevel(23) -> Fade: 2 (skipped)
06:33:17.183  Action: END-IF (skipped)
06:33:17.184  Action: END-REP (skipped)
06:33:17.194  Action: ELSE-IF (Bedroom Presence(off) is off(T) OR Mode in [Away, Sleeping](F) [TRUE]) THEN
06:33:17.196  Action: Off: His Lamp, Hers Lamp
06:33:17.625  Action: END-IF

06:43:01.406  Event: Bedroom Presence switch on
                [— NO TRIGGER HERE!!! —]

06:46:42.876  Event: Bedroom Presence switch off
06:46:42.897  Triggered: Bedroom Presence, TV any turns *changed*
06:46:42.910  Action: Stop Repeating Actions
06:46:43.041  Action: IF (Bedroom Presence(off) is on(F) AND Mode in [Day, Night](T) [FALSE]) THEN (skipping)
06:46:43.058  Action: While (...) Repeat every 0:15:00 (skipped)
06:46:43.063  Action: Color Temperature: ... (skipped)
06:46:43.065  Action: END-REP (skipped)
06:46:43.078  Action: While (...) Repeat every 0:15:00 (skipped)
06:46:43.086  Action: IF (Variable MainLevel(27) is >= 30(F)) THEN (skipped)
06:46:43.088  Action: Color Temperature: ... Level: 30 -> Fade: 2 (skipped)
06:46:43.096  Action: ELSE-IF (Variable MainLevel(27) is < 30(T)) THEN (skipped)
06:46:43.099  Action: Color Temperature: ... Level: MainLevel(27) -> Fade: 2 (skipped)
06:46:43.101  Action: END-IF (skipped)
06:46:43.103  Action: END-REP (skipped)
06:46:43.111  Action: ELSE-IF (Bedroom Presence(off) is off(T) OR Mode in [Away, Sleeping](F) [TRUE]) THEN
06:46:43.114  Action: Off: His Lamp, Hers Lamp
06:46:43.553  Action: END-IF

06:50:43.735  Event: Bedroom Presence switch on
06:50:43.759  Triggered: Bedroom Presence, TV any turns *changed*
06:50:43.868  Action: Stop Repeating Actions
06:50:43.924  Action: IF (Bedroom Presence(on) is on(T) AND Mode in [Day, Night](T) [TRUE]) THEN
06:50:43.950  Action: While (Bedroom Presence(on) is on(T) AND TV(off) is off(T) AND Mode in [Day, Night](T) [TRUE]) Repeat every 0:15:00 (repeating)
06:50:44.088  Action: Repeating Actions While True
06:50:44.118  Action: Color Temperature: His Lamp, Hers Lamp: MainCT(2169) -> Level: MainLevel(29) -> Fade: 2
06:50:44.644  Action: END-REP (waiting for next)

I see the triggers for the rule (they are in Dutch)

To test this, I created a simple rule to isolate it from my more complex setup.

The rule:

Name: Test Rule
Trigger: Testbutton(off) turns *changed*

Actions:
Log: 'Rule Triggered'
IF (Testbutton is on) THEN
    Log: 'Rule was executed. Testbutton is on.'
ELSE
    Log: 'Rule was executed. Testbutton is off.'
END-IF

The logs:

18:05:45.571  Event: Testbutton switch on
18:05:45.583  Triggered: Testbutton(on) turns *changed*
18:05:45.592  Action: Log: 'Rule Triggered'
18:05:45.595  Rule Triggered
18:05:45.600  Action: IF (Testbutton(on) is on(T) [TRUE]) THEN
18:05:45.604  Action: Log: 'Rule was executed. Testbutton is on.'
18:05:45.607  Rule was executed. Testbutton is on.
18:05:45.611  Action: ELSE (skipping)
18:05:45.614  Action: Log: 'Rule was executed. Testbutton is off.' (skipped)
18:05:45.617  Action: END-IF

18:05:49.746  Event: Testbutton switch off
18:05:49.770  Triggered: Testbutton(off) turns *changed*
18:05:49.783  Action: Log: 'Rule Triggered'
18:05:49.791  Rule Triggered
18:05:49.794  Action: IF (Testbutton(off) is on(F) [FALSE]) THEN (skipping)
18:05:49.800  Action: Log: 'Rule was executed. Testbutton is on.' (skipped)
18:05:49.803  Action: ELSE (do actions)
18:05:49.806  Action: Log: 'Rule was executed. Testbutton is off.'
18:05:49.809  Rule was executed. Testbutton is off.
18:05:49.812  Action: END-IF

18:06:11.058  Event: Testbutton switch on
18:06:11.083  Triggered: Testbutton(on) turns *changed*
18:06:11.097  Action: Log: 'Rule Triggered'
18:06:11.107  Rule Triggered
18:06:11.110  Action: IF (Testbutton(on) is on(T) [TRUE]) THEN
18:06:11.115  Action: Log: 'Rule was executed. Testbutton is on.'
18:06:11.119  Rule was executed. Testbutton is on.
18:06:11.122  Action: ELSE (skipping)
18:06:11.125  Action: Log: 'Rule was executed. Testbutton is off.' (skipped)
18:06:11.128  Action: END-IF

18:06:18.930  Event: Paused by '**This Rule**'          [manually triggered]

18:06:28.591  Testbutton was turned off
                [— no Triggered line at all —]

18:06:39.609  Event: Resumed by '**This Rule**'          [manually triggered]

18:06:44.525  Testbutton was turned on
18:06:44.554  Event: Testbutton switch on
                [— no Triggered line, no further action —]

18:06:53.511  Event: Paused by '**This Rule**'          [manually triggered]

18:06:59.307  Testbutton was turned off
                [— no Triggered line at all —]

18:07:04.954  Event: Resumed by '**This Rule**'          [manually triggered]

18:07:09.381  Testbutton was turned on
18:07:09.402  Event: Testbutton switch on
                [— no Triggered line, no further action —]

So here's what actually happens, step by step:

Time Event Rule reaction
18:05:45 Testbutton switch on :white_check_mark: Triggered — logged normally
18:05:49 Testbutton switch off :white_check_mark: Triggered — logged normally
18:06:11 Testbutton switch on :white_check_mark: Triggered — logged normally
18:06:18 (manual: Pause Rules) Rule paused
18:06:28 Testbutton switch off :cross_mark: Not triggered (expected — rule was paused)
18:06:39 (manual: Resume Rules) Rule resumed
18:06:44 Testbutton switch on :cross_mark: Not triggered — event logged, but no "Triggered:" line, no actions ran at all
18:06:53 (manual: Pause Rules) Rule paused
18:06:59 Testbutton switch off :cross_mark: Not triggered (expected — rule was paused)
18:07:04 (manual: Resume Rules) Rule resumed
18:07:09 Testbutton switch on :cross_mark: Not triggered — same as above

Every event while the rule was actively running triggers correctly. Every event while paused is correctly ignored (as expected). But the first trigger event immediately after each Resume Rules is silently missed — no error, no log trace, nothing. This happened twice in a row, same pattern both times, so it's consistently reproducible for me, not a one-off fluke.

Is this by design, or is this a bug?

If it's expected behavior, is there a recommended way to work around it — e.g., forcing the rule to re-sync its trigger state right after resume, without just guessing at a delay? I found that manually calling Run Actions after Resume Rules works around it, but that feels like a patch rather than a real fix, and it doesn't scale well if this pattern shows up in rules with more complex trigger conditions.

Would appreciate any insight — thanks!

Workaround found

After more testing, I think I've found what actually causes this — and a workaround.

The difference: in my original test, the trigger was set as Testbutton turns *changed* — a single combined trigger. Every time, the first event after Resume Rules was silently missed:

Triggered: Testbutton(on) turns *changed*

I then changed the trigger to two separate, explicit triggers instead — Testbutton turns on OR Testbutton turns off — and ran the exact same pause/resume test three more times. Every single time, the trigger fired correctly right after resume, with no gap:

Triggered: Testbutton switch on
Triggered: Testbutton switch off

My guess at the cause: a *changed* trigger needs to remember the previous value to determine whether an actual change occurred. That internal "last known value" seems to get out of sync during pause/resume, so the first real event afterward doesn't register as a "change" even though it clearly is one. Explicit turns on / turns off triggers don't need that reference point — they just react to the event value itself, regardless of what happened right before — so they don't hit this issue.

Workaround: if you have a rule that gets paused/resumed (e.g. by another rule, like a sunrise/wake-up routine), avoid a combined turns *changed* trigger on the affected device(s). Use separate explicit triggers instead (turns on OR turns off, or the equivalent for other event types). In my testing this fully avoided the missed-trigger issue across multiple repeated pause/resume cycles.

Hope this saves someone else the debugging time — still curious if anyone from the Hubitat team can confirm this is actually what's going on internally with *changed* trigger state during pause/resume.

I haven't ever run into this. However, I use required expressions with virtual switches or booleans to disable rules instead of pausing them. I also use the re-evaluate required expression on startup to make sure they stay in sync.

I have paused rules that rely on changed states for testing though and didn't have that issue. But I also can't say definitively (relying on memory) that the changed states had changed while the paused rule was paused.

I do have one rule for power failure that relies on ring range extenders changing from line power to battery. That one also runs on "changed" and is guaranteed to be in a different state from when the hub is rebooted after a power outage. It isn't paused, the hub is usually off when the power resumes and doesn't finish booting until after all the power is restored (95% of the time) Never had issues with it detecting changed states in that situation.

I get notification of a power outage
I wait 30 minutes, if the power isn't back, I shut down the hub (it is on a UPS)
Power comes back on
Hub takes a few minutes to reboot (in the mean time, the extenders have ALL switched back from battery to line)
Next outtage is detected as normal.

Fortunately (tongue in cheek), power unreliability of late is reliable enough to use as a practical test for this. With the storms we have had of late, I have had SEVERAL power outages over the past month.

click to expand

So, if the bug is there, it appears to ONLY be on the actual "pause/resume" cycle.

P.S. If you change those delays you have to Wait for elapsed time, does it change the behavior?

Waits = reset on new trigger
Delay = must be canceled or completed and will run multiple instances simultaneously - which can cause weirdness

Honestly, I would do this completely differently

Give rule one a required condition of "Private Boolean = true" and set it to cancel pending actions when not true and re-evaluate on startup.

In rule two, instead of pausing rule number one:
Set Private Boolean for rule 1 to false where you would pause it, and
Set Private Boolean for rule 1 to true where you would resume it.

Same effect with no bugs.

I would also likely change all those delays you have to Wait for Event: Elapsed time as opposed to delays.

(I do this with several rules and it works well)

I'm not staff but I think we can confirm your finding anyway.

In the app state, there will be something like this for your changed trigger device attribute (a switch here) :
image

129 is the device ID corresponding to the switch device.

When the rule is active and the device state is changed, that value updates. When the rule is paused and the device state is changed, that value does not update.

Perhaps more importantly, that vale does not update when the rule is resumed, either.

Created a rule with trigger changed to log %device% changed to %value%
Verified logging of switch change
Paused rule
changed switch
resumed rule
changed switch - no log entry
changed swicht again - log entry

Pretty cut and dry

I am guessing the reason I have not run into this before is because I don't pause rules typically. I disable them with required expressions.

Log shows app and trigger device

Using required expression solves the issue

hidden text