Error on notification rule using private boolean

Hi All,

I've created a simple rule that monitors the energy usage of a sump pump, to notify me when it runs and to notify again if it runs for more than two minutes. To stop the rule from sending multiple notifications for the same event, I implemented private boolean in the rule to only send the notification once. Here's my rule:

However, I notice after the two minute wait, the rule does not set the private boolean back to true. Looking in the logs, I have found this:

app:2682020-12-14 08:37:59.380 pm errorjava.util.NoSuchElementException: Cannot pop() an empty List on line 6918 (delayedActs)

I turned on action logging, and this is how the rule plays out whenever I simulate the sump pump running (below). Any thoughts on what I'm doing wrong and how to correct the rule? Thanks!

app:2682020-12-14 08:37:59.380 pm errorjava.util.NoSuchElementException: Cannot pop() an empty List on line 6918 (delayedActs)

app:2682020-12-14 08:37:59.357 pm infoAction: END-IF

app:2682020-12-14 08:37:59.355 pm infoAction: Notify Ryan's Phone, Mike's Phone: 'Sump Pump is OFF' (skipped)

app:2682020-12-14 08:37:59.351 pm infoAction: Wait for condition: Power level of Basement - Sump Pump(0.000) is <= 0.0 TRUE (skipped)

app:2682020-12-14 08:37:59.335 pm infoAction: Notify Ryan's Phone, Mike's Phone: 'Sump Pump has been running for more than 2min' (skipped)

app:2682020-12-14 08:37:59.332 pm infoAction: IF (Power level of Basement - Sump Pump(0.000) is >= 100.0(F) [FALSE]) THEN (skipping)

app:2682020-12-14 08:37:59.313 pm infoAction: Set Private Boolean True

app:2682020-12-14 08:37:59.280 pm infoDelay Over: Delay 0:02:00

app:2682020-12-14 08:36:06.400 pm infoAction: END-IF

app:2682020-12-14 08:36:06.398 pm infoAction: END-IF (skipped)

app:2682020-12-14 08:36:06.395 pm infoAction: Notify Ryan's Phone, Mike's Phone: 'Sump Pump is OFF' (skipped)

app:2682020-12-14 08:36:06.392 pm infoAction: Wait for condition: Power level of Basement - Sump Pump(744.363) is <= 0.0 FALSE (skipped)

app:2682020-12-14 08:36:06.374 pm infoAction: Notify Ryan's Phone, Mike's Phone: 'Sump Pump has been running for more than 2min' (skipped)

app:2682020-12-14 08:36:06.370 pm infoAction: IF (Power level of Basement - Sump Pump(744.363) is >= 100.0(T) [TRUE]) THEN (skipped)

app:2682020-12-14 08:36:06.349 pm infoAction: Set Private Boolean True (skipped)

app:2682020-12-14 08:36:06.334 pm infoAction: Delay 0:02:00 (skipped)

app:2682020-12-14 08:36:06.331 pm infoAction: Notify Mike's Phone: 'Sump Pump RUNNING' (skipped)

app:2682020-12-14 08:36:06.328 pm infoAction: Set Private Boolean False (skipped)

app:2682020-12-14 08:36:06.311 pm infoAction: IF (Power level of Basement - Sump Pump(744.363) is >= 100.0(T) AND Private Boolean is true(F) [FALSE]) THEN (skipping)

app:2682020-12-14 08:36:06.063 pm infoAction: END-IF

app:2682020-12-14 08:36:06.061 pm infoAction: END-IF (skipped)

app:2682020-12-14 08:36:06.059 pm infoAction: Notify Ryan's Phone, Mike's Phone: 'Sump Pump is OFF' (skipped)

app:2682020-12-14 08:36:06.048 pm infoAction: END-IF

app:2682020-12-14 08:36:06.043 pm infoAction: END-IF (skipped)

app:2682020-12-14 08:36:06.028 pm infoAction: Wait for condition: Power level of Basement - Sump Pump(744.363) is <= 0.0 FALSE (skipped)

