Skip to content

Commit

Permalink
Adds on off cluster in zap
Browse files Browse the repository at this point in the history
  • Loading branch information
shgutte committed Dec 6, 2024
1 parent 85bf162 commit 47a68bc
Show file tree
Hide file tree
Showing 4 changed files with 469 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,78 @@ cluster Identify = 3 {
command access(invoke: manage) TriggerEffect(TriggerEffectRequest): DefaultSuccess = 64;
}

/** Attributes and commands for switching devices between 'On' and 'Off' states. */
cluster OnOff = 6 {
revision 6;

enum DelayedAllOffEffectVariantEnum : enum8 {
kDelayedOffFastFade = 0;
kNoFade = 1;
kDelayedOffSlowFade = 2;
}

enum DyingLightEffectVariantEnum : enum8 {
kDyingLightFadeOff = 0;
}

enum EffectIdentifierEnum : enum8 {
kDelayedAllOff = 0;
kDyingLight = 1;
}

enum StartUpOnOffEnum : enum8 {
kOff = 0;
kOn = 1;
kToggle = 2;
}

bitmap Feature : bitmap32 {
kLighting = 0x1;
kDeadFrontBehavior = 0x2;
kOffOnly = 0x4;
}

bitmap OnOffControlBitmap : bitmap8 {
kAcceptOnlyWhenOn = 0x1;
}

readonly attribute boolean onOff = 0;
readonly attribute optional boolean globalSceneControl = 16384;
attribute optional int16u onTime = 16385;
attribute optional int16u offWaitTime = 16386;
attribute access(write: manage) optional nullable StartUpOnOffEnum startUpOnOff = 16387;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
readonly attribute event_id eventList[] = 65530;
readonly attribute attrib_id attributeList[] = 65531;
readonly attribute bitmap32 featureMap = 65532;
readonly attribute int16u clusterRevision = 65533;

request struct OffWithEffectRequest {
EffectIdentifierEnum effectIdentifier = 0;
enum8 effectVariant = 1;
}

request struct OnWithTimedOffRequest {
OnOffControlBitmap onOffControl = 0;
int16u onTime = 1;
int16u offWaitTime = 2;
}

/** On receipt of this command, a device SHALL enter its ‘Off’ state. This state is device dependent, but it is recommended that it is used for power off or similar functions. On receipt of the Off command, the OnTime attribute SHALL be set to 0. */
command Off(): DefaultSuccess = 0;
/** On receipt of this command, a device SHALL enter its ‘On’ state. This state is device dependent, but it is recommended that it is used for power on or similar functions. On receipt of the On command, if the value of the OnTime attribute is equal to 0, the device SHALL set the OffWaitTime attribute to 0. */
command On(): DefaultSuccess = 1;
/** On receipt of this command, if a device is in its ‘Off’ state it SHALL enter its ‘On’ state. Otherwise, if it is in its ‘On’ state it SHALL enter its ‘Off’ state. On receipt of the Toggle command, if the value of the OnOff attribute is equal to FALSE and if the value of the OnTime attribute is equal to 0, the device SHALL set the OffWaitTime attribute to 0. If the value of the OnOff attribute is equal to TRUE, the OnTime attribute SHALL be set to 0. */
command Toggle(): DefaultSuccess = 2;
/** The OffWithEffect command allows devices to be turned off using enhanced ways of fading. */
command OffWithEffect(OffWithEffectRequest): DefaultSuccess = 64;
/** The OnWithRecallGlobalScene command allows the recall of the settings when the device was turned off. */
command OnWithRecallGlobalScene(): DefaultSuccess = 65;
/** The OnWithTimedOff command allows devices to be turned on for a specific duration with a guarded off duration so that SHOULD the device be subsequently switched off, further OnWithTimedOff commands, received during this time, are prevented from turning the devices back on. */
command OnWithTimedOff(OnWithTimedOffRequest): DefaultSuccess = 66;
}

