Hi ā I'm brand new to the platform, and trying to get to grips with how RM works. I feel like I'm nearly there on this, but I'm coming up against either setting restrictions or race conditions.
My goal is to hook up a couple of Hue motion sensors to my sprinkler (I'm fighting a battle with the local cats/foxes, who use my garden as a toilet). I'm mostly there, but I'm struggling to make my rule work reliably.
If I had complete control, I'd simply have the sprinkler run continuously whilst motion is detected. As it stands, the Hue sensors have a minimum retrigger period of 10s which is much longer than I'd like (2s would be perfect).
The best compromise I've reached so far, is to trigger the rule from the motion sensors individually, and run the sprinkler in two short bursts. To try and avoid concurrent execution of the rule (given multiple triggers) I added a private boolean (and subsequently a local variable, to see if this helped), but have found this results in a race condition:
It doesn't take long to get a series of error logs java.util.NoSuchElementException: Cannot pop() an empty List on line 6627 (delayedActs)
and java.util.NoSuchElementException: Cannot pop() an empty List on line 6627 (doRepeatR)
. In fact, if I hit the "Run Actions" button a few times very quickly, the local variable will get stuck on TRUE,
I've also tried using a Zone Motion Controller to debounce the trigger, but this adds a minimum of 5s for the activity timeout, which isn't great for me. Furthermore, the race condition remains:
I'm hoping there a way to achieve all this using out-of-the-box drivers (and apps) ā given they're not open source, I'm not sure how much work it would be to write custom code from scratch!
I did e-mail support and ask about reducing the retrigger internal in the Hue motion sensor driver (I think the current values are quite arbritrary), though I'm not sure that will go anywhere.
I might also be massively overcomplicating this rule!
Can anyone help?