Hi Guys,
I often add log statements in my rules as a means to follow up on rules, but is there a way to add a log statement to be able to read in a log file if the required expression was met or not when the rule executed?
Cheers,
Hi Guys,
I often add log statements in my rules as a means to follow up on rules, but is there a way to add a log statement to be able to read in a log file if the required expression was met or not when the rule executed?
Cheers,
I would say that this cannot be logged via a log statement since the rule wonāt execute if the required expression is not met. However, maybe turning on all logging for the rule could reveal that.
I have a rule with a required expression that never actually triggers due to the required expression rarely getting met, but the rule itself gets more hits and takes up more CPU time than any other rule. It appears that evaluating the required expression everytime a triggerable value changes definitely happens. I would think it is possible to log this somehow.
It's a rule that monitors my hot water heater temp to alert me when hot water is running low. As I said, the notification never happens because the required expression never gets met, BUT it's clear from apps stats that this rule runs constantly.
Well thatās odd - required expression is supposed to stop it from running. Can you turn on all logging and post the results from the rule? Can you also show a screenshot showing its CPU usage?
Yeah, but he's talking about evaluation of the Required Expression itself. That's not free, and for a device that throws a lot of events, it could indeed be very busy -- doesn't do anything other than decide it shouldn't do anything.
Yea, good point!
I think Bruce basically answered the question, but, since you asked....
Here's the rule logic:
And here's the App Stats logs:
This rule hasn't actually "triggered" any time in the last several weeks, so there are no instances of the rule actually running in past logs, but it's pretty clear from App Stats that evaluating the Required Expression every time the temperature is updated, even when it's not within the trigger range.
This particular device is an ESP-Home integration, and it can be extremely chatty. It updates the temperature values nearly constantly.
Is there a reason to have the tank temperature value in both the required expression and the trigger? Based on Bruceās response, I suspect it makes no differenceā¦ and I would likely not have it in the required expressions and just leave it as a trigger.
I wonder if it might not require less processing to just have the rule run every hour, and move the condition/trigger to the actions as a conditionā¦?
I also have the ESP-Home on my Rheem Heat Pump Water heater. Works great!
It was an attempt to get to the bottom of why the resource usage was so high. I was trying various ways of limiting it's activity. One of the things I discovered with this rule is that, for whatever reason, a conditional trigger costs way more in resources than a required expression.
I still have the ESP-Econet connected to Home Assistant. It averages the top and bottom tank temperatures and then hands that value to Hubitat. Right now it's doing that conversion in real-time, so anytime the upper OR lower temp changes, a new average temp is sent to Hubitat. I think I'm going to remove the temperature portion of the required expression, and have Home Assistant only update the average temperature every 3 minutes. That should solve the problem.
However, I will say that I've managed to learn quite a lot about Rule Machine's inner workings just by watching this rule and making several changes to it to see what is impacted.
Yup - thatās also in good part how I learned RM.