I have rules setup to manage by blinds that include variable repeat intervals so I can play with the timing in one place instead of updating all of the rules.
The cursor moves to the repeat n times box and wants me to enter in something, even though the repeat variable n times switch is not on. Nothing I can do will get me a done on this page. Trued entering 0, then a value, then turning the switch on and then off, etc.
However, if I do change the variable and then click back and refresh - it does indeed change the variable. So this is maybe just a UI issue?
This is the normal way the UI works for every page in the hub -- the cursor automatically goes to the first unfilled field of the page. It has no significance, and is only for convenience. You can still select the pulldown for the Variable repeat interval to change the variable.
You have to hit Update or Done before it will show in use for the changed variable. In my test, this works as expected.
@bravenel I probably didn't explain myself properly. If you look at the attached video you will see me changing the variable and then I am stuck. No Done or Update button to click on. Even cancel does nothing. And when I try to click back it yells at me:
I also think this is a pretty rare situation. I am only using variables as I wanted to be able to easily adjust the while times for a whole series of rules.
But when I did it originally it didn't occur to me that some blinds would need more time than others. So I used one variable for all and as a result had some blinds going up in stops and starts.
But it definitely is nice to have variable control here.
You should be able to work around the problems. If you get the screen with Define Expression element (a bug), add any existing Condition from the dropdown, and then immediately Edit While Expression to remove that Condition.
Also I have since learned that hitting the back button a few times to break out of this screen and then clicking done on the first screen does appear to do the job.
@bravenel In follow-up to this I had some further questions about this rule and I wasn't sure they were related to the bug or my logic.
In this block my intention is to have the rule send the open command then while it is showing something other than open - closing, closed, partially open - to repeat the command every 2 minutes. A normal time from rule start to shade open is about 30 seconds. If the shade happened to get stuck, not received the open command, etc. then it would try the open command again.
I noticed that the open command was being sent repeatedly - I can tell as the shade pauses each time it gets it.
So I put a pushover in there and sure enough it sends me repeated pushover messages until the shade reaches the desired open state.
So the variable repeat interval, which is set to 2 minutes on this example, should mean that it doesn't retry the commands for 2 minutes? Is my logic wrong or is this related to the issue above that somehow it is not processing the rule correctly? Thanks.
Hi @bravenel - here is a log of the rule when I send an open command.
As far as I can tell it is dropping into the repeat and then repeating constantly until the shade reaches the open position. My assumption in setting up the rule is that it would repeat the actions every 2 minutes. Incidentally I have tested by using the variable delay and also by just entering the time and get the same response. I don't know if I have set something up incorrectly or whether something is not working the way it should.
Also, one other thing I don't understand. I am triggering this by a virtual device. I click Open on the virtual device and it triggers the rule as expected. Yet the log shows that it passes through the rule with the virtual device testing as Closed, when in fact it is open, and then drops out and triggers immediately again and this time the virtual device tests correctly:
[app:3656](http://192.168.2.108/logs#)2024-01-23 07:21:37.204 AM[info](http://192.168.2.108/logs#)Triggered: Breakfast Room Shade (Virtual) shade *changed*
[app:3656](http://192.168.2.108/logs#)2024-01-23 07:21:37.118 AM[info](http://192.168.2.108/logs#)Event: Breakfast Room Shade (Virtual) windowShade open
[app:3656](http://192.168.2.108/logs#)2024-01-23 07:21:28.614 AM[info](http://192.168.2.108/logs#)Action: END-IF
[app:3656](http://192.168.2.108/logs#)2024-01-23 07:21:28.609 AM[info](http://192.168.2.108/logs#)Action: END-IF
[app:3656](http://192.168.2.108/logs#)2024-01-23 07:21:28.604 AM[info](http://192.168.2.108/logs#)~~Action: END-REP~~ (skipped)
[app:3656](http://192.168.2.108/logs#)2024-01-23 07:21:28.436 AM[info](http://192.168.2.108/logs#)~~Action: Close: Breakfast Room Shade on HubitatC8~~ (skipped)
[app:3656](http://192.168.2.108/logs#)2024-01-23 07:21:28.432 AM[info](http://192.168.2.108/logs#)~~Action: Delay 0:00:45~~ (skipped)
[app:3656](http://192.168.2.108/logs#)2024-01-23 07:21:28.427 AM[info](http://192.168.2.108/logs#)~~Action: While (Breakfast Room Shade on HubitatC8 shade opening(F) OR Breakfast Room Shade on HubitatC8 shade open(F) OR Breakfast Room Shade on HubitatC8 shade partially open(F) [FALSE]) Repeat every BlindRepeatCommandDelaySomfy(0:02:00)~~ (skipped)
[app:3656](http://192.168.2.108/logs#)2024-01-23 07:21:28.393 AM[info](http://192.168.2.108/logs#)~~Action: Close: Breakfast Room Shade on HubitatC8~~ (skipped)
[app:3656](http://192.168.2.108/logs#)2024-01-23 07:21:28.389 AM[info](http://192.168.2.108/logs#)Action: IF (Breakfast Room Shade (Virtual) shade closed(F) [FALSE]) THEN (skipping)
[app:3656](http://192.168.2.108/logs#)2024-01-23 07:21:28.384 AM[info](http://192.168.2.108/logs#)Action: ELSE (do actions)
[app:3656](http://192.168.2.108/logs#)2024-01-23 07:21:28.368 AM[info](http://192.168.2.108/logs#)~~Action: END-REP~~ (skipped)
[app:3656](http://192.168.2.108/logs#)2024-01-23 07:21:28.363 AM[info](http://192.168.2.108/logs#)~~Action: Open: Breakfast Room Shade on HubitatC8~~ (skipped)
[app:3656](http://192.168.2.108/logs#)2024-01-23 07:21:28.354 AM[info](http://192.168.2.108/logs#)~~Action: Log: 'In repeat loop opening breakfast room shade'~~ (skipped)
[app:3656](http://192.168.2.108/logs#)2024-01-23 07:21:28.350 AM[info](http://192.168.2.108/logs#)~~Action: While (Breakfast Room Shade on HubitatC8 shade closing(F) OR Breakfast Room Shade on HubitatC8 shade closed(T) OR Breakfast Room Shade on HubitatC8 shade partially open(F) [TRUE]) Repeat every BlindRepeatCommandDelaySomfy(0:02:00)~~ (skipped)
[app:3656](http://192.168.2.108/logs#)2024-01-23 07:21:28.163 AM[info](http://192.168.2.108/logs#)~~Action: Open: Breakfast Room Shade on HubitatC8~~ (skipped)
[app:3656](http://192.168.2.108/logs#)2024-01-23 07:21:28.151 AM[info](http://192.168.2.108/logs#)Action: IF (Breakfast Room Shade (Virtual) shade open(F) [FALSE]) THEN (skipping)
[app:3656](http://192.168.2.108/logs#)2024-01-23 07:21:27.306 AM[info](http://192.168.2.108/logs#)Event: Actions stopped by Blinds/Shades: Breakfast Room Shades (Virtual) - Perform Actions
[app:3656](http://192.168.2.108/logs#)2024-01-23 07:21:27.107 AM[info](http://192.168.2.108/logs#)Action: Cancel Timed Actions: **This Rule**
[app:3656](http://192.168.2.108/logs#)2024-01-23 07:21:27.041 AM[info](http://192.168.2.108/logs#)Triggered: Breakfast Room Shade (Virtual) shade *changed*
[app:3656](http://192.168.2.108/logs#)2024-01-23 07:21:26.828 AM[info](http://192.168.2.108/logs#)Event: Breakfast Room Shade (Virtual) windowShade opening
@bravenel Just putting this to the top of your list. It definitely is not working as planned. I have played around with this and no matter what I do the while repeats continuously. Bug or is there something I could be doing differently? Thanks.
This leaves me having no idea what is happening with your rule, beyond the obvious issue you show with your logs. My suggestion is to start with something much simpler, like mine, test it, and grow the rule from that starting point.
II think yout have a multiple simultaneous instance problem with this rule -- that it, it's being triggered multiple times before it completes, hence launching multiple copies of the rule. The common form of this is a Delay embedded in IF-THEN-ELSE actions with multiple trigger events. Your case is equivalent, because the repeat is a form of a delay. This is exacerbated by your *changed* trigger.
You must protect this rule against having this problem. Use a Required Expression of Private Boolean true. Make your first action to be set Private Boolean to false, and your last action to set Private Boolean to true.
Try this, and after adding that, hit Update. Then verify on the App Status page that there are no Scheduled Jobs then pending for the rule. If there are, toggle the Private Boolean manually in the rule UI to false and then back to true. Check again for Scheduled Jobs.
I removed the delays - they were only there because the loop wasn't working and I was trying to get it to wait to re-issue the open or close command.
I inserted the Private Boolean and this stopped the rule re-triggering but didn't solve for the while loop not performing correctly.
So I went back to your previous comment and started to rethink the rule. I decided to try a different approach and test for while not open or closed vs. all of the different states.
This appears to work. I put pushover commands in the beginning of the rule, in the loop, and exiting the rule. And all I get is three messages.
I am not home this weekend so doing this all remotely so the final test will be to see what the shade is actually doing - but according to the logs this seems to have solved the problem. Will report back when I am able to test locally.
@bravenel Still having issues here. Instead of testing for all of the blind positions I went with NOT the position I wanted it to be in.
The rules seem to get stuck every time they execute.
When it drops into the rule the blind is not open so I am asking it to repeat while blind 1 is NOT open. But when blind 1 becomes open the while will now be TRUE and shouldn't it drop out? But you can see in the log that it is TRUE and keeps repeating.
@bravenel I gave up. As far as I can tell there are some challenges with the while and shades. It seems that the while loops are getting stuck when they should release control.
I converted all of my rules over to brute force - instead of looping just repeated the commands three times and hope that they get through.
If there is an interest in testing this further just let me know. Thanks.