app:2682020-12-14 08:36:06.028 pm infoAction: END-IF

app:2682020-12-14 08:36:06.027 pm infoAction: END-IF (skipped)

app:2682020-12-14 08:36:06.024 pm infoAction: Notify Ryan's Phone, Mike's Phone: 'Sump Pump is OFF' (skipped)

app:2682020-12-14 08:36:06.020 pm infoAction: Notify Ryan's Phone, Mike's Phone: 'Sump Pump is OFF' (skipped)

app:2682020-12-14 08:36:06.016 pm infoAction: Wait for condition: Power level of Basement - Sump Pump(744.363) is <= 0.0 FALSE (skipped)

app:2682020-12-14 08:36:06.016 pm infoAction: Wait for condition: Power level of Basement - Sump Pump(744.363) is <= 0.0 FALSE (skipped)

app:2682020-12-14 08:36:05.932 pm infoAction: Notify Ryan's Phone, Mike's Phone: 'Sump Pump has been running for more than 2min' (skipped)

app:2682020-12-14 08:36:05.928 pm infoAction: IF (Power level of Basement - Sump Pump(619.677) is >= 100.0(T) [TRUE]) THEN (skipped)

app:2682020-12-14 08:36:05.911 pm infoAction: Notify Ryan's Phone, Mike's Phone: 'Sump Pump has been running for more than 2min' (skipped)

app:2682020-12-14 08:36:05.897 pm infoAction: IF (Power level of Basement - Sump Pump(619.677) is >= 100.0(T) [TRUE]) THEN (skipped)

app:2682020-12-14 08:36:05.892 pm infoAction: Set Private Boolean True (skipped)

app:2682020-12-14 08:36:05.858 pm infoAction: Delay 0:02:00 (skipped)

app:2682020-12-14 08:36:05.854 pm infoAction: Notify Mike's Phone: 'Sump Pump RUNNING' (skipped)

app:2682020-12-14 08:36:05.854 pm infoAction: Set Private Boolean True (skipped)

app:2682020-12-14 08:36:05.847 pm infoAction: Notify Ryan's Phone, Mike's Phone: 'Sump Pump has been running for more than 2min' (skipped)

app:2682020-12-14 08:36:05.844 pm infoAction: IF (Power level of Basement - Sump Pump(619.677) is >= 100.0(T) [TRUE]) THEN (skipped)

app:2682020-12-14 08:36:05.842 pm infoAction: Set Private Boolean False (skipped)

app:2682020-12-14 08:36:05.830 pm infoAction: END-IF

app:2682020-12-14 08:36:05.826 pm infoAction: Delay 0:02:00 (skipped)

app:2682020-12-14 08:36:05.822 pm infoAction: END-IF (skipped)

app:2682020-12-14 08:36:05.823 pm infoAction: Notify Mike's Phone: 'Sump Pump RUNNING' (skipped)

app:2682020-12-14 08:36:05.787 pm infoAction: IF (Power level of Basement - Sump Pump(619.677) is >= 100.0(T) AND Private Boolean is true(F) [FALSE]) THEN (skipping)

app:2682020-12-14 08:36:05.810 pm infoAction: Notify Ryan's Phone, Mike's Phone: 'Sump Pump is OFF' (skipped)

app:2682020-12-14 08:36:05.807 pm infoAction: Wait for condition: Power level of Basement - Sump Pump(619.677) is <= 0.0 FALSE (skipped)

app:2682020-12-14 08:36:05.806 pm infoAction: Set Private Boolean True (skipped)

app:2682020-12-14 08:36:05.806 pm infoAction: Set Private Boolean False (skipped)

app:2682020-12-14 08:36:05.782 pm infoAction: Notify Ryan's Phone, Mike's Phone: 'Sump Pump has been running for more than 2min' (skipped)

app:2682020-12-14 08:36:05.778 pm infoAction: IF (Power level of Basement - Sump Pump(619.677) is >= 100.0(T) [TRUE]) THEN (skipped)

