Rule became true but action did not run

If it's a virtual switch, you can put it an auto-off on a timer. Look at the preferences for the device. Basically turns it into a momentary switch. But you've got a delay with cancel on truth change for 45 minutes, so I guess that won't work.

Yeah, it's a custom virtual switch (just since that allows a longer duration) acting as a momentary switch it's just the delay is longer than delays in the the action itself. My cancel on truth change is simply to allow me to stop the action in case I forgot to disable it during a day off / sick day / whatever. It was the simplest way I could think of but I suppose I could introduce another override switch and use that instead.

I just got home and as far as I can tell, the timed switch did actually turn itself off... I'm not sure why the rule events show no off for it?

Need to see the app logs for that.

Sorry, which app logs? The logs from the rule itself are in the original post. Here are the logs for that switch if that's helpful.

I had this happen again this morning. The logs show the rule saw the switch turn on and the events for the rule show the same. But, at 6:25am when it should've started changing the lighting, it didn't. You can see what I would've expected to see at 6:39am when I manually started the rule to wake my wife up and you can see there's no repeat logged which, per the rule, would've started at about 6:35am. I'm also attaching the rule (just in case) as it's changed just a bit since my OP.

@bravenel, any idea why this may not happen? I spaced and didn't check the scheduled jobs for the rule before manually activating but will definitely try to do that if I see this again. If you have any other pointers on what to check or useful data to grab please let me know.


Does this work on other days, just failed today?

Really need to see more of the logs than what you've shown.

yeah, it has generally worked but failed this morning. The last failure (that wasn't my fault) was 14 days ago when I last posted.
I'm not sure there's much else useful in the logs but here's a 3 hour section of everything in case you see something there that means more to you than me.

Given the 3 entries in a row with Bedroom wake up is on, my guess is that the rule didn't change rule truth at 6:25, so didn't run. But that's not really visible in the logs. Do you know why there are three such entries in a row?

The times are different; not sure why it was there twice at 6:39am but that's when I woke up and manually ran the rule.
At 6:35 we see the switch turn on:
dev:5752019-06-20 06:24:57.308 am debugTurning off in 5400 seconds dev:5752019-06-20 06:24:57.306 am debugSwitch Timer with Reset Version 1.0 - ON
and then after we see the rule log the event and condition:

app:10902019-06-20 06:24:57.586 am info --> Bedroom wake up(on) is on [true]
app:10902019-06-20 06:24:57.502 am info[Lighting] Gentle wake up: Bedroom wake up switch on

the next log entry is at 6:39 which should be unrelated.

Here is the event page for that switch showing it was off and then on at 6:25

This happened again this morning. Unfortunately by the time I woke up, there would not have been any scheduled tasks in the rule so no use checking that. I’ve attached logs and the event history for the rule, both of which seem to show it should have run.

Manually toggling the switch again did trigger this. It was definitely off before but maybe there is something different about the timed off vs manual off?

You should turn on logging in the rule, and then show those logs. It clearly ran. So if it didn't do what you expected there is probably some other explanation for that. Can't tell you anything more from the sparse information you've provided.

I had events and actions turned on. I would've expected useful logs from the actions part (and have seen that in the past) if it had actually run. I'm not sure how you're making the assertion it definitely ran?

I've just turned on all logging but don't think that'll help shed light on it since action logging was empty.

Given toggling the switch manually (still via HomeKit but not off via timed off) I'm wondering if there's something odd about the timer event though the code seems pretty straightforward using #runIn. The only difference (I suspect) between this and using the native one is this one allows much longer delayed off times... it does seem to turn off so I'm not sure what would be odd about events during a longer delayed off vs. a more immediate one.

However, I'm also now thinking I don't even need auto-off since all the work you've done in RM3 should allow me to turn it off via the true action... I'm a bit curious so I may tinker a bit but think in the end I'll try setting things up directly in the rule to remove the switch side of the variable and see if it fixes it or not.

The event log shows the repeat, does it not?

That's the wrong date :slight_smile: It should've run this morning and the event log shows it saw it turn on but nothing beyond that.

OK. As before, are you sure that rule truth is changing? Perhaps try it as a Triggered Rule triggered by the switch state changing.

I'm 100% sure the truth is changing in so far as I checked switch states last night and all were off and the logs show it went on this morning. I'm not manually turning it off of course so I can only go by what the dashboard said it was. And we had a few power outages yesterday so I have no logs from Friday (even if they didn't roll over by now).
And I just tried setting the delayed off to 1 minute and was able to have the rule run (when I turned the switch on) twice in a row; that is, the timer expired and the switch went off thus cancelling the rule (and I can see the lights turning o) and then I was able to repeat that.

I had it as a triggered rule initially and, if I recall, I changed because I was no longer able to have the cancel on truth change work which I want so I can stop the actions easily manually.

I've updated the rule to just turn the switch off directly and the switch is now a native virtual switch (with no timer). Hopefully that removes the extra level of uncertainty that is possibly in the timed virtual switch and if nothing else makes it clearer what's happening (I hope).

Can't you test this by just turning the "Bedroom wake up" switch on / off on its device page?

Yes but that seems to work consistently (or at least the >5 times I tried). That's why I was speculating something about the auto-off part of the timed virtual switch.... it's the only part I can't easily replicate manually. I did try it ~3 times with a shorter timed off (1 minute vs. 90 minutes) and it worked just fine so maybe it's unrelated but that off event is the only thing I can think of that's messing stuff up as the rest seems relatively straightforward.

The new rule also works fine (when manually triggered) and removes the timed portion of the switch.