Skip to content

Commit da87d06

Browse files
Remove device_init call from device_added
This is really only needed for parent-child devices, and therefore can be removed from the device_added event handler. Also, remove references the INITIAL_PRESS_ONLY flag because it is not needed in this subdriver.
1 parent 064c7a6 commit da87d06

File tree

2 files changed

+1
-10
lines changed

2 files changed

+1
-10
lines changed

drivers/SmartThings/matter-switch/src/test/test_third_reality_mk1.lua

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,6 @@ local function test_init()
214214
test.socket.matter:__expect_send({mock_device.id, subscribe_request})
215215
test.mock_device.add_test_device(mock_device)
216216
test.socket.device_lifecycle:__queue_receive({ mock_device.id, "added" })
217-
test.socket.matter:__expect_send({mock_device.id, subscribe_request})
218217
local device_info_copy = utils.deep_copy(mock_device.raw_st_data)
219218
device_info_copy.profile.id = "12-buttons-keyboard"
220219
local device_info_json = dkjson.encode(device_info_copy)

drivers/SmartThings/matter-switch/src/third-reality-mk1/init.lua

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ local im = require "st.matter.interaction_model"
1919
local log = require "log"
2020

2121
local COMPONENT_TO_ENDPOINT_MAP = "__component_to_endpoint_map"
22-
local INITIAL_PRESS_ONLY = "__initial_press_only"
2322

2423
-------------------------------------------------------------------------------------
2524
-- Third Reality MK1 specifics
@@ -37,10 +36,6 @@ local function is_third_reality_mk1(opts, driver, device)
3736
return false
3837
end
3938

40-
local function set_field_for_endpoint(device, field, endpoint, value, additional_params)
41-
device:set_field(string.format("%s_%d", field, endpoint), value, additional_params)
42-
end
43-
4439
local function endpoint_to_component(device, ep)
4540
local map = device:get_field(COMPONENT_TO_ENDPOINT_MAP) or {}
4641
for component, endpoint in pairs(map) do
@@ -63,7 +58,6 @@ local function configure_buttons(device)
6358
local ms_eps = device:get_endpoints(clusters.Switch.ID, {feature_bitmap=clusters.Switch.types.SwitchFeature.MOMENTARY_SWITCH})
6459
for _, ep in ipairs(ms_eps) do
6560
if device.profile.components[endpoint_to_component(device, ep)] then
66-
set_field_for_endpoint(device, INITIAL_PRESS_ONLY, ep, true, {persist = true})
6761
device.log.info_with({hub_logs=true}, string.format("Configuring Supported Values for generic switch endpoint %d", ep))
6862
local supportedButtonValues_event = capabilities.button.supportedButtonValues({"pushed"}, {visibility = {displayed = false}})
6963
device:emit_event_for_endpoint(ep, supportedButtonValues_event)
@@ -91,9 +85,7 @@ local function device_init(driver, device)
9185
device:subscribe()
9286
end
9387

94-
local function device_added(driver, device)
95-
device_init(driver, device)
96-
end
88+
local function device_added(driver, device) end
9789

9890
local function info_changed(driver, device, event, args)
9991
if device.profile.id ~= args.old_st_store.profile.id then

0 commit comments

Comments
 (0)