app:2682020-12-14 08:36:05.762 pm infoAction: IF (Power level of Basement - Sump Pump(619.677) is >= 100.0(T) AND Private Boolean is true(F) [FALSE]) THEN (skipping)

app:2682020-12-14 08:36:05.753 pm infoAction: Set Private Boolean True (skipped)

app:2682020-12-14 08:36:05.744 pm infoAction: Delay 0:02:00 (skipped)

app:2682020-12-14 08:36:05.741 pm infoAction: Notify Mike's Phone: 'Sump Pump RUNNING' (skipped)

app:2682020-12-14 08:36:05.673 pm infoAction: Set Private Boolean False (skipped)

app:2682020-12-14 08:36:05.679 pm infoAction: Delay 0:02:00 (skipped)

app:2682020-12-14 08:36:05.676 pm infoAction: Notify Mike's Phone: 'Sump Pump RUNNING' (skipped)

app:2682020-12-14 08:36:05.673 pm infoAction: Set Private Boolean False (skipped)

app:2682020-12-14 08:36:05.535 pm infoAction: IF (Power level of Basement - Sump Pump(619.677) is >= 100.0(T) AND Private Boolean is true(F) [FALSE]) THEN (skipping)

app:2682020-12-14 08:36:05.508 pm infoAction: IF (Power level of Basement - Sump Pump(619.677) is >= 100.0(T) AND Private Boolean is true(F) [FALSE]) THEN (skipping)

app:2682020-12-14 08:36:05.494 pm infoAction: END-IF

app:2682020-12-14 08:36:05.487 pm infoAction: END-IF (skipped)

app:2682020-12-14 08:36:05.483 pm infoAction: Notify Ryan's Phone, Mike's Phone: 'Sump Pump is OFF' (skipped)

app:2682020-12-14 08:36:05.467 pm infoAction: Wait for condition: Power level of Basement - Sump Pump(619.677) is <= 0.0 FALSE (skipped)

app:2682020-12-14 08:36:05.260 pm infoAction: Notify Ryan's Phone, Mike's Phone: 'Sump Pump has been running for more than 2min' (skipped)

app:2682020-12-14 08:36:05.241 pm infoAction: IF (Power level of Basement - Sump Pump(595.779) is >= 100.0(T) [TRUE]) THEN (skipped)

app:2682020-12-14 08:36:05.074 pm infoAction: Set Private Boolean True (skipped)

app:2682020-12-14 08:36:05.017 pm infoAction: Delay 0:02:00 (skipped)

app:2682020-12-14 08:36:04.982 pm infoAction: Notify Mike's Phone: 'Sump Pump RUNNING' (skipped)

app:2682020-12-14 08:36:04.972 pm infoAction: Set Private Boolean False (skipped)

app:2682020-12-14 08:36:04.928 pm infoAction: IF (Power level of Basement - Sump Pump(595.779) is >= 100.0(T) AND Private Boolean is true(F) [FALSE]) THEN (skipping)

app:2682020-12-14 08:35:59.132 pm infoAction: Delay 0:02:00

app:2682020-12-14 08:35:59.114 pm infoAction: Notify Mike's Phone: 'Sump Pump RUNNING'

app:2682020-12-14 08:35:59.111 pm infoAction: Set Private Boolean False

app:2682020-12-14 08:35:59.094 pm infoAction: IF (Power level of Basement - Sump Pump(320.511) is >= 100.0(T) AND Private Boolean is true(T) [TRUE]) THEN

the AND condition is redundant as the pump going over 100 is your trigger.

just curious as to why you're using the boolean to begin with as it doesn't really offer much to the rule outside of being toggled after 2 minutes, although looking at your logs it does appear to trigger it quite frequently

have you tried using the Notifications app to accomplish your goal instead of a rule?

image

I use something like this for my door contact. I feel like this might be a cleaner solution for what you're trying to accomplish, just change it to your needs. this lets me know if the door has been opened after 5 minutes, and will cancel that notification if it closes in that time

Note the off in the true portion of the IF statement is just so i don't have a light on forever, you won't need that for your rule unless you want to cut off your pump after a certain time

The dadarkgtprince's comments are valid, but out of curiosity try a local boolean and see it works as you expect.

There have been a number of threads of folks using private booleans that don't work but will with a local.

Also unless they changed it, as I haven't checked, there used to be no way to use the notification app to notify on power levels. I put in a feature request for that a while back.

Thanks for your suggestions. However, the notifications app doesn't allow for power level notifications.

I suspect the multiple triggers to be the power level changing constantly as the sump pump runs.

Looking at your rule, it appears that you wouldn't get notified of the pantry door being open until 5min later.

In a nutshell, this is what i'm looking to do with my sump pump notifications:

-Sump Pump plugged into a Zooz ZEN15 for power level monitoring
-Notify me each time the sump pump runs (This way I know the pump is remaining active)
-Notify me again if the sump pump is running for more than 2 minutes, to indicate to me the float is either stuck, or there's a flood in the basement.
-If the sump pump ran for more than 2 minutes, also notify me when the sump pump no longer runs.

Just to clarify, you mean local variable, right? I can see that working and can test it out, set the local variable to 1 when the rule first runs, and then make it 0 when it's done.

Ahhh, I just found it. You can create a local variable to be a boolean. Just did that and it works! Thank you very much!

This is 'urban myth' and misleading, to say the least. While there are differences between a local variable and Private Boolean, there are no known validated problems with Private Boolean, just users with other problems blamed on their use.

@MikeBRW60 's problem stems from simultaneous instances of the rule running. Those will be a problem no matter what. These are caused by the embedded delays in the Conditional Action, and the rule being triggered again.

@MikeBRW60, please use screenshots to show logs, not copy past -- very much easier to read!

1 Like

These are caused by the embedded delays in the Conditional Action, and the rule being triggered again.

That's good info. Exactly what I needed. Thnx.

Okay here is an example of a Private Boolean not working as I expect. Maybe I am doing something wrong so look it over and let me know.

See rule below, if it works as intended when the crawlspace sensor detects motion it will send me and my wife a message. It will then not send another for 30 minutes.

I originally had the rule set to IF the private Boolean is false, but even though from looking at the rule it says it is currently false it still showed the IF statement as false, so I never got a notification. So I thought maybe since the Boolean had never been set in the rule it was in a unknown state. I then set the IF for not true. See the log below and that didn't work either. Am I reading it wrong? The true(F) means the Boolean is currently FALSE, yes? So it is not TRUE, thus the IF is TRUE since the crawlspace sensor active is TRUE?

This is a Aeon Multisensor 6, I had turned on the light but the sensor is very slow to update illuminance. This was the only trigger, according to the logs, of the rule while I was under the house.

Why don't you spare the brain damage of double negative and just test for PB false instead of NOT PB true?

You aren't showing enough log context to know what's going on, given the delayed setting of PB. That delayed action is never canceled, so it's going to happen no matter what state your rule is otherwise in. Also, Please use computer logs with screenshot if you want me to help.

I mentioned in my post above that that is what I originally had but it didn't work either.

I have created a test rule and got it working see below. After running it once and initializing it then worked. The values being shown for the Boolean are not correct or I am reading them wrong. I thought it was telling me it was currently False, but apparently it was True. Anyway with this change it will initialize the Boolean and then it seems to work.

My point was to spare me the brain damage of a double negative!

Only way to know what the values are is to see the logs, not the Rule display itself (this is not a dynamic page display).

This is the log from my crawlspace rule everything from the one trigger of the rule

This is the log from the test rule. One with it looking for False and one looking for not TRUE. This was before adding the ELSE.

I will admit that I'm not able to diagnose your rule -- over my brain power.

Ok I was reading it wrong. The Private Boolean is false(F) means the Private Boolean is True. So apparently it initializes as True.

Some way to manually change the value, like you can do with locals, might be useful.

PB always starts out True. You take that into account for how you use it, and the whether you are testing for true or false.