Skip to content

Commit 1530a44

Browse files
authored
Merge pull request #2863 from SmartThingsCommunity/cherry-pick/beta-2026-03-31
Revert "Support DPS feature (#2750)"
2 parents 99721f2 + 851da69 commit 1530a44

5 files changed

Lines changed: 2 additions & 348 deletions

File tree

drivers/SmartThings/matter-lock/profiles/lock-modular-embedded-unlatch.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ components:
66
version: 1
77
- id: lockAlarm
88
version: 1
9-
- id: doorState
10-
version: 1
11-
optional: true
129
- id: remoteControlStatus
1310
version: 1
1411
- id: lockUsers

drivers/SmartThings/matter-lock/profiles/lock-modular.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ components:
44
capabilities:
55
- id: lock
66
version: 1
7-
- id: doorState
8-
version: 1
9-
optional: true
107
- id: lockAlarm
118
version: 1
129
- id: remoteControlStatus

drivers/SmartThings/matter-lock/src/lock_utils.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ local lock_utils = {
4545
COMMAND_REQUEST_ID = "commandRequestId",
4646
MODULAR_PROFILE_UPDATED = "__MODULAR_PROFILE_UPDATED",
4747
ALIRO_READER_CONFIG_UPDATED = "aliroReaderConfigUpdated",
48-
LATEST_DOOR_LOCK_FEATURE_MAP = "latestDoorLockFeatureMap"
48+
LATEST_DOOR_LOCK_FEATURE_MAP = "latestDoorLockFeatureMap",
4949
}
5050
local capabilities = require "st.capabilities"
5151
local json = require "st.json"

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

