Problems with Trigger that is supposed to stay for 4 hours

I wonder if this is related to something I saw today. In the rule below I was editing it around 12:00 today. The rule was working but I made a few minor mods. So around 4:00 or 5:00PM it should have sent me a notification. I was looking at it around 9:00 and saw it still said it was waiting, and I checked the app status page and there was no scheduled event pending. I wasn't sure if a stays type trigger would set a pending event, but I assumed it should. I just let it keep running, and turned on logging. see screenshot below. I turned it on at 09:10. The second log screenshot shows it turn on and back off.

Around 10:00 the dehumidifier ran for a few minutes which restarted the stays once it shut off again. There is now a scheduled event at 2:00AM listed. So when I started the rule at 12:00 the dehumidifier was off but it was returning power readings < 5.0, I could see them on the device page under the events tab. For some reason, and perhaps that is the way it should work, it did not start the stays until after the power level went > 5 and then came back down.

I wonder if you are seeing the same thing since your log only shows the power above the level. Did you restart the rule before the transition? I don't think it should matter and should start the pending event trigger as soon as the device reports a level that breaks the threshold if an event is not already pending?

[edit]Didn't think there would be a response to this until perhaps tomorrow, so everything above was written before I saw @bravenel response.

1 Like

If you hit Done, it would not be waiting for anything after that.

1 Like

The trigger is reports < 5 and stays that way. It reported a value less than that many times. So it has to break the threshold and then report?

The OP's issue is entirely different than yours. His problem are two triggers that contradict each other, so it fails for both, effectively.

What your logs show is it reporting less than 5 and reporting that it's still waiting for 4:00 hours. Why would you expect something else? Then it goes over 5 and says it failed to wait the 4:00 hours. All as expected for what you have for a trigger.

I expected it to send a notification after 4 hours of reporting a value less than 5. At 9:00 it had been well over 8 hours and it had still not triggered.

I assumed once I clicked done on the rule, the next power reading of less than 5 watts would start the 4 hour clock. It did not, the 4 hour clock did not start until it reported a reading of > 5 and then dropped back below 5 again.

All I have to go on is what your logs show, and they only cover less than an hour. If you don't believe it works, test it over a much shorter period of time to confirm that it works or not. I've tested it extensively, and as far as I know it works as expected. If you can show logs that say otherwise, I'd be interested to see those,.

1 Like

Fair enough but as I mentioned I did not turn on the logs until 9:00 when I realized it hadn't sent me a notification.

So are you saying it should work as I thought, once I clicked done it should have triggered 4 hours after the next <5 watt reading?

1 Like

I don't know what happened at noon, or what the app saw or did. No way to tell. Saying it didn't do what you expected is not the same as showing that it failed somehow. I hope you understand that from a distance I need to see pretty hard proof about what is what to have any chance of knowing what happened.

Does it perhaps need to make the transition from >= 5 back down to <5 to start the timer?

1 Like

That's the question? If so then no need for further testing. If not then I will try some shorter test to see if I can verify the issue.

1 Like

It may be the case that hitting Done while it is waiting for a stay trigger may leave it in a bad condition. I will look into that tomorrow. The bad condition would be no timer running to end the stays period, while still treating new events as not being new triggers, but ones that are waiting.

I thought about adding the time remaining to the logs for these, instead of the original stays time that it shows now. That's a bunch of coding I didn't undertake because it's messy and annoying. But if my guess above is correct, then that would immediately show that as the problem.

There is a sure way to get a rule into a known starting state: Stop it. Then when you hit Done, you know that you have a fresh rule.

Good night.

2 Likes

Ok I cloned the rule above and only changed one thing, I set the stays time to 5 minutes. the first reading below 5 watts was at 12:26:26 as of 12:35:26 it still had not triggered. 13 minutes later. There is no event scheduled.

I tried to recreate the issues but it's working as expected.


1 Like

The reason that worked, I believe, is because your first level was above 10. That is the issue.

Once my rule got a value above 5 it then will trigger if it does not go over that level again in the stays time specified. If, however, every value was below the threshold it will never trigger.

Even before @pseudonym 's device reported above 8 it logged "Duration Met", which indicates it was not dependent on the value being above >= 10, as I had proposed earlier.

1 Like

I set the power to 2 then I saved the rule to clear out the wait and start over. I then set the power to 5 and 10 minutes later... nothing. No scheduled job. Power changes to 6 and still nothing. Power changed to 12 then 7 and scheduled job appears. I believe I've recreated your issue.

3 Likes

A post was merged into an existing topic: Believe this is a bug in Rule Machine

This mornings around 10:30 I updated the rule, after I realized it didn't do what I wanted. The trigger was not the issue it was the loop once it triggered. So the new rule has the same trigger. After I initialized and restarted rule, it has not gone above 5 watts, however, this time there is a pending event at 2:24 which would be 4 hours.

Why it's working this time and not last night I don't know.

new rule;

1 Like

As I noted last night, this is the problem, that you hit Done while the stays was pending, thus wiping out the scheduled time. This will get fixed, so that hitting Done kills any pending stays completely, instead of just partially as it does now. Unfortunately, the way it works now leaves it thinking there is a timer running, but there is not. So it will stay reporting that it is still staying until it reports above the threshold, thus ending that condition. This is why it starts working again after that as well. @terminal3 this explains your observations as well.

1 Like