Conversation
Pull Request Test Coverage Report for Build 21911669099Details
💛 - Coveralls |
There was a problem hiding this comment.
Pull request overview
This PR adds BACnet Schedule/Calendar write compatibility to @bacnet-js/client by introducing dedicated WriteProperty.encode paths for schedule/calendar properties, along with new write examples and unit tests to validate encoding and fast-fail validation.
Changes:
- Added specialized encoding + validation for
WEEKLY_SCHEDULE,EXCEPTION_SCHEDULE,EFFECTIVE_PERIOD, andDATE_LISTinWriteProperty.encode. - Added/extended unit tests covering schedule/calendar write encoding and rejection cases.
- Added new example scripts to manually write schedule/calendar payloads to devices.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
src/lib/services/WriteProperty.ts |
Adds custom encoders/validators for schedule/calendar write payloads and routes encoding based on object/property ids. |
test/unit/service-write-property.spec.ts |
Adds unit tests for the new schedule/calendar write encode paths and validation failures. |
examples/write-schedule-weekly.ts |
Adds a manual weekly schedule write example. |
examples/write-schedule-exception.ts |
Adds a manual exception schedule write example. |
examples/write-schedule-period.ts |
Adds a manual effective period write example. |
examples/write-calendar-datelist.ts |
Adds a manual calendar date list write example. |
|
Will look into Copilot responses. |
…stead of hex substring
…tructure assertions
|
Hi @EveGun Why did you closed the PR? |
I might found a minor issue in the encoding of exception dates with wildcards. When porting my old code, i changed some variable datatypes from epoch timestamps to date objects and think this might introduced a small bug. Im investigating this now and will reopen when solved. Im new to contributing to open source projects. Sorry if this is a bad approach. 😬 |
|
@EveGun no worries was just to know, will wait for the new PR then :) |
Summary
This PR ports schedule/calendar write compatibility from the legacy
node-bacstackimplementation into@bacnet-js/client, and adds write examples for manual validation.Source reference:
What changed
WriteProperty.encodefor:WEEKLY_SCHEDULEEXCEPTION_SCHEDULEEFFECTIVE_PERIODDATE_LISTsrc/lib/services/WriteProperty.tsfor weekly schedule, exception schedule, effective period, and calendar date list.1..16DATERANGEentries must contain exactly 2 datesWEEKNDAYvalues are validated (including wildcard0xff)year/month/day/wday) is validatedexamples/write-schedule-weekly.tsexamples/write-schedule-exception.tsexamples/write-schedule-period.tsexamples/write-calendar-datelist.tshost[:port], with optional local bind port as separate argument.test/unit/service-write-property.spec.tsfor schedule/calendar write compatibility and failure cases.Type consistency
writePropertycontract unchanged.Validation
Notes