Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Closures & Security Clusters

Clusters for physical access control (door locks, window coverings) and intrusion detection (IAS zones).


Door Lock (0x0101)

Full-featured door lock with PIN code management, auto-relock, and operating modes.

Attributes

AttributeIDTypeAccessDescription
LockState0x0000Enum8Report0=NotFullyLocked, 1=Locked, 2=Unlocked
LockType0x0001Enum8ReadDeadBolt(0), Magnetic(1), Other(2), etc.
ActuatorEnabled0x0002BoolReadActuator operational
DoorState0x0003Enum8ReportOpen(0), Closed(1), Jammed(2), etc.
DoorOpenEvents0x0004U32R/WDoor-open counter
DoorClosedEvents0x0005U32R/WDoor-close counter
OpenPeriod0x0006U16R/WAuto-close period
NumPINUsersSupported0x0012U16ReadMax PIN users
MaxPINCodeLength0x0017U8ReadMax PIN length (default 8)
MinPINCodeLength0x0018U8ReadMin PIN length (default 4)
Language0x0021StringR/WDisplay language
AutoRelockTime0x0023U32R/WAuto-relock delay in seconds
OperatingMode0x0025Enum8R/WNormal(0), Vacation(1), Privacy(2), etc.

Commands (Client → Server)

IDCommandDescription
0x00LockDoorLock the door
0x01UnlockDoorUnlock (starts auto-relock timer)
0x02ToggleToggle lock/unlock
0x03UnlockWithTimeoutUnlock with auto-relock
0x05SetPINCodeSet user PIN
0x06GetPINCodeRetrieve user PIN
0x07ClearPINCodeDelete a user’s PIN
0x08ClearAllPINCodesDelete all PINs
0x09SetUserStatusEnable/disable a user
0x0AGetUserStatusQuery user status

Auto-Relock

When AutoRelockTime is non-zero, unlocking the door starts a countdown. The tick() method (call every second) decrements the timer and automatically locks when it expires:

#![allow(unused)]
fn main() {
use zigbee_zcl::clusters::door_lock::DoorLockCluster;

let mut lock = DoorLockCluster::new(0x00); // DeadBolt type
lock.set_lock_state(0x01); // Locked

// When UnlockDoor command arrives, the cluster:
// 1. Sets LockState = Unlocked
// 2. Reads AutoRelockTime attribute
// 3. Starts countdown in auto_relock_remaining

// In your 1-second timer:
lock.tick(); // When countdown reaches 0 → auto-locks
}

PIN Code Management

PINs are stored in a fixed-capacity table (8 entries):

#![allow(unused)]
fn main() {
// SetPINCode payload: user_id(2) + status(1) + type(1) + pin_len(1) + pin[]
// The cluster stores: { status, user_type, pin: Vec<u8, 8> }

// PinEntry fields:
//   status: 0=available, 1=occupied_enabled, 3=occupied_disabled
//   user_type: 0=unrestricted, 1=year_day, 2=week_day, 3=master
}

Window Covering (0x0102)

Controls roller shades, blinds, awnings, and other window treatments.

Attributes

AttributeIDTypeAccessDescription
WindowCoveringType0x0000Enum8ReadCovering type
ConfigStatus0x0007Bitmap8ReadConfiguration flags
CurrentPositionLiftPercentage0x0008U8ReportLift position (0–100%)
CurrentPositionTiltPercentage0x0009U8ReportTilt position (0–100%)
InstalledOpenLimitLift0x0010U16ReadOpen limit
InstalledClosedLimitLift0x0011U16ReadClosed limit
Mode0x0017Bitmap8R/WOperating mode flags

Covering Types

ValueType
0x00Roller Shade
0x04Drapery
0x05Awning
0x06Shutter
0x07Tilt Blind (tilt only)
0x08Tilt Blind (lift + tilt)
0x09Projector Screen

Commands

IDCommand
0x00UpOpen
0x01DownClose
0x02Stop
0x05GoToLiftPercentage
0x08GoToTiltPercentage
#![allow(unused)]
fn main() {
use zigbee_zcl::clusters::window_covering::WindowCoveringCluster;

let covering = WindowCoveringCluster::new(0x00); // Roller shade
}

IAS Zone (0x0500)

The primary security cluster for intrusion/alarm sensors. Implements a state machine for zone enrollment with a CIE (Control and Indicating Equipment).

Attributes

AttributeIDTypeAccessDescription
ZoneState0x0000Enum8ReadNotEnrolled(0) / Enrolled(1)
ZoneType0x0001Enum16ReadSensor type code
ZoneStatus0x0002Bitmap16ReadAlarm and tamper bits
IAS_CIE_Address0x0010IEEER/WCIE’s IEEE address
ZoneID0x0011U8ReadAssigned zone ID
NumZoneSensitivityLevels0x0012U8ReadSupported sensitivity levels
CurrentZoneSensitivityLevel0x0013U8R/WActive sensitivity

Zone Types

ValueType
0x0000Standard CIE
0x000DMotion Sensor
0x0015Contact Switch
0x0028Fire Sensor
0x002AWater Sensor
0x002BCO Sensor
0x002DPersonal Emergency
0x010FRemote Control
0x0115Key Fob
0x021DKeypad
0x0225Standard Warning

Zone Status Bits

BitMeaning
0Alarm1 (zone-type specific)
1Alarm2 (zone-type specific)
2Tamper
3Battery low
4Supervision reports
5Restore reports
6Trouble
7AC (mains) fault

Enrollment Flow

Device                           CIE
  │                               │
  │  Write IAS_CIE_Address ◄──────┤
  │                               │
  ├──── Zone Enroll Request ─────►│
  │     (zone_type + mfr_code)    │
  │                               │
  │  Zone Enroll Response ◄───────┤
  │  (status=0x00, zone_id)       │
  │                               │
  │  [ZoneState → Enrolled]       │
  │                               │
  ├── Zone Status Change Notif ──►│
  │   (alarm bits + zone_id)      │

Usage

#![allow(unused)]
fn main() {
use zigbee_zcl::clusters::ias_zone::*;

// Motion sensor
let mut zone = IasZoneCluster::new(ZONE_TYPE_MOTION_SENSOR);

// CIE writes its address during setup:
zone.set_cie_address(0x00124B0012345678);

// Build enrollment request to send to CIE:
let enroll_payload = zone.build_zone_enroll_request(0x1234); // mfr code

// After CIE responds with ZoneEnrollResponse(success, zone_id=5):
// handle_command() sets ZoneState=Enrolled, ZoneID=5

// When motion detected:
zone.set_zone_status(0x0001); // Alarm1
let notif = zone.build_zone_status_change_notification();
// Send as cluster-specific command 0x00 (server→client)

// Check enrollment:
if zone.is_enrolled() {
    // Device is enrolled and can send notifications
}
}

IAS ACE (0x0501)

Ancillary Control Equipment — keypads and panic buttons.

#![allow(unused)]
fn main() {
use zigbee_zcl::clusters::ias_ace; // IasAceCluster
}

IAS WD (0x0502)

Warning Device — sirens and strobes.

#![allow(unused)]
fn main() {
use zigbee_zcl::clusters::ias_wd; // IasWdCluster
}