Skip to content
Open
Show file tree
Hide file tree
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
8 changes: 8 additions & 0 deletions drivers/SmartThings/matter-switch/fingerprints.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
matterManufacturer:
#Linxura
- id: "Aura Smart Button"
deviceLabel: Aura Smart Button
vendorId: 0xFFF1
productId: 0x8004
deviceProfileName: 12-buttons-without-main-button
# deviceProfileName: 8-buttons-without-main-button
# deviceProfileName: four-buttons-without-main-button
#Aqara
- id: "4447/6145"
deviceLabel: Aqara LED Bulb T2 RGB CCT
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: 12-buttons-without-main-button
components:
- id: main
capabilities:
- id: refresh
version: 1
categories:
- name: RemoteController
- id: button1
capabilities:
- id: button
version: 1
categories:
- name: RemoteController
- id: button2
capabilities:
- id: button
version: 1
categories:
- name: RemoteController
- id: button3
capabilities:
- id: button
version: 1
categories:
- name: RemoteController
- id: button4
capabilities:
- id: button
version: 1
categories:
- name: RemoteController
- id: button5
capabilities:
- id: button
version: 1
categories:
- name: RemoteController
- id: button6
capabilities:
- id: button
version: 1
categories:
- name: RemoteController
- id: button7
capabilities:
- id: button
version: 1
categories:
- name: RemoteController
- id: button8
capabilities:
- id: button
version: 1
categories:
- name: RemoteController
- id: button9
capabilities:
- id: button
version: 1
categories:
- name: RemoteController
- id: button10
capabilities:
- id: button
version: 1
categories:
- name: RemoteController
- id: button11
capabilities:
- id: button
version: 1
categories:
- name: RemoteController
- id: button12
capabilities:
- id: button
version: 1
categories:
- name: RemoteController
40 changes: 33 additions & 7 deletions drivers/SmartThings/matter-switch/src/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ local child_device_profile_overrides_per_vendor_id = {
{ product_id = 0x1008, target_profile = "light-power-energy-powerConsumption" }, -- 2 Buttons(Generic Switch), 1 Channel(On/Off Light)
{ product_id = 0x1009, target_profile = "light-power-energy-powerConsumption" }, -- 4 Buttons(Generic Switch), 2 Channels(On/Off Light)
{ product_id = 0x100A, target_profile = "light-level-power-energy-powerConsumption" }, -- 1 Buttons(Generic Switch), 1 Channels(Dimmable Light)
},
[0xFFF1] = {
{ product_id = 0x8004, target_profile = "12-buttons-without-main-button"},
}
}

Expand Down Expand Up @@ -289,7 +292,8 @@ local START_BUTTON_PRESS = "__start_button_press"
local TIMEOUT_THRESHOLD = 10 --arbitrary timeout
local HELD_THRESHOLD = 1
-- this is the number of buttons for which we have a static profile already made
local STATIC_BUTTON_PROFILE_SUPPORTED = {1, 2, 3, 4, 5, 6, 7, 8, 9}
-- local STATIC_BUTTON_PROFILE_SUPPORTED = {1, 2, 3, 4, 5, 6, 7, 8}
local STATIC_BUTTON_PROFILE_SUPPORTED = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}

-- Some switches will send a MultiPressComplete event as part of a long press sequence. Normally the driver will create a
-- button capability event on receipt of MultiPressComplete, but in this case that would result in an extra event because
Expand Down Expand Up @@ -421,6 +425,14 @@ local function find_default_endpoint(device)
return device.MATTER_DEFAULT_ENDPOINT
end

if device.manufacturer_info.vendor_id == 0xFFF1 and
device.manufacturer_info.product_id == 0x8004 then
log.warn(string.format("return main endpoint"))
log.info(string.format("Matter default endpoint: %d", device.MATTER_DEFAULT_ENDPOINT))
-- In case of Aura, in order to sequentially set the button name to button 1,-12
return device.MATTER_DEFAULT_ENDPOINT
end

local switch_eps = device:get_endpoints(clusters.OnOff.ID)
local button_eps = device:get_endpoints(clusters.Switch.ID, {feature_bitmap=clusters.Switch.types.SwitchFeature.MOMENTARY_SWITCH})

Expand Down Expand Up @@ -562,14 +574,24 @@ local function build_button_component_map(device, main_endpoint, button_eps)
-- create component mapping on the main profile button endpoints
table.sort(button_eps)
local component_map = {}
component_map["main"] = main_endpoint
--component_map["main"] = main_endpoint
if device.manufacturer_info.vendor_id ~= 0xFFF1 or
device.manufacturer_info.product_id ~= 0x8004 then
component_map["main"] = main_endpoint
end
for component_num, ep in ipairs(button_eps) do
if ep ~= main_endpoint then
local button_component = "button"
if #button_eps > 1 then
button_component = button_component .. component_num
end
if device.manufacturer_info.vendor_id == 0xFFF1 and
device.manufacturer_info.product_id == 0x8004 then
local button_component = "button" .. component_num
component_map[button_component] = ep
else
if ep ~= main_endpoint then
local button_component = "button"
if #button_eps > 1 then
button_component = button_component .. component_num
end
component_map[button_component] = ep
end
end
end
device:set_field(COMPONENT_TO_ENDPOINT_MAP, component_map, {persist = true})
Expand All @@ -584,6 +606,10 @@ local function build_button_profile(device, main_endpoint, num_button_eps)
if battery_supported then -- battery profiles are configured later, in power_source_attribute_list_handler
device:send(clusters.PowerSource.attributes.AttributeList:read(device))
else
if device.manufacturer_info.vendor_id == 0xFFF1 and
device.manufacturer_info.product_id == 0x8004 then -- for aura smart button
profile_name = "12-buttons-without-main-button"
end
device:try_update_metadata({profile = profile_name})
end
end
Expand Down
Loading