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
97 changes: 97 additions & 0 deletions docs/superpowers/specs/2026-08-24-rtitek-sthzb-wwst-design.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Rti-Tek STHZB WWST Driver Design

## Goal

Add WWST-compliant support for the Rti-Tek STHZB Zigbee temperature and
humidity sensor to the official `zigbee-humidity-sensor` Edge driver. The
implementation must use only SmartThings standard capabilities and device
preferences, while retaining the device features that can be represented by
those public interfaces.

This work is isolated to the `codex/rtitek-sthzb-wwst` branch and does not
change the separately distributed `Rti-Tek STHZB Unit Enum8 v15` driver.

## Scope

The driver matches `manufacturer: Rti-Tek` and `model: STHZB` and uses the
existing `rtitek-sthzb` profile in `drivers/SmartThings/zigbee-humidity-sensor`.

The user-facing device card exposes only standard capabilities:

- `temperatureMeasurement`
- `relativeHumidityMeasurement`
- `battery`
- `refresh`
- `temperatureAlarm`

The device preferences provide the configurable manufacturer-specific
behavior:

| Preference | Device attribute | Wire type and conversion |
| --- | --- | --- |
| Display temperature unit | `0xFD22/0x0000` | `Enum8`: Celsius `0`, Fahrenheit `1` |
| Temperature calibration | `0xFD22/0xE005` | `Int8`, preference value in `0.1 C` |
| Humidity calibration | `0xFD22/0xE006` | `Int8`, preference value in `0.1 %RH` |
| Temperature alarm upper limit | `0xFD22/0xE00A` | `Int16`, preference value in `0.1 C`, written as `value * 100` |
| Temperature alarm lower limit | `0xFD22/0xE00B` | `Int16`, preference value in `0.1 C`, written as `value * 100` |
| Humidity alarm upper limit | `0xFD22/0xE00C` | `Uint16`, whole `%RH`, written as `value * 100` |
| Humidity alarm lower limit | `0xFD22/0xE00D` | `Uint16`, whole `%RH`, written as `value * 100` |

`0xFD22/0xE00E` maps to the standard `temperatureAlarm` capability:

- normal -> `cleared`
- low temperature alarm -> `freeze`
- high temperature alarm -> `heat`

`0xFD22/0xE00F` is logged for diagnosis only. SmartThings has no suitable
standard capability for a separate humidity alarm state. The thresholds remain
configurable and users can create routines from standard humidity measurements.

The driver retains diagnostic logging of Zigbee LQI and RSSI, but does not
surface either as a custom user-facing capability. The driver uses no Custom
Capabilities.

## Data Flow and Validation

On installation and refresh, the sub-driver reads standard measurements and
all relevant `0xFD22` attributes. Attribute reports update standard events,
persisted field values, and preference synchronization as appropriate.

When a setting changes, the lifecycle handler normalizes to device-supported
precision before sending a write. It validates paired alarm limits using the
latest cached value. If a proposed upper limit is less than or equal to the
lower limit, it is clamped to one device step above the lower limit; conversely,
a proposed lower limit is clamped to one device step below the upper limit.
The effective raw value is cached and read back from the device. Edge drivers
cannot overwrite the app-owned preference value, so the Settings input may
continue to display the submitted value after a paired-limit clamp.

Temperature settings use `0.1 C` increments. Humidity alarm settings use
whole-percent increments because the device accepts that precision. Unit
selection is written as a device setting; standard temperature measurement
continues to be emitted in Celsius and SmartThings performs presentation-unit
conversion.

## Implementation Boundaries

- Add a small `rtitek-sthzb` sub-driver with matching, lifecycle, report, and
preference-write handlers.
- Update only the Rti-Tek profile, the parent sub-driver registration, and
Rti-Tek tests in the official humidity-sensor package.
- Reuse the existing parent driver behavior for standard clusters unless the
device-specific sub-driver must override it.
- Do not add a top-level driver package, Custom Capability definitions, OTA
support, LQI/RSSI UI, or a separate humidity alarm card.

## Verification

Automated coverage must verify fingerprint matching, standard temperature,
humidity, and battery reports, refresh reads, each preference-to-FD22 write
conversion, paired-limit clamping, and all temperature-alarm mappings.

