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
14 changes: 14 additions & 0 deletions drivers/SmartThings/matter-switch/profiles/garage-door-battery.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: garage-door-battery
components:
- id: main
capabilities:
- id: doorControl
version: 1
- id: battery
version: 1
- id: firmwareUpdate
version: 1
- id: refresh
version: 1
categories:
- name: GarageDoor
1 change: 1 addition & 0 deletions drivers/SmartThings/matter-switch/src/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ local matter_driver_template = {
switch_utils.lazy_load("sub_drivers.camera"),
switch_utils.lazy_load_if_possible("sub_drivers.eve_energy"),
switch_utils.lazy_load_if_possible("sub_drivers.ikea_scroll"),
switch_utils.lazy_load_if_possible("sub_drivers.third_reality_garage_door"),
switch_utils.lazy_load_if_possible("sub_drivers.third_reality_mk1")
},
shared_device_thread_enabled = true,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-- Copyright 2026 SmartThings, Inc.
-- Licensed under the Apache License, Version 2.0

local utils = require "switch_utils.utils"

return function(opts, driver, device)
if utils.get_product_override_field(device, "is_third_reality_garage_door") then
return true, require("sub_drivers.third_reality_garage_door")
end
return false
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
-- Copyright © 2026 SmartThings, Inc.
-- Licensed under the Apache License, Version 2.0

local capabilities = require "st.capabilities"
local clusters = require "st.matter.clusters"

-------------------------------------------------------------------------------------
-- Third Reality Garage Door Opener specifics
--
-- This device uses the OnOff cluster to control the door:
-- OnOff = true -> door open
-- OnOff = false -> door closed
-- Commands are mapped from doorControl capability to OnOff cluster commands.
-------------------------------------------------------------------------------------

local function device_init(driver, device)
-- Force a subscription to the OnOff cluster, since doorControl does not explicitly map to it in the default driver.
device:add_subscribed_attribute(clusters.OnOff.attributes.OnOff)
device:add_subscribed_attribute(clusters.PowerSource.attributes.BatPercentRemaining)
device:subscribe()
end

local function match_profile(driver, device)
device:try_update_metadata({profile = "garage-door-battery"})
end

-- Prevent any of the main driver's logic from running
local function device_added(driver, device) end

-- Prevent any of the main driver's logic from running
local function info_changed(driver, device, event, args) end

local function do_configure(driver, device)
match_profile(driver, device)
end

local function driver_switched(driver, device)
match_profile(driver, device)
end


local function on_off_attr_handler(driver, device, ib, response)
if ib.data.value then
device:emit_event_for_endpoint(ib.endpoint_id, capabilities.doorControl.door.open())
else
device:emit_event_for_endpoint(ib.endpoint_id, capabilities.doorControl.door.closed())
end
end

local function handle_door_open(driver, device, cmd)
local endpoint_id = device:component_to_endpoint(cmd.component)
device:emit_event_for_endpoint(endpoint_id, capabilities.doorControl.door.opening())
device:send(clusters.OnOff.server.commands.On(device, endpoint_id))
end

local function handle_door_close(driver, device, cmd)
local endpoint_id = device:component_to_endpoint(cmd.component)
device:emit_event_for_endpoint(endpoint_id, capabilities.doorControl.door.closing())
device:send(clusters.OnOff.server.commands.Off(device, endpoint_id))
end

local third_reality_garage_door_handler = {
NAME = "ThirdReality Garage Door Handler",
lifecycle_handlers = {
init = device_init,
added = device_added,
doConfigure = do_configure,
driverSwitched = driver_switched,
infoChanged = info_changed,
},
matter_handlers = {
attr = {
[clusters.OnOff.ID] = {
[clusters.OnOff.attributes.OnOff.ID] = on_off_attr_handler,
},
},
},
capability_handlers = {
[capabilities.doorControl.ID] = {
[capabilities.doorControl.commands.open.NAME] = handle_door_open,
[capabilities.doorControl.commands.close.NAME] = handle_door_close,
},
},
supported_capabilities = {
capabilities.doorControl,
capabilities.battery,
},
can_handle = require("sub_drivers.third_reality_garage_door.can_handle")
}

return third_reality_garage_door_handler
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 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 utils.get_product_override_field(device, "is_third_reality_mk1") then
return true, require("sub_drivers.third_reality_mk1")
end
return false
Expand Down
4 changes: 4 additions & 0 deletions drivers/SmartThings/matter-switch/src/switch_utils/fields.lua
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ SwitchFields.vendor_overrides = {
[0x000C] = { target_profile = "switch-binary", initial_profile = "plug-binary" },
[0x000D] = { target_profile = "switch-binary", initial_profile = "plug-binary" },
},
[0x1407] = { -- THIRD_REALITY_MANUFACTURER_ID
[0x1098] = { is_third_reality_garage_door = true },
[0x1388] = { is_third_reality_mk1 = true},
},
}

SwitchFields.switch_category_vendor_overrides = {
Expand Down
242 changes: 0 additions & 242 deletions drivers/SmartThings/matter-switch/src/test/test_third_reality_mk1.lua

This file was deleted.

Loading
Loading