Lines changed: 1 addition & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,13 @@ local battery_support = {
5656

5757
local profiling_data = {
5858
BATTERY_SUPPORT = "__BATTERY_SUPPORT",
59-
ENABLE_DOOR_STATE = "__ENABLE_DOOR_STATE"
6059
}
6160

6261
local DoorLockFeatureMapAttr = {ID = 0xFFFC, cluster = DoorLock.ID}
6362
local subscribed_attributes = {
6463
[capabilities.lock.ID] = {
6564
DoorLock.attributes.LockState
6665
},
67-
[capabilities.doorState.ID] = {
68-
DoorLock.attributes.DoorState
69-
},
7066
[capabilities.remoteControlStatus.ID] = {
7167
DoorLock.attributes.OperatingMode
7268
},
@@ -133,11 +129,6 @@ end
133129

134130
local function device_init(driver, device)
135131
device:set_component_to_endpoint_fn(component_to_endpoint)
136-
if #device:get_endpoints(clusters.DoorLock.ID, {feature_bitmap = clusters.DoorLock.types.Feature.DOOR_POSITION_SENSOR}) == 0 then
137-
device:set_field(profiling_data.ENABLE_DOOR_STATE, false, {persist = true})
138-
else
139-
device:add_subscribed_attribute(clusters.DoorLock.attributes.DoorState)
140-
end
141132
if #device:get_endpoints(clusters.PowerSource.ID, {feature_bitmap = clusters.PowerSource.types.PowerSourceFeature.BATTERY}) == 0 then
142133
device:set_field(profiling_data.BATTERY_SUPPORT, battery_support.NO_BATTERY, {persist = true})
143134
elseif device:get_field(profiling_data.BATTERY_SUPPORT) == nil then
@@ -267,10 +258,6 @@ local function match_profile_modular(driver, device)
267258
table.insert(main_component_capabilities, capabilities.battery.ID)
268259
end
269260

270-
if device:get_field(profiling_data.ENABLE_DOOR_STATE) then
271-
table.insert(main_component_capabilities, capabilities.doorState.ID)
272-
end
273-
274261
table.insert(enabled_optional_component_capability_pairs, {"main", main_component_capabilities})
275262
if lock_utils.optional_capabilities_list_changed(enabled_optional_component_capability_pairs, device.profile.components) then
276263
device:try_update_metadata({profile = modular_profile_name, optional_component_capabilities = enabled_optional_component_capability_pairs})
@@ -378,10 +365,7 @@ local function info_changed(driver, device, event, args)
378365
if device:supports_capability_by_id(capabilities.lockAliro.ID) then
379366
set_reader_config(device)
380367
end
381-
if device:supports_capability(capabilities.doorState) and device:get_latest_state("main", capabilities.doorState.ID, capabilities.doorState.supportedDoorStates.NAME) == nil then
382-
device:emit_event(capabilities.doorState.supportedDoorStates({"open", "closed"}, {visibility = {displayed = false}})) -- open and closed are mandatory
383-
end
384-
if device:supports_capability(capabilities.lockAlarm) and device:get_latest_state("main", capabilities.lockAlarm.ID, capabilities.lockAlarm.supportedAlarmValues.NAME) == nil then
368+
if device:get_latest_state("main", capabilities.lockAlarm.ID, capabilities.lockAlarm.supportedAlarmValues.NAME) == nil then
385369
device:emit_event(capabilities.lockAlarm.alarm.clear({state_change = true}))
386370
device:emit_event(capabilities.lockAlarm.supportedAlarmValues({"unableToLockTheDoor"}, {visibility = {displayed = false}})) -- lockJammed is mandatory
387371
end
@@ -443,45 +427,6 @@ local function lock_state_handler(driver, device, ib, response)
443427
end)
444428
end
445429

446-
local function door_state_handler(driver, device, ib, response)
447-
if ib.data.value == nil then
448-
-- early return on nil data. Also, if ENABLE_DOOR_STATE is unset, set it to false and attempt profile matching.
449-
if device:get_field(profiling_data.ENABLE_DOOR_STATE) == nil then
450-
device:set_field(profiling_data.ENABLE_DOOR_STATE, false, {persist = true})
451-
match_profile(driver, device)
452-
end
453-
return
454-
elseif device:supports_capability(capabilities.doorState) == false then
455-
-- if a non-nil report comes in and the doorState capability is unsupported, set ENABLE_DOOR_STATE to true and attempt profile matching.
456-
device:set_field(profiling_data.ENABLE_DOOR_STATE, true, {persist = true})
457-
match_profile(driver, device)
458-
return
459-
end
460-
461-
local DoorStateEnum = DoorLock.types.DoorStateEnum
462-
local doorState = capabilities.doorState.doorState
463-
local DOOR_STATE_MAP = {
464-
[DoorStateEnum.DOOR_OPEN] = doorState.open,
465-
[DoorStateEnum.DOOR_CLOSED] = doorState.closed,
466-
[DoorStateEnum.DOOR_JAMMED] = doorState.jammed,
467-
[DoorStateEnum.DOOR_FORCED_OPEN] = doorState.forcedOpen,
468-
[DoorStateEnum.DOOR_UNSPECIFIED_ERROR] = doorState.unspecifiedError,
469-
[DoorStateEnum.DOOR_AJAR] = doorState.ajar
470-
}
471-
local door_state = DOOR_STATE_MAP[ib.data.value] or doorState.unspecifiedError -- fallback to unspecifiedError if we receive a value we don't recognize
472-
device:emit_event(door_state())
473-
474-
-- add new door states to supportedDoorStates list if not already present.
475-
local supported_door_states = utils.deep_copy(device:get_latest_state("main", capabilities.doorState.ID, capabilities.doorState.supportedDoorStates.NAME) or {})
476-
for _, state in pairs(supported_door_states) do
477-
if state == door_state.NAME then
478-
return
479-
end
480-
end
481-
table.insert(supported_door_states, door_state.NAME)
482-
device:emit_event(capabilities.doorState.supportedDoorStates(supported_door_states, {visibility = {displayed = false}}))
483-
end
484-
485430
---------------------
486431
-- Operating Modes --
487432
---------------------
@@ -730,12 +675,6 @@ local function door_lock_feature_map_handler(driver, device, ib, response)
730675
local feature_map = lock_utils.get_field_for_endpoint(device, lock_utils.LATEST_DOOR_LOCK_FEATURE_MAP, ib.endpoint_id) or nil
731676
if feature_map ~= ib.data.value then
732677
lock_utils.set_field_for_endpoint(device, lock_utils.LATEST_DOOR_LOCK_FEATURE_MAP, ib.endpoint_id, ib.data.value, { persist = true })
733-
-- If the DPS feature is changed, check the DoorState value and call the match_profile.
734-
if ib.data.value & clusters.DoorLock.types.Feature.DOOR_POSITION_SENSOR == 0 then
735-
device:set_field(profiling_data.ENABLE_DOOR_STATE, false, {persist = true})
736-
else
737-
device:set_field(profiling_data.ENABLE_DOOR_STATE, true, {persist = true})
738-
end
739678
match_profile(driver, device, true)
740679
end
741680
end
@@ -2992,7 +2931,6 @@ local new_matter_lock_handler = {
29922931
attr = {
29932932
[DoorLock.ID] = {
29942933
[DoorLock.attributes.LockState.ID] = lock_state_handler,
2995-
[DoorLock.attributes.DoorState.ID] = door_state_handler,
29962934
[DoorLock.attributes.OperatingMode.ID] = operating_modes_handler,
29972935
[DoorLock.attributes.NumberOfTotalUsersSupported.ID] = total_users_supported_handler,
29982936
[DoorLock.attributes.NumberOfPINUsersSupported.ID] = pin_users_supported_handler,

0 commit comments

Comments
 (0)