Locks, closures, HVAC and lighting59 — Switch

Matter Cluster 59 — Switch

Matter Cluster 59 (0x003B) Switch: attributes, commands, events, data types, shadow paths and bridge payload examples.

Matter Cluster 59 — Switch Cluster

Matter Cluster 59, also written as 0x003B, is the Switch Cluster. This cluster exposes interactions with a switch device, for the purpose of using those interactions by other devices. Two types of switch devices are supported: latching switch (e.g. rocker switch) and momentary switch (e.g. push button), distinguished with their feature flags. Interactions with the switch device are exposed as attributes (for the latching switch) and as events (for both types of switches).

Cluster Identity

FieldValue
Cluster ID decimal59
Cluster ID hex0x003B
Cluster nameSwitch
Cluster revision (Matter 1.6.1)2
Roleapplication
ScopeEndpoint
PICS codeSWTCH
Typical endpoint1

Revision history

RevisionChange
1Initial revision
2Behavior clarifications for ambiguous combinations of events; Introduction of TotalNumberOfPressesCounted == 0 when MultiPressMax is exceeded; Introduction of ActionSwitch feature flag.

Shadow Path Format

Cluster 59 values in the device shadow use this format:

endpoint_id / 59 / attribute_id

Example:

{
  "1/59/0": 2
}
PartMeaning
1Endpoint ID
59Switch cluster
0NumberOfPositions attribute

Cluster 59 Features

The FeatureMap attribute (1/59/65532) is a bitmap. Each bit set means the device implements that feature and the attributes and commands that depend on it.

BitCodeFeatureConformanceMeaning
0LSLatchingSwitchOSwitch is latching
1MSMomentarySwitchOSwitch is momentary
2MSRMomentarySwitchRelease[MS & !AS]Switch supports release events generation
3MSLMomentarySwitchLongPress[MS & MSR | AS]Switch supports long press detection
4MSMMomentarySwitchMultiPressAS, [MS & MSR]Switch supports multi-press detection
5ASActionSwitch[MS]Switch is momentary, targeted at specific user actions (focus on multi-press and optionally long press) with a reduced event generation scheme

Example: FeatureMap = 0 means no optional feature is enabled; 63 means every feature listed above is enabled.


Cluster 59 Attributes

Cluster 59 defines 3 attributes plus the global attributes. Conformance: M mandatory, O optional, a feature code means "mandatory when that feature is present", square brackets mean "optional when …".

IDHexAttributeTypeConformanceAccessQualitiesDefault
00x0000NumberOfPositionsuint8MR (read: view)——
10x0001CurrentPositionuint8MR (read: view)persisted—
20x0002MultiPressMaxuint8MSMR (read: view)——

Global attributes

IDHexAttributeMeaning
655280xFFF8GeneratedCommandListResponse command IDs this server generates.
655290xFFF9AcceptedCommandListCommand IDs this server accepts.
655310xFFFBAttributeListAttribute IDs implemented.
655320xFFFCFeatureMapImplemented optional features (see above).
655330xFFFDClusterRevisionCluster revision implemented; 2 for a Matter 1.6.1 device.

Attribute Details

Attribute 0 / 0x0000 — NumberOfPositions

Path example:

1/59/0

Indicates the maximum number of positions the switch has. Any kind of switch has a minimum of 2 positions.

PropertyValue
Typeuint8
ConformanceM
AccessR (read: view)
Constraintmin 2

Example:

{
  "1/59/0": 2
}

Attribute 1 / 0x0001 — CurrentPosition

Path example:

1/59/1

Indicates the position of the switch. The valid range is zero to NumberOfPositions - 1. CurrentPosition value 0 is assigned to the default position of the switch: for example the "open" state of a rocker switch, or the "idle" state of a push button switch.

PropertyValue
Typeuint8
ConformanceM
AccessR (read: view)
Qualitiespersisted
Constraintmax compute

Example:

{
  "1/59/1": 1
}

Attribute 2 / 0x0002 — MultiPressMax

Path example:

1/59/2

Indicates how many consecutive presses can be detected and reported by a momentary switch which supports multi-press (MSM feature flag set). For example, a momentary switch supporting single press, double press and triple press, but not quad press and beyond, would return the value 3.

PropertyValue
Typeuint8
ConformanceMSM
AccessR (read: view)
Constraintmin 2

Example:

{
  "1/59/2": 2
}

