Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion drivers/SmartThings/zwave-lock/src/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ local driver_template = {
},
zwave_handlers = {
[cc.TIME] = {
[0x01] = zwave_handlers.time_get_handler -- used by DanaLock
[0x01] = zwave_handlers.time_get_handler, -- used by DanaLock
[0x03] = zwave_handlers.date_get_handler
},
[cc.NOTIFICATION] = {
[Notification.REPORT] = zwave_handlers.notification_report
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,4 +240,17 @@ function ZwaveHandlers.time_get_handler(driver, device, cmd)
)
end

function ZwaveHandlers.date_get_handler(driver, device, cmd)
local Time = (require "st.zwave.CommandClass.Time")({ version = 1 })
local time = os.date("*t")
device:send_to_component(
Time:DateReport({
year = time.year,
month = time.month,
day = time.day
}),
device:endpoint_to_component(cmd.src_channel)
)
end

return ZwaveHandlers
21 changes: 21 additions & 0 deletions drivers/SmartThings/zwave-lock/src/test/test_lock_battery.lua
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,25 @@ test.register_coroutine_test(
}
)

test.register_coroutine_test(
"The driver should respond correctly to a date get",
function ()
test.socket.zwave:__queue_receive({ mock_device.id, Time:DateGet({},{
encap = zw.ENCAP.AUTO,
src_channel = 0,
dst_channels = {}
})
})
local time = os.date("*t")
test.socket.zwave:__expect_send(Time:DateReport({
year = time.year,
month = time.month,
day = time.day
}):build_test_tx(mock_device.id))
end,
{
min_api_version = 17
}
)

test.run_registered_tests()
Loading