diff --git a/drivers/SmartThings/zigbee-button/fingerprints.yml b/drivers/SmartThings/zigbee-button/fingerprints.yml index 431a5b7d52..0770ada8b2 100644 --- a/drivers/SmartThings/zigbee-button/fingerprints.yml +++ b/drivers/SmartThings/zigbee-button/fingerprints.yml @@ -164,6 +164,11 @@ zigbeeManufacturer: manufacturer: Third Reality, Inc model: 3RSB22BZ deviceProfileName: one-button-battery + - id: Samsung/SAMSUNG-ITM-Z-005 + deviceLabel: ITM Switch + manufacturer: Samsung Electronics + model: SAMSUNG-ITM-Z-005 + deviceProfileName: SLED-three-buttons # # Wall Hero - id: "WALL HERO/ACL-401SCA4" deviceLabel: 语音场景(4寸)面板 diff --git a/drivers/SmartThings/zigbee-button/profiles/SLED-three-buttons.yml b/drivers/SmartThings/zigbee-button/profiles/SLED-three-buttons.yml new file mode 100644 index 0000000000..d17dc500d1 --- /dev/null +++ b/drivers/SmartThings/zigbee-button/profiles/SLED-three-buttons.yml @@ -0,0 +1,28 @@ +name: SLED-three-buttons +components: + - id: main + capabilities: + - 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 diff --git a/drivers/SmartThings/zigbee-button/src/zigbee-multi-button/SLED/init.lua b/drivers/SmartThings/zigbee-button/src/zigbee-multi-button/SLED/init.lua new file mode 100644 index 0000000000..ea6a9d5faa --- /dev/null +++ b/drivers/SmartThings/zigbee-button/src/zigbee-multi-button/SLED/init.lua @@ -0,0 +1,80 @@ +-- Copyright 2023 SmartThings +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. + +local capabilities = require "st.capabilities" +local clusters = require "st.zigbee.zcl.clusters" +local device_management = require "st.zigbee.device_management" +local log = require "log" +local Level = clusters.Level +local OnOff = clusters.OnOff +local ColorControl = clusters.ColorControl + +local emit_pushed_event = function(button_name, device) + local additional_fields = { + state_change = true + } + local event = capabilities.button.button.pushed(additional_fields) + local comp = device.profile.components[button_name] + if comp ~= nil then + device:emit_component_event(comp, event) + else + log.warn("Attempted to emit button event for unknown button: " .. button_name) + end +end + +local emit_held_event = function(button_name, device) + local additional_fields = { + state_change = true + } + local event = capabilities.button.button.held(additional_fields) + local comp = device.profile.components[button_name] + if comp ~= nil then + device:emit_component_event(comp, event) + else + log.warn("Attempted to emit button event for unknown button: " .. button_name) + end +end + +local do_configure = function(self, device) + device:send(device_management.build_bind_request(device, OnOff.ID, self.environment_info.hub_zigbee_eui)) + -- The device reports button presses to this group but it can't be read from the binding table +end + +local SLED_button = { + NAME = "SLED Button", + zigbee_handlers = { + cluster = { + [OnOff.ID] = { + [OnOff.server.commands.Off.ID] = function(driver, device, zb_rx) emit_pushed_event("button2", device) end, + [OnOff.server.commands.On.ID] = function(driver, device, zb_rx) emit_pushed_event("button1", device) end, + [OnOff.server.commands.Toggle.ID] = function(driver, device, zb_rx) emit_pushed_event("button3", device) end + }, + [Level.ID] = { + [Level.server.commands.Move.ID] = function(driver, device, zb_rx) emit_held_event("button2", device) end, + [Level.server.commands.MoveWithOnOff.ID] = function(driver, device, zb_rx) emit_held_event("button1", device) end + }, + [ColorControl.ID] = { + [ColorControl.server.commands.MoveToColorTemperature.ID] = function(driver, device, zb_rx) emit_held_event("button3", device) end + } + } + }, + lifecycle_handlers = { + doConfigure = do_configure + }, + can_handle = function(opts, driver, device, ...) + return device:get_manufacturer() == "Samsung Electronics" and device:get_model() == "SAMSUNG-ITM-Z-005" + end +} + +return SLED_button diff --git a/drivers/SmartThings/zigbee-button/src/zigbee-multi-button/init.lua b/drivers/SmartThings/zigbee-button/src/zigbee-multi-button/init.lua index 59a59ce1d2..b0e210d7c4 100644 --- a/drivers/SmartThings/zigbee-button/src/zigbee-multi-button/init.lua +++ b/drivers/SmartThings/zigbee-button/src/zigbee-multi-button/init.lua @@ -39,7 +39,8 @@ local ZIGBEE_MULTI_BUTTON_FINGERPRINTS = { { mfr = "ShinaSystem", model = "SBM300ZB3" }, { mfr = "ROBB smarrt", model = "ROB_200-007-0" }, { mfr = "ROBB smarrt", model = "ROB_200-008-0" }, - { mfr = "WALL HERO", model = "ACL-401SCA4" } + { mfr = "WALL HERO", model = "ACL-401SCA4" }, + { mfr = "Samsung Electronics", model = "SAMSUNG-ITM-Z-005" } } local function can_handle_zigbee_multi_button(opts, driver, device, ...) @@ -86,6 +87,7 @@ local zigbee_multi_button = { require("zigbee-multi-button.shinasystems"), require("zigbee-multi-button.robb"), require("zigbee-multi-button.wallhero"), + require("zigbee-multi-button.SLED") } } diff --git a/drivers/SmartThings/zigbee-button/src/zigbee-multi-button/supported_values.lua b/drivers/SmartThings/zigbee-button/src/zigbee-multi-button/supported_values.lua index c20c322488..711877fbaa 100644 --- a/drivers/SmartThings/zigbee-button/src/zigbee-multi-button/supported_values.lua +++ b/drivers/SmartThings/zigbee-button/src/zigbee-multi-button/supported_values.lua @@ -52,6 +52,13 @@ local devices = { SUPPORTED_BUTTON_VALUES = { "pushed" }, NUMBER_OF_BUTTONS = 3 }, + BUTTON_PUSH_HELD_3 = { + MATCHING_MATRIX = { + { mfr = "Samsung Electronics", model = "SAMSUNG-ITM-Z-005" }, + }, + SUPPORTED_BUTTON_VALUES = { "pushed", "held" }, + NUMBER_OF_BUTTONS = 3 + }, BUTTON_PUSH_4 = { MATCHING_MATRIX = { { mfr = "LDS", model = "ZBT-CCTSwitch-D0001" },