Skip to content
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 DateTime handling to ItemStateConditionHandler #3138

Merged
merged 1 commit into from
Oct 31, 2022

Conversation

J-N-K
Copy link
Member

@J-N-K J-N-K commented Oct 30, 2022

This adds the capability to handle DateTime items to the ItemStateConditionHandler. The given state can be

  • the string representation of a ZonedDateTime (e.g. 2022-01-15T17:23:15+02:00)
  • the string representation of a LocalDateTime (e.g. 2022-11-06T16:05:10), the configured time zone from the TimeZoneProvider is used
  • a period that is applied to the current time (ZonedDateTime.now()). The period can contain days (D), hours (H), minutes (M) or seconds (S) or an ordered combination of these, including a sign (e.g. 1D-2H would be the same as ZonedDateTime.now().plusDays(1).minusHours(2)).

I didn't find the documentation for the conditions in general, can someone point me to the correct place so that documentation for this can be added?

Signed-off-by: Jan N. Klug github@klug.nrw

Signed-off-by: Jan N. Klug <github@klug.nrw>
@J-N-K J-N-K requested a review from a team as a code owner October 30, 2022 13:57
Copy link
Member

@kaikreuzer kaikreuzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thank you.

I didn't find the documentation for the conditions in general, can someone point me to the correct place so that documentation for this can be added?

Since you didn't find it, I am afraid the most logical answer is that such a place does not yet exist.
Afaik, all we have right now is the description field of the modules, which at least provide some short documentation at runtime.
But the more modules we have, I agree that we should have a place for them in the docs as well. Maybe @Confectrician already has an idea about a good structure?

@kaikreuzer kaikreuzer merged commit d871066 into openhab:main Oct 31, 2022
@kaikreuzer kaikreuzer added this to the 3.4 milestone Oct 31, 2022
@rkoshak
Copy link

rkoshak commented Nov 1, 2022

Maybe @Confectrician already has an idea about a good structure?

I don't want to speak for @Confectrician but if I understand correctly what this is, I think the best place may be in the new sections for rules docs that I and @florian-h05 are working on at openhab/openhab-docs#1855.

Unfortunately we haven't got very far yet and it's slow going but I would expect this to be documented either under section 1c or under section 3 (depending on whether this is a UI rule only concept of something universal to all rules. I think it's the former so I'd put it under section 3 where we plan on putting all the reference information for creating UI rules.

In the mean time I'm not sure there is a good place yet and it'll need a new home.

Our intent is to submit each major section (1, 2, 3, etc.) as separate PRs to break it up and so we don't have to wait forever to start getting the benefit. So section 3 could be started and worked on independently if that makes sense.

@florian-h05
Copy link
Contributor

@rkoshak
Could you add a reference to this PR in the tracking issue openhab/openhab-docs#1855?

@J-N-K J-N-K added the enhancement An enhancement or new feature of the Core label Nov 6, 2022
@J-N-K J-N-K deleted the feature-itemstatedatetime branch November 7, 2022 17:13
splatch pushed a commit to ConnectorIO/copybara-hab-core that referenced this pull request Jul 12, 2023
Signed-off-by: Jan N. Klug <github@klug.nrw>
GitOrigin-RevId: d871066
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automation enhancement An enhancement or new feature of the Core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants