-
-
Notifications
You must be signed in to change notification settings - Fork 514
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] randomInt() is not re-evaluated in Trigger conditions #3297
Comments
The basic problem here is that we cache the output of expressions, and don't consider that certain functions (eg randomInt) can introduce entropy into the result. So a couple of ideas:
|
@Julusian, I am wondering if the only place this matters is in Trigger conditions?
Are there other places using randomInt() would make sense? or maybe there's concern about using |
I just realized that my comment about feedback isn't entirely correct: |
Is this a bug in companion itself or a module?
Is there an existing issue for this?
Describe the bug
If a Trigger is set to an time interval, with condition set as internal: Variable: Check boolean expression with the expression randomInt(0, 5)==1 (see screenshot). This either never triggers the action (to trigger a toggle button) or always evaluates true. After several tests it appears that the expression is only evaluated when the condition is defined or enabled (disabling the entire Trigger does not appear to cause re-evaluation).
Steps To Reproduce
See screenshot in the description:
Time Interval 1 s
Condition randomInt(0, 5) == 1
Add any actions.
Expected Behavior
It should trigger, on average once every 5 seconds. Instead it either never triggers, or triggers every second
Environment (please complete the following information)
Additional context
This was an attempt to provide random intervals. A work-around was to add an internal variable that updates every second, such as $(internal:time_s)
Perhaps a better solution to my specific issue would be to allow random time intervals in the Events section. I will as that as a separate issue shortly.
The text was updated successfully, but these errors were encountered: