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
5 changes: 5 additions & 0 deletions drivers/SmartThings/zigbee-button/fingerprints.yml
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,11 @@ zigbeeManufacturer:
manufacturer: Third Reality, Inc
model: 3RSB22BZ
deviceProfileName: one-button-battery
- id: "Third Reality/3RSB01085Z"
deviceLabel: ThirdReality Smart Button ZB2
manufacturer: Third Reality, Inc
model: 3RSB01085Z
deviceProfileName: thirdreality-three-button
- id: Samsung/SAMSUNG-ITM-Z-005
deviceLabel: ITM Switch
manufacturer: Samsung Electronics
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: thirdreality-three-button
components:
- id: main
capabilities:
- id: battery
version: 1
- id: firmwareUpdate
version: 1
- 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
1 change: 1 addition & 0 deletions drivers/SmartThings/zigbee-button/src/sub_drivers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ local sub_drivers = {
lazy_load_if_possible("samjin"),
lazy_load_if_possible("ewelink"),
lazy_load_if_possible("thirdreality"),
lazy_load_if_possible("thirdreality-zb2"),
lazy_load_if_possible("ezviz"),
}
return sub_drivers
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-- Copyright 2025 SmartThings, Inc.
-- Licensed under the Apache License, Version 2.0

local function thirdreality_zb2_can_handle(opts, driver, device, ...)
if device:get_manufacturer() == "Third Reality, Inc" and device:get_model() == "3RSB01085Z" then
return true, require("thirdreality-zb2")
end
return false
end

return thirdreality_zb2_can_handle
64 changes: 64 additions & 0 deletions drivers/SmartThings/zigbee-button/src/thirdreality-zb2/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
local capabilities = require "st.capabilities"

local MULTISTATE_INPUT_CLUSTER_ID = 0x0012
local PRESENT_VALUE_ATTR_ID = 0x0055

local HELD = 0x0000
local PUSHED = 0x0001
local DOUBLE = 0x0002

local COMPONENT_MAP = {
[1] = "button1",
[2] = "button2",
[3] = "button3"
}

local function present_value_attr_handler(driver, device, value, zb_rx)
local event

if value.value == PUSHED then
event = capabilities.button.button.pushed({ state_change = true })
elseif value.value == DOUBLE then
event = capabilities.button.button.double({ state_change = true })
elseif value.value == HELD then
event = capabilities.button.button.held({ state_change = true })
end

if not event then return end

local ep = zb_rx.address_header.src_endpoint.value
local component_id = COMPONENT_MAP[ep]

if component_id and device.profile.components[component_id] then
device:emit_component_event(device.profile.components[component_id], event)
end
end

local function device_added(driver, device)
local supported = { "pushed", "double", "held" }

for ep, comp_id in pairs(COMPONENT_MAP) do
local comp = device.profile.components[comp_id]
if comp then
device:emit_component_event(comp, capabilities.button.supportedButtonValues(supported, { visibility = { displayed = false } }))
device:emit_component_event(comp, capabilities.button.numberOfButtons({ value = 1 }))
end
end
end

local thirdreality_3button_handler = {
NAME = "ThirdReality Smart Button ZB2",
lifecycle_handlers = {
added = device_added
},
zigbee_handlers = {
attr = {
[MULTISTATE_INPUT_CLUSTER_ID] = {
[PRESENT_VALUE_ATTR_ID] = present_value_attr_handler
}
}
},
can_handle = require("thirdreality-zb2.can_handle"),
}

return thirdreality_3button_handler
Loading