/** The Descriptor Cluster is meant to replace the support from the Zigbee Device Object (ZDO) for describing a node, its endpoints and clusters. */
cluster Descriptor = 29 {
revision 2;
Expand Down Expand Up @@ -1889,6 +1961,20 @@ endpoint 1 {
handle command Identify;
}

server cluster OnOff {
ram attribute onOff default = 0;
callback attribute generatedCommandList;
callback attribute acceptedCommandList;
callback attribute eventList;
callback attribute attributeList;
ram attribute featureMap default = 0;
ram attribute clusterRevision default = 6;

handle command Off;
handle command On;
handle command Toggle;
}

server cluster Descriptor {
callback attribute deviceTypeList;
callback attribute serverList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3067,6 +3067,154 @@
}
]
},
{
"name": "On/Off",
"code": 6,
"mfgCode": null,
"define": "ON_OFF_CLUSTER",
"side": "server",
"enabled": 1,
"commands": [
{
"name": "Off",
"code": 0,
"mfgCode": null,
"source": "client",
"isIncoming": 1,
"isEnabled": 1
},
{
"name": "On",
"code": 1,
"mfgCode": null,
"source": "client",
"isIncoming": 1,
"isEnabled": 1
},
{
"name": "Toggle",
"code": 2,
"mfgCode": null,
"source": "client",
"isIncoming": 1,
"isEnabled": 1
}
],
"attributes": [
{
"name": "OnOff",
"code": 0,
"mfgCode": null,
"side": "server",
"type": "boolean",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "GeneratedCommandList",
"code": 65528,
"mfgCode": null,
"side": "server",
"type": "array",
"included": 1,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "AcceptedCommandList",
"code": 65529,
"mfgCode": null,
"side": "server",
"type": "array",
"included": 1,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "EventList",
"code": 65530,
"mfgCode": null,
"side": "server",
"type": "array",
"included": 1,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "AttributeList",
"code": 65531,
"mfgCode": null,
"side": "server",
"type": "array",
"included": 1,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "FeatureMap",
"code": 65532,
"mfgCode": null,
"side": "server",
"type": "bitmap32",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "ClusterRevision",
"code": 65533,
"mfgCode": null,
"side": "server",
"type": "int16u",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "6",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
}
]
},
{
"name": "Descriptor",
"code": 29,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,78 @@ cluster Identify = 3 {
command access(invoke: manage) TriggerEffect(TriggerEffectRequest): DefaultSuccess = 64;
}

/** Attributes and commands for switching devices between 'On' and 'Off' states. */
cluster OnOff = 6 {
revision 6;

enum DelayedAllOffEffectVariantEnum : enum8 {
kDelayedOffFastFade = 0;
kNoFade = 1;
kDelayedOffSlowFade = 2;
}

enum DyingLightEffectVariantEnum : enum8 {
kDyingLightFadeOff = 0;
}

enum EffectIdentifierEnum : enum8 {
kDelayedAllOff = 0;
kDyingLight = 1;
}

enum StartUpOnOffEnum : enum8 {
kOff = 0;
kOn = 1;
kToggle = 2;
}

bitmap Feature : bitmap32 {
kLighting = 0x1;
kDeadFrontBehavior = 0x2;
kOffOnly = 0x4;
}

bitmap OnOffControlBitmap : bitmap8 {
kAcceptOnlyWhenOn = 0x1;
}

readonly attribute boolean onOff = 0;
readonly attribute optional boolean globalSceneControl = 16384;
attribute optional int16u onTime = 16385;
attribute optional int16u offWaitTime = 16386;
attribute access(write: manage) optional nullable StartUpOnOffEnum startUpOnOff = 16387;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
readonly attribute event_id eventList[] = 65530;
readonly attribute attrib_id attributeList[] = 65531;
readonly attribute bitmap32 featureMap = 65532;
readonly attribute int16u clusterRevision = 65533;

request struct OffWithEffectRequest {
EffectIdentifierEnum effectIdentifier = 0;
enum8 effectVariant = 1;
}

request struct OnWithTimedOffRequest {
OnOffControlBitmap onOffControl = 0;
int16u onTime = 1;
int16u offWaitTime = 2;
}

/** On receipt of this command, a device SHALL enter its ‘Off’ state. This state is device dependent, but it is recommended that it is used for power off or similar functions. On receipt of the Off command, the OnTime attribute SHALL be set to 0. */
command Off(): DefaultSuccess = 0;
/** On receipt of this command, a device SHALL enter its ‘On’ state. This state is device dependent, but it is recommended that it is used for power on or similar functions. On receipt of the On command, if the value of the OnTime attribute is equal to 0, the device SHALL set the OffWaitTime attribute to 0. */
command On(): DefaultSuccess = 1;
/** On receipt of this command, if a device is in its ‘Off’ state it SHALL enter its ‘On’ state. Otherwise, if it is in its ‘On’ state it SHALL enter its ‘Off’ state. On receipt of the Toggle command, if the value of the OnOff attribute is equal to FALSE and if the value of the OnTime attribute is equal to 0, the device SHALL set the OffWaitTime attribute to 0. If the value of the OnOff attribute is equal to TRUE, the OnTime attribute SHALL be set to 0. */
command Toggle(): DefaultSuccess = 2;
/** The OffWithEffect command allows devices to be turned off using enhanced ways of fading. */
command OffWithEffect(OffWithEffectRequest): DefaultSuccess = 64;
/** The OnWithRecallGlobalScene command allows the recall of the settings when the device was turned off. */
command OnWithRecallGlobalScene(): DefaultSuccess = 65;
/** The OnWithTimedOff command allows devices to be turned on for a specific duration with a guarded off duration so that SHOULD the device be subsequently switched off, further OnWithTimedOff commands, received during this time, are prevented from turning the devices back on. */
command OnWithTimedOff(OnWithTimedOffRequest): DefaultSuccess = 66;
}

/** The Descriptor Cluster is meant to replace the support from the Zigbee Device Object (ZDO) for describing a node, its endpoints and clusters. */
cluster Descriptor = 29 {
revision 2;
Expand Down Expand Up @@ -1796,6 +1868,20 @@ endpoint 1 {
handle command Identify;
}

server cluster OnOff {
ram attribute onOff default = 0;
callback attribute generatedCommandList;
callback attribute acceptedCommandList;
callback attribute eventList;
callback attribute attributeList;
ram attribute featureMap default = 0;
ram attribute clusterRevision default = 6;

handle command Off;
handle command On;
handle command Toggle;
}

server cluster Descriptor {
callback attribute deviceTypeList;
callback attribute serverList;
Expand Down
Loading

0 comments on commit 47a68bc

Please sign in to comment.