Skip to content

Commit 4b4a24c

Browse files
authored
Add lockAlarm configuration to do_configure (#2763)
Signed-off-by: HunsupJung <hunsup.jung@samsung.com>
1 parent 1ad90e9 commit 4b4a24c

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

  • drivers/SmartThings/matter-lock/src/new-matter-lock

drivers/SmartThings/matter-lock/src/new-matter-lock/init.lua

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,10 @@ local function info_changed(driver, device, event, args)
262262
end
263263
end
264264
device:subscribe()
265-
device:emit_event(capabilities.lockAlarm.alarm.clear({state_change = true}))
266-
device:emit_event(capabilities.lockAlarm.supportedAlarmValues({"unableToLockTheDoor"}, {visibility = {displayed = false}})) -- lockJammed is madatory
265+
if device:get_latest_state("main", capabilities.lockAlarm.ID, capabilities.lockAlarm.supportedAlarmValues.NAME) == nil then
266+
device:emit_event(capabilities.lockAlarm.alarm.clear({state_change = true}))
267+
device:emit_event(capabilities.lockAlarm.supportedAlarmValues({"unableToLockTheDoor"}, {visibility = {displayed = false}})) -- lockJammed is mandatory
268+
end
267269
end
268270

269271
local function profiling_data_still_required(device)
@@ -287,6 +289,10 @@ end
287289

288290
local function do_configure(driver, device)
289291
match_profile(driver, device)
292+
device.thread:call_with_delay(5, function()
293+
device:emit_event(capabilities.lockAlarm.alarm.clear({state_change = true}))
294+
device:emit_event(capabilities.lockAlarm.supportedAlarmValues({"unableToLockTheDoor"}, {visibility = {displayed = false}})) -- lockJammed is mandatory
295+
end)
290296
end
291297

292298
local function driver_switched(driver, device)

0 commit comments

Comments
 (0)