-
-
Notifications
You must be signed in to change notification settings - Fork 415
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
Add new module DateTimeTrigger for triggering on a DateTime state #2923
Conversation
This adds a new module that triggers at the time given by the state of an item. Signed-off-by: Jan N. Klug <github@klug.nrw>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, lgtm. Just one very small comment below.
|
||
private final CronScheduler scheduler; | ||
private final String itemName; | ||
private String cronExpression = "@reboot"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This magic string @reboot
looks a bit weird to me. How about simply setting it to null
, if no cron expression is set yet? Or if you really prefer to set a magic string in order to avoid null values, please at least make it a constant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can make it a constant. I used this string because it is properly handled in the CronAdjuster, so probably we should make it a constant there. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I didn't even know that this value was defined in the CronAdjuster. So yeah, it makes a lot of sense to declare it as a constant in there and just use it.
Signed-off-by: Jan N. Klug <github@klug.nrw>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
I am thinking about extending this so it can handle a "time only match", something like Also the documentation/helptext for this feature can be misunderstood easily: It mentions that this triggers at a time specified in an item. More accurately it should say something like "at a time and date..." and when my idea is added "at a time and optionally a date...". |
This pull request has been mentioned on openHAB Community. There might be relevant details there: https://community.openhab.org/t/timers-and-datetime/141590/15 |
…enhab#2923) * Add DateTimeTrigger This adds a new module that triggers at the time given by the state of an item. Signed-off-by: Jan N. Klug <github@klug.nrw> GitOrigin-RevId: ca94fd5
Closes #2726
Signed-off-by: Jan N. Klug github@klug.nrw