Hi, everyone.
I have been looking for a long time for an efficient way to trigger actions at a time defined by the user in the UI using the rules DSL engine. A use case, but not the only one, is the alarm clock (Individual Alarm clock for each Day of week, with adjustable duration). Another use case would be allowing users to define a time to turn things on or off, e.g., smart plugs.
I know that, unfortunately, we cannot dynamically edit the cron time in a rule, so the only option I know so far is creating rules that get triggered periodically (e.g., every 5 minutes).
when
Time cron "0 0/5 * ? * *"
then
I’m not sure about the performance and resource impact of that option.
However, I have noticed that such a rule runs exactly at 07:05:00, 07:10:00, etc., not exactly every 5 minutes since the service started (e.g., 07:02:48, 07:07:48), so I’m wondering whether OpenHAB has already something implemented to avoid performance degradation by cron-based rules.
If that is the case, I also wonder if creating X (e.g., 30) number of similar rules running every 5 minutes wouldn’t have a big performance impact just because they are triggered so frequently. Of course, it’s understandable that there will be a performance overhead caused by the logic inside the rule, so the simpler the better.
If there isn’t a better alternative and creating many rules drastically decreases the performance and resources, I believe implementing an efficient solution to handle this case would be an extremely useful and long overdue feature.
I found the same topic from 2018: Can I create a time based triggered rule that is based on items value?