Skip to content

Commit

Permalink
add: info_changed event
Browse files Browse the repository at this point in the history
  • Loading branch information
hcarter-775 committed Oct 3, 2024
1 parent 25f6a53 commit ae37c50
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion drivers/SmartThings/matter-lock/src/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,12 @@ local function component_to_endpoint(device, component_name)
return find_default_endpoint(device, clusters.DoorLock.ID)
end

local function info_changed(driver, device, event, args)
if device.profile.id ~= args.old_st_store.profile.id then
device:subscribe()
end
end

local function do_configure(driver, device)
-- check if the device is NOT currently profiled as base-lock
-- by ANDing a query for every capability in the base-lock profiles.
Expand Down Expand Up @@ -678,7 +684,12 @@ local matter_lock_driver = {
sub_drivers = {
require("aqara-lock"),
},
lifecycle_handlers = {init = device_init, added = device_added, doConfigure = do_configure },
lifecycle_handlers = {
init = device_init,
added = device_added,
doConfigure = do_configure,
infoChanged = info_changed,
},
}

-----------------------------------------------------------------------------------------------------------------------------
Expand Down

0 comments on commit ae37c50

Please sign in to comment.