After local tests pass, package the official driver on a separate development
channel and assign it to the test hub. Validate pairing or driver reassignment,
reporting, refresh, every preference write and readback, invalid paired-limit
handling, temperature alarm transitions, and absence of Custom Capabilities in
the generated device profile. This local validation completes before any PR or
Console certification submission is advanced.
7 changes: 6 additions & 1 deletion drivers/SmartThings/zigbee-humidity-sensor/fingerprints.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
zigbeeManufacturer:
- id: "Rti-Tek/STHZB"
deviceLabel: Rti-Tek STHZB
manufacturer: Rti-Tek
model: STHZB
deviceProfileName: rtitek-sthzb
- id: "LUMI/lumi.sensor_ht.agl02"
deviceLabel: Aqara Temperature and Humidity Sensor T1
manufacturer: LUMI
Expand Down Expand Up @@ -153,4 +158,4 @@ zigbeeGeneric:
- 0x0B04
client:
- 0x0003
deviceProfileName: humidity-battery
deviceProfileName: humidity-battery
133 changes: 133 additions & 0 deletions drivers/SmartThings/zigbee-humidity-sensor/profiles/rtitek-sthzb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
name: rtitek-sthzb
components:
- id: main
capabilities:
- id: temperatureMeasurement
version: 1
- id: relativeHumidityMeasurement
version: 1
- id: battery
version: 1
- id: temperatureAlarm
version: 1
config:
values:
- key: "temperatureAlarm.value"
enabledValues:
- freeze
- heat
- cleared
- id: refresh
version: 1
categories:
- name: TempHumiditySensor
preferences:
- title: "Display temperature unit"
name: temperatureUnit
description: "Temperature unit used by the device display"
required: false
preferenceType: enumeration
definition:
options:
"0": "Celsius"
"1": "Fahrenheit"
default: "0"
- title: "Temperature calibration (C)"
name: temperatureCalibration
description: "Device measurement adjustment"
required: false
preferenceType: number
definition:
minimum: -10.0
maximum: 10.0
default: 0.0
- title: "Humidity calibration (%)"
name: humidityCalibration
description: "Device measurement adjustment"
required: false
preferenceType: number
definition:
minimum: -10.0
maximum: 10.0
default: 0.0
- title: "Temperature alarm upper limit (C)"
name: temperatureAlarmUpper
description: "Upper temperature alarm threshold"
required: false
preferenceType: number
definition:
minimum: -30.0
maximum: 60.0
default: 26.0
- title: "Temperature alarm lower limit (C)"
name: temperatureAlarmLower
description: "Lower temperature alarm threshold"
required: false
preferenceType: number
definition:
minimum: -30.0
maximum: 60.0
default: 20.0
- title: "Humidity alarm upper limit (%)"
name: humidityAlarmUpper
description: "Upper humidity alarm threshold"
required: false
preferenceType: integer
definition:
minimum: 0
maximum: 100
default: 60
- title: "Humidity alarm lower limit (%)"
name: humidityAlarmLower
description: "Lower humidity alarm threshold"
required: false
preferenceType: integer
definition:
minimum: 0
maximum: 100
default: 30
deviceConfig:
dashboard:
states:
- component: main
capability: temperatureMeasurement
version: 1
group: main
composite: true
- component: main
capability: relativeHumidityMeasurement
version: 1
group: main
values:
- label: " {{humidity.value}} {{humidity.unit}}"
composite: true
actions: []
basicPlus: []
detailView:
- component: main
capability: temperatureMeasurement
version: 1
- component: main
capability: relativeHumidityMeasurement
version: 1
- component: main
capability: battery
version: 1
- component: main
capability: temperatureAlarm
version: 1
- component: main
capability: refresh
version: 1
automation:
conditions:
- component: main
capability: temperatureMeasurement
version: 1
- component: main
capability: relativeHumidityMeasurement
version: 1
- component: main
capability: battery
version: 1
actions: []
4 changes: 3 additions & 1 deletion drivers/SmartThings/zigbee-humidity-sensor/src/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ local zigbee_humidity_driver = {
supported_capabilities = {
capabilities.battery,
capabilities.relativeHumidityMeasurement,
capabilities.temperatureMeasurement
capabilities.temperatureMeasurement,
capabilities.temperatureAlarm,
capabilities.refresh,
},
zigbee_handlers = {
attr = {
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 function can_handle_rtitek_sthzb(opts, driver, device)
if device:get_manufacturer() == "Rti-Tek" and device:get_model() == "STHZB" then
return true, require("rtitek-sthzb")
end
return false
end

return can_handle_rtitek_sthzb
Loading