Required expression rule stops part 2

This is a continuation of this thread.

I set up a rule to watch the cost value that should be updated and had it send me a reminder if it doesn't update in 10 minutes. I just got a message that the energy value had not updated. Screen shots of the rule are still in the old thread. Nothing has changed. It triggered at 05:49:30 and ended at 05:50:32, when it set the private Boolean back true

Here is a screen shot of the last run of the rule. Full logging on.

Here is a screen shot of the event log of the device. You can see the event at 05:49:30 and then it should have triggered the rule many times after that but it does not.

Here is a screen shot of the apps page. It does show Required expression false. I have not opened the rule at this point. This was a new browser window opened to view the apps page.

This is the variables page after opening the rule. The Private Boolean shows as True, also the header does not show the required expression as false.

As requested in previous thread. The application state settings shows the private Boolean True.

Lastly, there is no event subscription. So there are no scheduled events. and the rule no longer triggers.

Not sure what else I can show. The rule has been running for 8 days now, that is when I posted the last message in the other thread. I did reboot all my hubs last night around 9:00PM, when I updated to the latest firmware. No issues with the rule up to now.

After getting all the screen shots together I closed the browser window. I did not click done. I then went to the apps page again and it then no longer showed the required expression false message. All other items remained the same, and the rule is still not triggering. I will leave it in this state for a awhile longer in case there is anythgin else that needs to be looked at.

I just realized that I had another rule do the same thing. I wondered why I didn't see it on other rules as I have many that are basically clones of this one. The other rules monitor energy changes on various smart plugs for individual device cost. The rule hasn't been running for a while but I had not noticed. I have a table showing the monthly cost of various items. I noticed earlier today that the Air filter in the laundry room was significantly lower than that of the filter in our office. The two are identical devices, but the one in the laundry room should be greater as it runs at a higher fan speed. They are loud at high speed so I keep the fan lower in the office. Everything was the same as I posted above, Boolean was true but there was no event subscription. Also the rule I posted above is running on my C7, the rule that stopped for my Laundry room air filter was running on my C8 hub.

It appears that you have multiple instances of the rule running at the same time. Notice the lower logs, at the top:

You are attempting to prevent multiple instances by setting PB to false, and using the Required Expression on PB. But, that's not fool proof if the trigger events are very fast. Your logs don't show the full sequence so I can't really tell, but I can't think of any other reason for those doubled up logs at the end. Given the two instances, of course it's going to fail eventually.

The reality is that you have a complex set of things going on, too complex for anyone to analyze from afar as would be the case attempting to do it here in the community. This is pretty much the opposite of KISS principle for automation. I'd go so far as to say this is well outside the intentions for what the hub is designed for, and certainly outside the intentions for what Rule Machine is designed for. But, the unfortunate reality is that you have been tempted by the generalized rule engine nature of RM to push it beyond its intended use.

What you're doing belongs in some other app, in a dedicated app of some sort, possibly on a different system than the hub. Realistically, there is no hope of salvaging this approach since it doesn't work and no one can reasonably be expected to unravel the complexity. My suggestion is to rethink what you're trying to do.

I saw the double trigger at the end, but saw no indication that any other line in the rule was duplicated so I thought it was something with the delay that did that. The device trigger is only occurring every minute or more. I didn't think that would be an issue.

I get it though and I will let it go. I did some small groovy apps back during my ST days and maybe I will try that again.

Two questions -

  1. How often/fast is the HEM energy level tirgger changing?
  2. Why the 1min delay in restoring the PB to true - The rule itself is just a bunch of math & formatting and isn't really all the complex (IMHO), and just taking about 1 sec to execute, by my read of the logs.

The only real complexity is the 1min delay at the end, in restoring the PB and there are other ways to achive that - Hence my questions above

1 Like

You can see the HEM level is triggering in the screen shot about every min. The only reason I set up the PB was in case the HEM triggered quicker. It shouldn't but I just wanted to avoid a double trigger in case. I have an old HEM V2, which is about 8 years old now. The driver I am using is for the V5 but it seems to be working well now. I had to play around with parameters to get it working consistently. This is monitoring my whole house power and I had some issues at one point, quite some time ago now, with it sending out a lot of events. Also it's updating a cost variable and if it only updates every second it's no big deal.

If the device is updating a number that is monotonically increasing and you don’t need per-update resolution, another way to go would be a periodic schedule, say every 10 minutes, reading the device attribute directly instead of triggering on update events. You could skip the whole pb thing altogether.

1 Like