Can someone explain to me how to have my rule send ONE text notification, then repeat the "Speak on Sonos" 3 times every 3 minutes? It looks to me like the "Notify Phone" action is outside the "Repeat" / END-REP block. Yet when the rule triggers I get multiple text messages on my phone.
Start with the usual step for troushooting apps, especially helpful with rules in particular: enable all logging, and provide the output of those logs here.
Your rule looks like it should do what you said, so this will help figure what else must be going on. My guess is that it's not consistently staying under 1 W when idle or does so for more than one minute when not, but Logs will avoid this guessing.
You might also want to take a look at a rule I shared a while back that looks like it's what you're trying to do, sans the repeat (that would be easy to add; the difference here is how you're triggering and waiting for power):
Thanks, I had the same thought, that it had to do with the wattage. You can see below that it ultimately drops to 0 but might remain above 0 for a short while. So if the trigger was <= 1 it could be triggered at 1 and 0. I changed the trigger to "reports = 0.0" and that seems to have resolved the issue. Thanks for your help with this!
I would still look at Logs (my real suggestion; this was a likely guess, not a suggested solution without knowing more about your specifics), as that will show you what was really happening and how to address the issue with the way your rule was written compared to the way your device reports.
In any case, glad you have something working at least for now! Certainly revisit the above if that changes.
My guess is that it has to do with the trigger and the reporting frequency of your device. You are not using a private boolean to prevent retriggering. So, if your device reports every "X" minutes, and the wattage is not above your minimum threshold, it will retrigger the rule at every reporting period that matches the trigger.
You could add a required expression, Private Boolean False, then set the Private Boolean to true as first action, and set it to false as last action. This would prevent the rule from triggering again if it is already running.
Also, even though you made it stoppable, I did not see any logic/action in there to stop it. I would add a conditional step before the first action under the repeat statement, "If Power Level <= target value then Speak....." Or some other logic (maybe turn on a virtual switch at the start and turn it off when you open the washer or start the dryer) That way, you can cancel out.
All that said, there is an app, "Better Laundry Monitor" that handles repeat messages for both washer and dryer that works REALLY well. I think it is on the hubitat package manager if you are interested in a packaged deal and not trying to recreate all the rules manually.
As above. Ensure your rule only triggers at the start of the program and cannot retrigger while the wash program is active. Here's mine that has been working perfectly for a few years. The only issue I ever have is if my wife is standing by the machine waiting for the wash to complete and opens the door before the washer has reported it's lower power level at the end of the cycle. In that instance my notification doesn't clear and I have to open/close the door again.
Oh, so that's how private Booleans are utilized! I'll have to give that a try. What I did to prevent the rule from running more than one instance is wait until the wattage is 0 for at least a minute. It's working as desired now. But I like the idea of the private Boolean better since it doesn't rely on a device parameter.
I'm having difficulty duplicating your Boolean expression syntax. They way I currently have it shown in the screenshot it does not run at all. It says that the Boolean needs to be true for the actions to run. I try setting it to true at the top of my actions, and it still does not run. Can you tell me what I'm doing wrong?
You have again written the opposite logic of what was suggested. Flip the setting of the variable true and false around (or flip the value you're checking, but make sure you start it the right way).
Oh believe me, I've changed false to true and true to false more times than I care to. Regardless of what I change the parameters to, I cannot duplicate your initial Boolean expression like:
Glad you got it figured out! For the future, when troubleshooting rule behavior, a good first step is to enable all logging for the rule and then check Logs for output from that rule. Even if they don't make sense to you, sharing them here can be helpful for others.
I'll point to these tips again, where you'll find the above advice, plus additional tips:
What problem did you run into, specifically? As a guess, without knowing: are you looking at the values in parentheses? They reflect the current value of whatever comes before them. That will be different from hub to hub and at different times on the same hub, depending on the actual states. That doesn't need to be replicated, and their display can be toggled off if you want, but it can be helpful when writing the rule (if you want to get an idea of how the logic would cause things to flow right now) or when troubleshooting logged behavior (since these values are only logged then if enabled).
Logs, again, are going to be the only way you can know what was really happening. With them enabled, you may have been able to confirm a likely guess, that your PB got stuck in the "wrong" state due to previous attempts at writing or running the rule actions (but again: logs ).
I created this rule to monitor a vibration sensor attached to my dryer. It works well except when it completes it indicates "Required Expression false". I assume that's because the last line in the rule is "Set Private Boolean False". I thought it was set to false to stop the rule from executing. So I set the Boolean to true initially or else the actions will not run. Then I set it to True at the beginning of the actions. then at the end of the actions I set it to false, and therein lies the problem. I can easily change the variable to true, but should not have to manually.
Can someone explain to to me how to correctly utilize Boolean variables in this rule?
You don't need to assume (though this is likely based on the rule you wrote; this possibility has been pointed out above). Instead, you should look at logs. Is there a reason you refuse to enable them or provide their output here (as has also been previously suggested) to facilitate troubleshooting?
Doing so would greatly help, if not you then others.
Thanks. I know that's the case. But I thought I was setting the Boolean to false at the end of the rule to prevent the rule from running again. This began with a rule I wrote to monitor wattage and I found that it would run more then once under certain conditions unless I explicitly stopped it.
I'll give it a try without setting it to false then.
The idea is, when you first enter the rule you set the Boolean to true so that if another event occurs, it will be ignored. After you have completed the role, you set Boolean back to false so that it will honor any new events, and run.
So the logic as we described does exactly what you want.
That's why I asked for an example, it's not making sense to me. I've looked at other rules and tried to duplicate their Boolean usage but it doesn't seem to work for me.