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

fix: add day of week to BACnet protocol binding's Date and DateTime types #381

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

fennibay
Copy link
Contributor

Without wildcards, day of week would not be necessary, that's why ISO8601 doesn't support day of week in calendar dates.

Because BACnet supports wildcards for the dates, we need to represent day of week. This change takes the day of week representation of ISO8601's week dates and extends the ISO8601's calendar date format with it.

…ypes

Without wildcards, day of week would not be necessary, that's why ISO8601 doesn't support day of week in calendar dates. Because BACnet supports wildcards for the dates, we need to represent day of week. This change takes the day of week representation of ISO8601's week dates and extends the calendar date format with it.
Copy link

netlify bot commented Oct 29, 2024

Deploy Preview for wot-binding-templates ready!

Name Link
🔨 Latest commit 9b8ea7d
🔍 Latest deploy log https://app.netlify.com/sites/wot-binding-templates/deploys/6734c4d0d9905a0008ce14d0
😎 Deploy Preview https://deploy-preview-381--wot-binding-templates.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@fennibay
Copy link
Contributor Author

@egekorkan @ektrah @mjkoster here a small change, please review.

Copy link
Member

@ektrah ektrah left a comment

Choose a reason for hiding this comment

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

I've tried to come up with a few examples and how I'd interpret them:

  • "*-*-01" -- the set of dates containing the first day of every month
  • "2024-*-01" -- the set of dates containing the first day of every month in 2024
  • "*-*-*(4)" -- the set of dates containing every Thursday of every month
  • "*-10-*(4)" -- the set of dates containing every Thursday in October every year
  • "*-10-29(4)" -- the set of dates containing the 29th day of October every year, if it is a Thursday
  • "2024-10-29(4)" -- the single-element set consisting of the 29th day of October in the year 2024
  • "2024-10-29(7)" -- the empty set

Is that the correct interpretation?

Since the wildcards are not part of ISO8601, should they maybe be explained in a bit more detail? (perhaps in a separate pull request)

Generally speaking, would it make sense to re-use something like iCalendar recurrence rules or crontab syntax to express recurrence like these, instead of inventing a new syntax?

Otherwise this looks good to me.

@fennibay
Copy link
Contributor Author

fennibay commented Nov 5, 2024

Thanks for the comments @ektrah

Your examples are correct. I can explain the wildcards a bit more, ultimately BACnet standard is the main source here, the mappings only reflect what BACnet can represent in date/time formats. Basically an asterisk means it can be any year/month/day/day-of-week, and that's it. Does that need further explanation?

I checked crontab and iCalendar in detail:

  • crontab doesn't support specific year, so that would be an extension, as we are now doing for ISO-8601 with asterisks
  • iCalendar, RFC2445: Here I was a bit lost in the spec. This is much more capable than BACnet Date/Time representations, so it is much more complicated. It is also using some English keywords like WEEKLY, which would be a language-specific representation. And most critically we would have to define complex mappings going from 2024-- to something like all days in 2024, so DAILY with start and end dates, with the start and stop dates of 2024-01-01 and 2024-12-31. Or do you see a simpler way to map?

@egekorkan egekorkan added Editorial bacnet related to bacnet protocol binding and removed Editorial labels Nov 6, 2024
@egekorkan
Copy link
Contributor

If the discussion above is finalized and the changes are ok with @mjkoster , it can be merged but we will check in today's call as all the approvals are from the same organization

@ektrah
Copy link
Member

ektrah commented Nov 6, 2024

I think the important insight here is that we are not describing a date (or date and time), but a recurrence rule. That is, the string compactly describes a set of dates (or dates and times); and this is the case even if no wildcards are present. Counterintuitively, strings with an invalid date (or date and time) are not actually invalid, since they simply describe the empty set. I think this would be very helpful to point out in the document.

Too bad the crontab syntax does not support years, otherwise it would have been nice to reuse parts of the syntax instead of defining a new one. I agree with you that iCalendar is too complex for our purposes.

@fennibay
Copy link
Contributor Author

fennibay commented Nov 6, 2024

@ektrah ok your point makes sense. I will explain this generally for the date / time types and add some examples. Then I hope we can merge.

@egekorkan
Copy link
Contributor

Reviewed in the call: We are fine with the changes. We can merge it once the textual improvements are done.

@fennibay
Copy link
Contributor Author

fennibay commented Nov 7, 2024

@egekorkan @ektrah I did the textual changes now. I realized I hadn't added the odd and even wildcards for month and day of month, so now they are also in. Please have a last look before merging.

Copy link
Member

@ektrah ektrah left a comment

Choose a reason for hiding this comment

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

  • |-separators are missing in the regular expressions.
  • Some of the examples do not match the regular expression.
  • A few suggestions for the text.

bindings/protocols/bacnet/index.html Outdated Show resolved Hide resolved
bindings/protocols/bacnet/index.html Outdated Show resolved Hide resolved
bindings/protocols/bacnet/index.html Outdated Show resolved Hide resolved
bindings/protocols/bacnet/index.html Outdated Show resolved Hide resolved
bindings/protocols/bacnet/index.html Outdated Show resolved Hide resolved
bindings/protocols/bacnet/index.html Outdated Show resolved Hide resolved
@fennibay
Copy link
Contributor Author

@egekorkan I think I was able to incorporate all findings. Please merge when you get a chance.

@ektrah @TallTed many thanks for the feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bacnet related to bacnet protocol binding
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants