Debug help Possible malformed IF statement

Not sure why my repeating action isn't working properly.
I'm not sure if there's a malformed statement or whats preventing the actions from repeating.

The best thing to do is enable all logging for the rule, then look at the output of Logs, filtered to just this rule, to see what it's doing when. You might be able to figure something out on your own that way. For that general process, see: How to Troubleshoot Apps or Devices | Hubitat Documentation

If you want others to help, a full-size screenshot may be helpful, as the largest one I can download from your post is still too small to read easily. Providing the output of Logs would also be helpful to someone else, too.

Finally, you have lots of nested repeats and a very complicated rule in general that might be easier to write and troubleshoot by breaking it up into smaller pieces. It seems you are aware that you can run one rule's actions from another, as that is what you are doing, but more of that might make everything simpler -- and prevent problems if you're running into things like overlapping repeats.

Some of your actions also look like they are trying to address devices that did not respond on the first try. Most of them also look like they have a "refresh." Do your devices not respond with their new state? That is unusual, but maybe something that could be addressed in the driver if you share more about what devices they are and what driver they are using. If you are just concerned about devices not responding to the command on the first try, the new Command Retry feature in 2.4.1, just released, can also help you address that concern on a device-by-device basis for supported device types without you needing to implement this logic on your own.

Otherwise, any guidance you can provide someone else in untangling this mess too would be helpful. :smiley:

1 Like

awesome reply @bertabcd1234
Appreciate that.
Yes its confusing/complicated rule that i would love to simplify.

Calling other rules from this rule works, but that complicated my debugging on why this rule is always breaking.

Ive had the pump run dry on multiple occasions do to this rule not performing correctly which damages the pump.

I need to be sure the device turns off, I want the rule to command a device to function then verify that it is in that state before moving on.

I have a water pump for spraying plants that i want to turn on and off.

I have two level sensors that act as safety sensors that must prevent the pump from running ( Water supply tank and waste water collection tank). Because it is an equipment safety A CLOSED sensor state means it is OK to operate.

when the pump turns on i need the fans to stop running so the water mist is not blown all over the place.

Functional description is:
The following Herb garden pump actions will repeat every 5 seconds until cancelled.
Refresh the devices to be sure accurate device status is used for logic.

First logic block will check the water level sensors before acting the pump on.
If the sensors are not closed the ELSE statements are used to determine which sensor is open and send me a notification.

If the water level sensors are OK (CLOSED) then I will check when the last time the pump was turned on and turned off.
I check the last time it was turned off to prevent the pump from being turned on immediately after it was turned off because the Rule repeats.
I check the last time the pump was turned on to correctly time (Currently 1 minute) the amount of water sprayed. Once the time exceeds set-point ill command the pump to turn off and turn-on the fans delayed by 3 minutes, also prevents water from being blown everywhere.

hope that helps explain what im doing here.

So I found out that you cannot nest multiple repeats. I dont think this is in the documentation or I never seen it.
Once I got rid of the while loops nested in the main repeat and restructured it to get the logic I was needing everything worked.

I had to break it up into 3 separate rules;
-Start
-Run
-Monitor sensors

thanks for the feedback a suggestions @bertabcd1234

1 Like