Cluster 59 Commands

Cluster 59 defines no commands. It is read (and, for writable attributes, written) through attribute access only.

Cluster 59 Events

IDHexEventPriorityConformanceDescription
00x00SwitchLatchedinfoLSThis event is generated, when the latching switch is moved to a new position.
10x01InitialPressinfoMSThis event is generated, when the momentary switch starts to be pressed (after debouncing).
20x02LongPressinfoMSLThis event is generated when the momentary switch has been pressed for a "long" time.
30x03ShortReleaseinfoMSRIf the server has the Action Switch (AS) feature flag set, this event must NOT be generated at all, since setting the Action Switch feature flag forbids the Momentary Switch ShortRelease (MSR) …
40x04LongReleaseinfoMSLThis event is generated, when the momentary switch has been released (after debouncing) and after having been pressed for a long time, i.e. this event is generated when the switch is released if a …
50x05MultiPressOngoinginfoMSM & !ASIf the server has the Action Switch (AS) feature flag set, this event must NOT be generated at all.
60x06MultiPressCompleteinfoMSMThis event is generated to indicate how many times the momentary switch has been pressed in a multi-press sequence, after it has been detected that the sequence has ended. 13.8, "Sequence of events …

Event 0 — SwitchLatched

This event is generated, when the latching switch is moved to a new position. It may have been delayed by debouncing within the switch.

IDFieldTypeConformanceMeaning
0NewPositionuint8MIndicates the new value of the CurrentPosition attribute, i.e. after the move.

Event 1 — InitialPress

This event is generated, when the momentary switch starts to be pressed (after debouncing).

IDFieldTypeConformanceMeaning
0NewPositionuint8MIndicates the new value of the CurrentPosition attribute, i.e. while pressed.

Event 2 — LongPress

This event is generated when the momentary switch has been pressed for a "long" time.

IDFieldTypeConformanceMeaning
0NewPositionuint8MIndicates the new value of the CurrentPosition attribute, i.e. while pressed.

Event 3 — ShortRelease

If the server has the Action Switch (AS) feature flag set, this event must NOT be generated at all, since setting the Action Switch feature flag forbids the Momentary Switch ShortRelease (MSR) feature flag from being set. Otherwise, the following paragraphs describe the situations where this event is generated.

IDFieldTypeConformanceMeaning
0PreviousPositionuint8MIndicates the previous value of the CurrentPosition attribute, i.e. just prior to release.

Event 4 — LongRelease

This event is generated, when the momentary switch has been released (after debouncing) and after having been pressed for a long time, i.e. this event is generated when the switch is released if a LongPress event has been generated since the previous InitialPress event.

IDFieldTypeConformanceMeaning
0PreviousPositionuint8MIndicates the previous value of the CurrentPosition attribute, i.e. just prior to release.

Event 5 — MultiPressOngoing

If the server has the Action Switch (AS) feature flag set, this event must NOT be generated at all. Otherwise, the following paragraphs describe the situations where this event is generated. This event is generated to indicate how many times the momentary switch has been pressed in a multi-press sequence, during that sequence. 13.8, "Sequence of events for MultiPress".

IDFieldTypeConformanceMeaning
0NewPositionuint8MIndicates the new value of the CurrentPosition attribute, i.e. while pressed.
1CurrentNumberOfPressesCounteduint8MThis field contains: - a value of 2 when the second press of a multi-press sequence has been detected, - a value of 3 when the third press of a multi-press sequence has been detected, - a value of N when the N^th press of a multi-press sequence has been …

Event 6 — MultiPressComplete

This event is generated to indicate how many times the momentary switch has been pressed in a multi-press sequence, after it has been detected that the sequence has ended. 13.8, "Sequence of events for MultiPress". The PreviousPosition field indicates the previous value of the CurrentPosition attribute, i.e. just prior to release.

IDFieldTypeConformanceMeaning
0PreviousPositionuint8M—
1TotalNumberOfPressesCounteduint8M—

SmartphoneKey Notes

  • Cluster 59 is not currently exposed by SmartphoneKey devices. This page documents the Matter 1.6.1 specification so that future devices can be interpreted without changes to the backend.
  • Shadow paths follow endpoint/59/attribute; attribute values that the device reports as unreadable are written as n/a.
  • Attribute IDs, command IDs and enum values on this page come from the CSA Matter 1.6.1 data model; descriptions are condensed from the specification text.