Days of Week Schedule with Time Variable

I'm trying to update an alarm clock-type rule to leverage a time variable connector on a dashboard. I'd like to be able to set the alarm time from the dashboard, rather than edit the rule directly. I'm seeing unexpected behavior when using the time variable with the Days of Week Schedule.

I initially set up the rule to trigger M-F at a certain time. This works as expected. Editing the trigger event to use the time variable shows the current variable time.

I've also added a Certain Time trigger tied to the same variable as a "control" scenario (my actual rule doesn't need this trigger, just adding to contrast the behavior).

Changing the time variable via a dashboard connector:
Screenshot_2020-11-16c Dashboards

Refreshing the rule page yields this:

As the screenshot shows, the certain time trigger updates with the new variable value, but the Days of Week trigger does not. Editing the days of week trigger will refresh the time to the current value of the variable.

Possible bug or am I doing something wrong?

Thanks!

I suspect it was never implemented to update once set. I'll look into it.

Thanks! Based on a bit of research, I can likely add a day of week check in the rule body if it's not reasonable to expect the DoW trigger to handle the time variable.

For me, the Days of the Week are not triggered.


I have an error while setting this trigger in RM

I will look into this....

I'm having the same problem with the days of week schedule. They never kick off the action, and nothing shows up on the rule's scheduled actions.

I've found the bug responsible for this problem, and a fix will be in the next release.

1 Like

Thank you. I appreciate the quick response and help.

Updated to 147, I'm still having this problem in Rule Machine. Tried one in simple automation and it worked, but not in Rule Machine even with a new rule.

app:1603. 2020-11-25 10:27:50.366 pm errorjava.lang.NumberFormatException: For input string: ":1.1" on line 4929 (appButtonHandler)

Please show the rule that throws this error.

I'm the OP. Rather than creating a new thread, I'm exhuming this one as the problem definition seems to remain valid. The original issue is persisting for me in version 2.2.7.124.

Specifically: Days of the Week triggers don't acknowledge time variable changes.

I created a new rule from scratch today to test. Changing the time variable is not reflected in the trigger value. I tested changing both via a dashboard connector and the "set" link in the rule's variable section.

The below rule screenshot shows the incorrect Days of the Week time (6:55am 6:51am) after the time variable was updated to 6:51am 6:55am. The second trigger is only included to show the functionality variance.

image
Thanks!

edits: I completely messed up the problem description swapping the times and also got the screenshot wrong. :pensive: My apologies. Regardless, I think the above description is now correct!

Looks like 6:51 to me. OK, I will investigate.

Sorry, pasted in the wrong screenshot. Full view...

Which one is not updating? The Days of Week?

Correct. The first trigger event "On Mon, Tue, Wed, Thu, Fri at Variable: [Local Time Variable]".

I think this is only a UI issue (I can replicate). But when I change the time, the actual trigger event is updated. Look at Application State (gear icon) Scheduled Jobs, at the bottom of the page.

Yep, seems to be true for my rule too. I'd never actually let the rule execute! Thanks!

I think there is a difference between a local variable and a global variable. There was not an expectation of a rule being triggered by a local variable, and I suspect that changing a local variable will not update the time (unless the rule is updated). Most likely the fix for this is to not allow selection of a local variable in that context. With a global variable, the rule has a 'subscription' to the global variable, precisely so that it will update its scheduled jobs when the global variable changes.

1 Like

Fair enough. Thanks for the explanation.

As a relative novice, I use local variables when utilized in only a single rule and global variables for usage across multiple rules. I guess using a connector on a dashboard does overflow my single rule paradigm. The "subscription" concept is also helpful info, so I'll work to keep local variables out of my triggers.

Thinking through it, I'll rewrite this rule to use a global variable and a virtual switch in lieu of local variables. :sunglasses: :fist_right:

1 Like