Skip to content
Open
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
6 changes: 4 additions & 2 deletions drivers/SmartThings/matter-lock/src/new-matter-lock/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,6 @@ local function info_changed(driver, device, event, args)
end
end
device:subscribe()
device:emit_event(capabilities.lockAlarm.alarm.clear({state_change = true}))
Copy link
Contributor

@hcarter-775 hcarter-775 Feb 9, 2026

Choose a reason for hiding this comment

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

I think we should leave this here, since the call_with_delay may have some unforeseen race-y conditions.

To avoid double emitting events, we could add an

if device:get_latest_state("main", capabilities.lockAlarm.ID, capabilities.lockAlarm.supportedAlarmValues.NAME) == nil then

check to ensure the same call wasn't done earlier? However, double calling these events in this context doesn't seem like a big issue to me

device:emit_event(capabilities.lockAlarm.supportedAlarmValues({"unableToLockTheDoor"}, {visibility = {displayed = false}})) -- lockJammed is madatory
end

local function profiling_data_still_required(device)
Expand All @@ -339,6 +337,10 @@ end

local function do_configure(driver, device)
match_profile(driver, device)
device.thread:call_with_delay(5, function()
device:emit_event(capabilities.lockAlarm.alarm.clear({state_change = true}))
device:emit_event(capabilities.lockAlarm.supportedAlarmValues({"unableToLockTheDoor"}, {visibility = {displayed = false}})) -- lockJammed is mandatory
end)
Comment on lines +340 to +343
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think the call_with_delay should be required here. We could put an if device:supports_capability(capabilities.lockAlarm) then gate if we are trying to ensure the device has this before emitting an event.

end

local function driver_switched(driver, device)
Expand Down
Loading