From c4b589b002f5e72770e654cb8e83a10b25428437 Mon Sep 17 00:00:00 2001 From: Bob van de Vijver Date: Fri, 18 Sep 2026 14:59:45 +0200 Subject: [PATCH] Add onOffSwitch cluster attributes --- index.d.ts | 5 ++++- lib/clusters/onOffSwitch.js | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/index.d.ts b/index.d.ts index 3c3a66f..0947555 100644 --- a/index.d.ts +++ b/index.d.ts @@ -315,7 +315,10 @@ declare module "zigbee-clusters" { }, ): Promise; } - type OnOffSwitchClusterAttributes = Record; + type OnOffSwitchClusterAttributes = { + switchType: { id: 0x00, type: ZCLDataType<"toggle" | "momentary" | "multifunction"> }, + switchActions: { id: 0x10, type: ZCLDataType<"onOff" | "offOn" | "toggle"> }, + }; type OnOffSwitchClusterCommands = Record; class OnOffSwitchCluster extends Cluster { } diff --git a/lib/clusters/onOffSwitch.js b/lib/clusters/onOffSwitch.js index 2d188ab..81a3219 100644 --- a/lib/clusters/onOffSwitch.js +++ b/lib/clusters/onOffSwitch.js @@ -1,8 +1,12 @@ 'use strict'; const Cluster = require('../Cluster'); +const { ZCLDataTypes } = require('../zclTypes'); -const ATTRIBUTES = {}; +const ATTRIBUTES = { + switchType: { id: 0, type: ZCLDataTypes.enum8({ toggle: 0, momentary: 1, multifunction: 2 }) }, + switchActions: { id: 16, type: ZCLDataTypes.enum8({ onOff: 0, offOn: 1, toggle: 2 }) }, +}; const COMMANDS = {};