Skip to content

Commit da4a05f

Browse files
committed
remove unused function
1 parent 07cf40e commit da4a05f

File tree

2 files changed

+9
-31
lines changed

2 files changed

+9
-31
lines changed

drivers/SmartThings/matter-switch/src/utils/device_configuration.lua

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -96,26 +96,6 @@ function SwitchDeviceConfiguration.create_child_devices(driver, device, server_o
9696
device:set_find_child(switch_utils.find_child)
9797
end
9898

99-
function SwitchDeviceConfiguration.update_devices_with_onOff_server_clusters(device, main_endpoint)
100-
local cluster_id = 0
101-
for _, ep in ipairs(device.endpoints) do
102-
-- main_endpoint only supports server cluster by definition of get_endpoints()
103-
if main_endpoint == ep.endpoint_id then
104-
for _, dt in ipairs(ep.device_types) do
105-
-- no device type that is not in the switch subset should be considered.
106-
if (fields.DEVICE_TYPE_ID.SWITCH.ON_OFF_LIGHT <= dt.device_type_id and dt.device_type_id <= fields.DEVICE_TYPE_ID.SWITCH.COLOR_DIMMER) then
107-
cluster_id = math.max(cluster_id, dt.device_type_id)
108-
end
109-
end
110-
break
111-
end
112-
end
113-
114-
if fields.device_type_profile_map[cluster_id] then
115-
device:try_update_metadata({profile = fields.device_type_profile_map[cluster_id]})
116-
end
117-
end
118-
11999
function ButtonDeviceConfiguration.update_button_profile(device, main_endpoint, num_button_eps)
120100
local profile_name = string.gsub(num_button_eps .. "-button", "1%-", "") -- remove the "1-" in a device with 1 button ep
121101
if switch_utils.device_type_supports_button_switch_combination(device, main_endpoint) then

drivers/SmartThings/matter-switch/src/utils/switch_fields.lua

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,14 @@ SwitchFields.SWITCH_LEVEL_LIGHTING_MIN = 1
4545
SwitchFields.CURRENT_HUESAT_ATTR_MIN = 0
4646
SwitchFields.CURRENT_HUESAT_ATTR_MAX = 254
4747

48-
49-
-- DEVICE TYPES
5048
SwitchFields.DEVICE_TYPE_ID = {
49+
AGGREGATOR = 0x000E,
50+
DIMMABLE_PLUG_IN_UNIT = 0x010B,
51+
ELECTRICAL_SENSOR = 0x0510,
52+
GENERIC_SWITCH = 0x000F,
53+
MOUNTED_ON_OFF_CONTROL = 0x010F,
54+
MOUNTED_DIMMABLE_LOAD_CONTROL = 0x0110,
55+
ON_OFF_PLUG_IN_UNIT = 0x010A,
5156
LIGHT = {
5257
ON_OFF = 0x0100,
5358
DIMMABLE = 0x0101,
@@ -59,25 +64,18 @@ SwitchFields.DEVICE_TYPE_ID = {
5964
DIMMER = 0x0104,
6065
COLOR_DIMMER = 0x0105,
6166
},
62-
AGGREGATOR = 0x000E,
63-
ON_OFF_PLUG_IN_UNIT = 0x010A,
64-
DIMMABLE_PLUG_IN_UNIT = 0x010B,
65-
MOUNTED_ON_OFF_CONTROL = 0x010F,
66-
MOUNTED_DIMMABLE_LOAD_CONTROL = 0x0110,
67-
GENERIC_SWITCH = 0x000F,
68-
ELECTRICAL_SENSOR = 0x0510,
6967
}
7068

7169
SwitchFields.device_type_profile_map = {
7270
[SwitchFields.DEVICE_TYPE_ID.LIGHT.ON_OFF] = "light-binary",
7371
[SwitchFields.DEVICE_TYPE_ID.LIGHT.DIMMABLE] = "light-level",
7472
[SwitchFields.DEVICE_TYPE_ID.LIGHT.COLOR_TEMPERATURE] = "light-level-colorTemperature",
7573
[SwitchFields.DEVICE_TYPE_ID.LIGHT.EXTENDED_COLOR] = "light-color-level",
76-
[SwitchFields.DEVICE_TYPE_ID.ON_OFF_PLUG_IN_UNIT] = "plug-binary",
77-
[SwitchFields.DEVICE_TYPE_ID.DIMMABLE_PLUG_IN_UNIT] = "plug-level",
7874
[SwitchFields.DEVICE_TYPE_ID.SWITCH.ON_OFF_LIGHT] = "switch-binary",
7975
[SwitchFields.DEVICE_TYPE_ID.SWITCH.DIMMER] = "switch-level",
8076
[SwitchFields.DEVICE_TYPE_ID.SWITCH.COLOR_DIMMER] = "switch-color-level",
77+
[SwitchFields.DEVICE_TYPE_ID.ON_OFF_PLUG_IN_UNIT] = "plug-binary",
78+
[SwitchFields.DEVICE_TYPE_ID.DIMMABLE_PLUG_IN_UNIT] = "plug-level",
8179
[SwitchFields.DEVICE_TYPE_ID.MOUNTED_ON_OFF_CONTROL] = "switch-binary",
8280
[SwitchFields.DEVICE_TYPE_ID.MOUNTED_DIMMABLE_LOAD_CONTROL] = "switch-level",
8381
}

0 commit comments

Comments
 (0)