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
12 changes: 12 additions & 0 deletions drivers/SmartThings/matter-switch/profiles/garage-door.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: garage-door-binary
components:
- id: main
capabilities:
- id: switch
version: 1
- id: firmwareUpdate
version: 1
- id: refresh
version: 1
categories:
- name: GarageDoor
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
-- Copyright 2025 SmartThings, Inc.
-- Licensed under the Apache License, Version 2.0

local device_lib = require "st.device"
local switch_utils = require "switch_utils.utils"

return function(opts, driver, device)
local THIRD_REALITY_MK1_FINGERPRINT = { vendor_id = 0x1407, product_id = 0x1388 }
if device.network_type == device_lib.NETWORK_TYPE_MATTER and
device.manufacturer_info.vendor_id == THIRD_REALITY_MK1_FINGERPRINT.vendor_id and
device.manufacturer_info.product_id == THIRD_REALITY_MK1_FINGERPRINT.product_id then
if switch_utils.get_product_override_field(device, "is_3r_mk1") then
return true, require("sub_drivers.third_reality_mk1")
end
return false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ function SwitchDeviceConfiguration.assign_profile_for_onoff_ep(device, server_on
generic_profile = string.gsub(generic_profile, "-binary", "") .. static_electrical_tags
end

if is_child_device and generic_profile == switch_utils.get_product_override_field(device, "initial_profile") then
if not switch_utils.get_product_override_field(device, "on_children_only") or is_child_device and
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you'll need parentheses around the first two conditions here. Here's what'll happen otherwise:

> if true or false and false then print "hi" end
hi
> if (true or false) and false then print "hi" end
>

generic_profile == switch_utils.get_product_override_field(device, "initial_profile") then
generic_profile = switch_utils.get_product_override_field(device, "target_profile") or generic_profile
end

Expand Down
8 changes: 6 additions & 2 deletions drivers/SmartThings/matter-switch/src/switch_utils/fields.lua
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,12 @@ SwitchFields.updated_fields = {

SwitchFields.vendor_overrides = {
[0x1321] = { -- SONOFF_MANUFACTURER_ID
[0x000C] = { target_profile = "switch-binary", initial_profile = "plug-binary" },
[0x000D] = { target_profile = "switch-binary", initial_profile = "plug-binary" },
[0x000C] = { on_children_only = true, target_profile = "switch-binary", initial_profile = "plug-binary" },
[0x000D] = { on_children_only = true, target_profile = "switch-binary", initial_profile = "plug-binary" },
},
[0x1407] = { -- THIRD_REALITY_ID
[0x1388] = { is_3r_mk1 = true },
[0x1098] = { target_profile = "garage-door-binary", initial_profile = "light-binary" },
},
[0x115F] = { -- AQARA_MANUFACTURER_ID
[0x1006] = { ignore_combo_switch_button = true }, -- 3 Buttons(Generic Switch), 1 Channel (Dimmable Light)
Expand Down
Loading