diff --git a/drivers/SmartThings/zigbee-switch/fingerprints.yml b/drivers/SmartThings/zigbee-switch/fingerprints.yml index db44b09caa..64863a21a5 100644 --- a/drivers/SmartThings/zigbee-switch/fingerprints.yml +++ b/drivers/SmartThings/zigbee-switch/fingerprints.yml @@ -1075,6 +1075,11 @@ zigbeeManufacturer: manufacturer: model: TERNCY-LS01 deviceProfileName: basic-switch + - id: Third Reality/3RPL01084Z + deviceLabel: ThirdReality Multi-Function Smart Presence Sensor R3 + manufacturer: Third Reality, Inc + model: 3RPL01084Z + deviceProfileName: thirdreality-presence-color-night-light - id: Third Reality/3RSS009Z deviceLabel: ThirdReality Switch manufacturer: Third Reality, Inc diff --git a/drivers/SmartThings/zigbee-switch/profiles/thirdreality-presence-color-night-light.yml b/drivers/SmartThings/zigbee-switch/profiles/thirdreality-presence-color-night-light.yml new file mode 100644 index 0000000000..504472fbf6 --- /dev/null +++ b/drivers/SmartThings/zigbee-switch/profiles/thirdreality-presence-color-night-light.yml @@ -0,0 +1,28 @@ +name: thirdreality-presence-color-night-light +components: +- id: main + capabilities: + - id: switch + version: 1 + - id: switchLevel + version: 1 + config: + values: + - key: "level.value" + range: [1, 100] + - id: colorTemperature + version: 1 + - id: colorControl + version: 1 + - id: motionSensor + version: 1 + - id: illuminanceMeasurement + version: 1 + - id: tvocMeasurement + version: 1 + - id: firmwareUpdate + version: 1 + - id: refresh + version: 1 + categories: + - name: Light \ No newline at end of file diff --git a/drivers/SmartThings/zigbee-switch/src/init.lua b/drivers/SmartThings/zigbee-switch/src/init.lua index 062ac68782..5639918292 100644 --- a/drivers/SmartThings/zigbee-switch/src/init.lua +++ b/drivers/SmartThings/zigbee-switch/src/init.lua @@ -66,6 +66,7 @@ local zigbee_switch_driver_template = { capabilities.illuminanceMeasurement, capabilities.relativeHumidityMeasurement, capabilities.temperatureMeasurement, + capabilities.tvocMeasurement }, sub_drivers = require("sub_drivers"), zigbee_handlers = { diff --git a/drivers/SmartThings/zigbee-switch/src/sub_drivers.lua b/drivers/SmartThings/zigbee-switch/src/sub_drivers.lua index 736c2a0464..2400b3dd40 100644 --- a/drivers/SmartThings/zigbee-switch/src/sub_drivers.lua +++ b/drivers/SmartThings/zigbee-switch/src/sub_drivers.lua @@ -37,5 +37,6 @@ return { lazy_load_if_possible("frient"), lazy_load_if_possible("frient-IO"), lazy_load_if_possible("color_temp_range_handlers"), + lazy_load_if_possible("thirdreality-presence-sensor-r3"), lazy_load_if_possible("stateless_handlers") } diff --git a/drivers/SmartThings/zigbee-switch/src/thirdreality-presence-sensor-r3/can_handle.lua b/drivers/SmartThings/zigbee-switch/src/thirdreality-presence-sensor-r3/can_handle.lua new file mode 100644 index 0000000000..2c1749c6ae --- /dev/null +++ b/drivers/SmartThings/zigbee-switch/src/thirdreality-presence-sensor-r3/can_handle.lua @@ -0,0 +1,11 @@ +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local function thirdreality_can_handle(opts, driver, device, ...) + if device:get_manufacturer() == "Third Reality, Inc" and device:get_model() == "3RPL01084Z" then + return true, require("thirdreality-presence-sensor-r3") + end + return false +end + +return thirdreality_can_handle diff --git a/drivers/SmartThings/zigbee-switch/src/thirdreality-presence-sensor-r3/init.lua b/drivers/SmartThings/zigbee-switch/src/thirdreality-presence-sensor-r3/init.lua new file mode 100644 index 0000000000..b35322e7ad --- /dev/null +++ b/drivers/SmartThings/zigbee-switch/src/thirdreality-presence-sensor-r3/init.lua @@ -0,0 +1,39 @@ +local zcl_clusters = require "st.zigbee.zcl.clusters" +local capabilities = require "st.capabilities" +local OccupancySensing = zcl_clusters.OccupancySensing + +local THIRDREALITY_TVOC_CLUSTER = 0x042E +local THIRDREALITY_TVOC_VALUE = 0x0000 + +local function occupancy_attr_handler(driver, device, occupancy, zb_rx) + device:emit_event(occupancy.value == 1 and capabilities.motionSensor.motion.active() or capabilities.motionSensor.motion.inactive()) +end + +local function tvoc_attr_handler(driver, device, value, zb_rx) + device:emit_event_for_endpoint(zb_rx.address_header.src_endpoint.value, capabilities.tvocMeasurement.tvocLevel({ value = value.value, unit = "ppb" })) +end + +local added_handler = function(self, device) + device:send(OccupancySensing.attributes.Occupancy:read(device)) + device:emit_event(capabilities.tvocMeasurement.tvocLevel({value = 0, unit = "ppb"})) +end + +local thirdreality_device_handler = { + NAME = "ThirdReality Multi-Function Smart Presence Sensor R3", + lifecycle_handlers = { + added = added_handler + }, + zigbee_handlers = { + attr = { + [OccupancySensing.ID] = { + [OccupancySensing.attributes.Occupancy.ID] = occupancy_attr_handler + }, + [THIRDREALITY_TVOC_CLUSTER] = { + [THIRDREALITY_TVOC_VALUE] = tvoc_attr_handler + } + } + }, + can_handle = require("thirdreality-presence-sensor-r3.can_handle"), +} + +return thirdreality_device_handler