-
Notifications
You must be signed in to change notification settings - Fork 780
[Feature Request - Rules Engine] Add time condition module #6465
Comments
@adimova WDYT? |
So the feature seems to work already, but when thinking a bit more about it, maybe it would be better if you could just set two time values without any comparator. So if the first time value is before the second value, it checks if the time is between those two values and if the first time is set after the second value it will check if the time is between 00:00 and the first time value, or the second value and 00:00. I think i will try that and then I'll figure out how to put this in a pull request, if you think that would be a nice feature :) |
This condition checks if the current time is before, after, or equals to a time, which may be entered by the user. This is part of eclipse-archived#6465. Signed-off-by: Dominik Schlierf <dominik.schlierf.esh@web.de>
The time of day condition now compares if the current time is between a start and end time. Also supports wrapping around midnight, if the end time is before the start time. This is part of the issue eclipse-archived#6465. Signed-off-by: Dominik Schlierf <dominik.schlierf.esh@web.de>
If you want to have a look, the feature is implemented on this branch. |
I have a few thoughts...
|
Since I don't have any information about the time zone of start and end time, they always stay the same as the current times time zone. Therefore even with these changes (if I am correct), it would happen twice again, but once it would be 1:15AM-1:45AM in the BST Time Zone and once in the GMT Time Zone. Or am I missing something obvious? An option might be to check the rules of the time transition using the ZoneRules and ZoneOffsetTransition classes to detect if the condition is affected by daylight savings. So if the check says the time exists twice on this day, the condition will return false the second time it occurs. Or if the check says the condition will not be true at all, since the hour between 1 and 2 AM is missing, the condition will return true from 2 AM to 3 AM instead.
I could easily create a separate condition, that compares a time item with another time item, or a time item to a time in hh:mm format. But I don't want to clutter the available options with too many time conditions. |
In order to avoid overlapping of time conditions intervals the condition will no longer return true, if the current time is equals to the end of the time interval. This references eclipse-archived#6465 and was implemented due to a suggestion of @openhab-5iver. Signed-off-by: Dominik Schlierf <dominik.schlierf.esh@web.de>
The DayOfWeekConditionHandlerTest provides a lot of functionality that may be used in the TimeOfDayConditionHandlerTest to test feature eclipse-archived#6465. In order to avoid duplicate code, a base class has been extracted. Also-by: Kai Kreuzer <kai@openhab.org> Signed-off-by: Dominik Schlierf <dominik.schlierf.esh@web.de>
This is a test that is based on the previously created BaseConditionHandlerTest. It is used to test the TimeOfDayConditionHandler which is part of feature eclipse-archived#6465. Signed-off-by: Dominik Schlierf <dominik.schlierf.esh@web.de>
Improves eclipse-archived#6465. Signed-off-by: Dominik Schlierf <dominik.schlierf.esh@web.de>
When generating rules with Paper UI, I was unable to check if the time was later or earlier than a specific value through the UI. I want to add a module, which makes that possible.
I am guessing that this module would go in the org.eclipse.smarthome.automation.module.timer package?
The text was updated successfully, but these errors were encountered: