Skip to content

zwave-lock: Add missing DATE_GET handler to Time CC - #3102

Merged
hcarter-775 merged 1 commit into
SmartThingsCommunity:mainfrom
pachuho:fix/zwave-lock-date-get
Jul 10, 2026
Merged

zwave-lock: Add missing DATE_GET handler to Time CC#3102
hcarter-775 merged 1 commit into
SmartThingsCommunity:mainfrom
pachuho:fix/zwave-lock-date-get

Conversation

@pachuho

@pachuho pachuho commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Hi! I came across #3076 while digging around the Z-Wave lock driver and noticed nobody had picked it up yet, so here's a fix.

The driver registers a handler for TIME_GET but not DATE_GET, so a lock doing a full Time CC sync gets its date request silently dropped — the hub ACKs at the MAC layer but never answers. This PR adds a DATE_GET handler that responds with the current date, mirroring the existing TIME_GET handler.

Credit to @maksymzdzitowiecki for the root cause analysis in the issue. One small correction from the proposed snippet there: os.date("*t").year already returns the full year (e.g. 2026), and DateReport serializes it as a 16-bit value (write_be_u16), so the year should be passed through as-is — adding 1900 would put us in the year 3926 :)

Added a test next to the existing TIME_GET one in test_lock_battery.lua. All zwave-lock tests pass locally against lua_libs-api_v20 (51/51).

Fixes #3076

@CLAassistant

CLAassistant commented Jul 8, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@maksymzdzitowiecki

Copy link
Copy Markdown

@pachuho Thanks for picking this up and for the fix! You're absolutely right about the year - os.date("*t").year returns the full year. Your version is correct.

@mtilchen mtilchen left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks for contributing the fix @pachuho 👍

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown

Channel deleted.

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown

Test Results

   73 files  ±0    537 suites  ±0   0s ⏱️ ±0s
3 168 tests +1  3 168 ✅ +4  0 💤 ±0  0 ❌  - 3 
5 169 runs  +1  5 169 ✅ +4  0 💤 ±0  0 ❌  - 3 

Results for commit 8ca1717. ± Comparison against base commit 4dcfe01.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown

File Coverage
All files 88%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zwave-lock/src/samsung-lock/init.lua 87%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zwave-lock/src/lazy_load_subdriver.lua 57%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zwave-lock/src/init.lua 97%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zwave-lock/src/legacy-handlers/keywe-lock/init.lua 77%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zwave-lock/src/legacy-handlers/schlage-lock/init.lua 95%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zwave-lock/src/lock_utils/tables.lua 98%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zwave-lock/src/lock_utils/utils.lua 88%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zwave-lock/src/zwave-alarm-v1-lock/init.lua 24%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zwave-lock/src/legacy-handlers/zwave-alarm-v1-lock/init.lua 89%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zwave-lock/src/lock_handlers/zwave_responses.lua 83%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zwave-lock/src/lock_handlers/capabilities.lua 94%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zwave-lock/src/schlage-lock/init.lua 98%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zwave-lock/src/legacy-handlers/samsung-lock/init.lua 94%

Minimum allowed coverage is 90%

Generated by 🐒 cobertura-action against 8ca1717

@hcarter-775

Copy link
Copy Markdown
Contributor

Hi @pachuho, thanks for the fix! Your timing is great... I have just merged a PR that re-works this entire driver. If you wouldn't mind moving your handler to under here in order to follow the new format, we can get this merged soon. Thanks!

The driver only handled TIME_GET, so a lock requesting the date during
a Time CC sync never got an answer (the hub ACKs at the MAC layer but
no DATE_REPORT is sent). Add a DATE_GET handler that reports the
current date, following the reworked lock_handlers structure.

Fixes SmartThingsCommunity#3076
@pachuho
pachuho force-pushed the fix/zwave-lock-date-get branch from c4a2bb4 to 8ca1717 Compare July 10, 2026 02:03
@pachuho

pachuho commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

Hi @hcarter-775, Done — moved the handler to lock_handlers/zwave_responses.lua under the Time CC section and registered it in init.lua, following the reworked structure. The test stayed next to the existing time get test in test_lock_battery.lua. All zwave-lock tests pass locally against lua_libs-api_v20. Thanks for the pointer!

@hcarter-775
hcarter-775 merged commit 15035a7 into SmartThingsCommunity:main Jul 10, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Z-Wave: Missing DATE_GET handler in Time CC, DATE_REPORT never sent

7 participants