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).

An interested client may subscribe to these attributes/events and thus be informed of the interactions, and can perform actions based on this, for example by sending commands to perform an action such as controlling a light or a window shade.

Per the Matter specification you cannot use SwitchCluster without enabling certain feature combinations. You must use the with factory method to obtain a working cluster.

MatterSpecification.v13.Cluster § 1.13

interface Cluster {
    id: ClusterId;
    name: string;
    with: (<const SelectionT>(...selection: SelectionT) => Of<Of<{
        attributes: {
            currentPosition: Attribute<number, any>;
            numberOfPositions: FixedAttribute<number, any>;
        };
        extensions: readonly [{
            component: {
                attributes: {
                    multiPressMax: FixedAttribute<number, any>;
                };
                events: {
                    multiPressComplete: Event<TypeFromFields<{
                        previousPosition: ...;
                        totalNumberOfPressesCounted: ...;
                    }>, any>;
                    multiPressOngoing: Event<TypeFromFields<{
                        currentNumberOfPressesCounted: ...;
                        newPosition: ...;
                    }>, any>;
                };
            };
            flags: {
                momentarySwitchMultiPress: true;
            };
        }, {
            component: {
                events: {
                    switchLatched: Event<TypeFromFields<{
                        newPosition: ...;
                    }>, any>;
                };
            };
            flags: {
                latchingSwitch: true;
            };
        }, {
            component: {
                events: {
                    initialPress: Event<TypeFromFields<{
                        newPosition: ...;
                    }>, any>;
                };
            };
            flags: {
                momentarySwitch: true;
            };
        }, {
            component: {
                events: {
                    longPress: Event<TypeFromFields<{
                        newPosition: ...;
                    }>, any>;
                    longRelease: Event<TypeFromFields<{
                        previousPosition: ...;
                    }>, any>;
                };
            };
            flags: {
                momentarySwitchLongPress: true;
            };
        }, {
            component: {
                events: {
                    shortRelease: Event<TypeFromFields<{
                        previousPosition: ...;
                    }>, any>;
                };
            };
            flags: {
                momentarySwitchRelease: true;
            };
        }, {
            component: false;
            flags: {
                momentarySwitch: false;
                momentarySwitchRelease: true;
            };
        }, {
            component: false;
            flags: {
                momentarySwitch: false;
                momentarySwitchLongPress: true;
            };
        }, {
            component: false;
            flags: {
                momentarySwitchLongPress: true;
                momentarySwitchRelease: false;
            };
        }, {
            component: false;
            flags: {
                momentarySwitch: false;
                momentarySwitchMultiPress: true;
            };
        }, {
            component: false;
            flags: {
                momentarySwitchMultiPress: true;
                momentarySwitchRelease: false;
            };
        }, {
            component: false;
            flags: {
                latchingSwitch: true;
                momentarySwitch: true;
            };
        }, {
            component: false;
            flags: {
                latchingSwitch: false;
                momentarySwitch: false;
            };
        }];
        features: {
            latchingSwitch: BitFlag;
            momentarySwitch: BitFlag;
            momentarySwitchLongPress: BitFlag;
            momentarySwitchMultiPress: BitFlag;
            momentarySwitchRelease: BitFlag;
        };
        id: 59;
        name: "Switch";
        revision: 1;
    }>, SelectionT>);
}

Hierarchy (view full)

Properties

Properties

name: string
with: (<const SelectionT>(...selection: SelectionT) => Of<Of<{
    attributes: {
        currentPosition: Attribute<number, any>;
        numberOfPositions: FixedAttribute<number, any>;
    };
    extensions: readonly [{
        component: {
            attributes: {
                multiPressMax: FixedAttribute<number, any>;
            };
            events: {
                multiPressComplete: Event<TypeFromFields<{
                    previousPosition: ...;
                    totalNumberOfPressesCounted: ...;
                }>, any>;
                multiPressOngoing: Event<TypeFromFields<{
                    currentNumberOfPressesCounted: ...;
                    newPosition: ...;
                }>, any>;
            };
        };
        flags: {
            momentarySwitchMultiPress: true;
        };
    }, {
        component: {
            events: {
                switchLatched: Event<TypeFromFields<{
                    newPosition: ...;
                }>, any>;
            };
        };
        flags: {
            latchingSwitch: true;
        };
    }, {
        component: {
            events: {
                initialPress: Event<TypeFromFields<{
                    newPosition: ...;
                }>, any>;
            };
        };
        flags: {
            momentarySwitch: true;
        };
    }, {
        component: {
            events: {
                longPress: Event<TypeFromFields<{
                    newPosition: ...;
                }>, any>;
                longRelease: Event<TypeFromFields<{
                    previousPosition: ...;
                }>, any>;
            };
        };
        flags: {
            momentarySwitchLongPress: true;
        };
    }, {
        component: {
            events: {
                shortRelease: Event<TypeFromFields<{
                    previousPosition: ...;
                }>, any>;
            };
        };
        flags: {
            momentarySwitchRelease: true;
        };
    }, {
        component: false;
        flags: {
            momentarySwitch: false;
            momentarySwitchRelease: true;
        };
    }, {
        component: false;
        flags: {
            momentarySwitch: false;
            momentarySwitchLongPress: true;
        };
    }, {
        component: false;
        flags: {
            momentarySwitchLongPress: true;
            momentarySwitchRelease: false;
        };
    }, {
        component: false;
        flags: {
            momentarySwitch: false;
            momentarySwitchMultiPress: true;
        };
    }, {
        component: false;
        flags: {
            momentarySwitchMultiPress: true;
            momentarySwitchRelease: false;
        };
    }, {
        component: false;
        flags: {
            latchingSwitch: true;
            momentarySwitch: true;
        };
    }, {
        component: false;
        flags: {
            latchingSwitch: false;
            momentarySwitch: false;
        };
    }];
    features: {
        latchingSwitch: BitFlag;
        momentarySwitch: BitFlag;
        momentarySwitchLongPress: BitFlag;
        momentarySwitchMultiPress: BitFlag;
        momentarySwitchRelease: BitFlag;
    };
    id: 59;
    name: "Switch";
    revision: 1;
}>, SelectionT>)

Type declaration

    • <const SelectionT>(...selection): Of<Of<{
          attributes: {
              currentPosition: Attribute<number, any>;
              numberOfPositions: FixedAttribute<number, any>;
          };
          extensions: readonly [{
              component: {
                  attributes: {
                      multiPressMax: FixedAttribute<number, any>;
                  };
                  events: {
                      multiPressComplete: Event<TypeFromFields<{
                          previousPosition: ...;
                          totalNumberOfPressesCounted: ...;
                      }>, any>;
                      multiPressOngoing: Event<TypeFromFields<{
                          currentNumberOfPressesCounted: ...;
                          newPosition: ...;
                      }>, any>;
                  };
              };
              flags: {
                  momentarySwitchMultiPress: true;
              };
          }, {
              component: {
                  events: {
                      switchLatched: Event<TypeFromFields<{
                          newPosition: ...;
                      }>, any>;
                  };
              };
              flags: {
                  latchingSwitch: true;
              };
          }, {
              component: {
                  events: {
                      initialPress: Event<TypeFromFields<{
                          newPosition: ...;
                      }>, any>;
                  };
              };
              flags: {
                  momentarySwitch: true;
              };
          }, {
              component: {
                  events: {
                      longPress: Event<TypeFromFields<{
                          newPosition: ...;
                      }>, any>;
                      longRelease: Event<TypeFromFields<{
                          previousPosition: ...;
                      }>, any>;
                  };
              };
              flags: {
                  momentarySwitchLongPress: true;
              };
          }, {
              component: {
                  events: {
                      shortRelease: Event<TypeFromFields<{
                          previousPosition: ...;
                      }>, any>;
                  };
              };
              flags: {
                  momentarySwitchRelease: true;
              };
          }, {
              component: false;
              flags: {
                  momentarySwitch: false;
                  momentarySwitchRelease: true;
              };
          }, {
              component: false;
              flags: {
                  momentarySwitch: false;
                  momentarySwitchLongPress: true;
              };
          }, {
              component: false;
              flags: {
                  momentarySwitchLongPress: true;
                  momentarySwitchRelease: false;
              };
          }, {
              component: false;
              flags: {
                  momentarySwitch: false;
                  momentarySwitchMultiPress: true;
              };
          }, {
              component: false;
              flags: {
                  momentarySwitchMultiPress: true;
                  momentarySwitchRelease: false;
              };
          }, {
              component: false;
              flags: {
                  latchingSwitch: true;
                  momentarySwitch: true;
              };
          }, {
              component: false;
              flags: {
                  latchingSwitch: false;
                  momentarySwitch: false;
              };
          }];
          features: {
              latchingSwitch: BitFlag;
              momentarySwitch: BitFlag;
              momentarySwitchLongPress: BitFlag;
              momentarySwitchMultiPress: BitFlag;
              momentarySwitchRelease: BitFlag;
          };
          id: 59;
          name: "Switch";
          revision: 1;
      }>, SelectionT>
    • Select features using ClusterComposer.compose.

      Type Parameters

      • const SelectionT extends FeatureSelection<Of<{
            attributes: {
                currentPosition: Attribute<number, any>;
                numberOfPositions: FixedAttribute<number, any>;
            };
            extensions: readonly [{
                component: {
                    attributes: {
                        multiPressMax: FixedAttribute<number, any>;
                    };
                    events: {
                        multiPressComplete: Event<TypeFromFields<{
                            previousPosition: ...;
                            totalNumberOfPressesCounted: ...;
                        }>, any>;
                        multiPressOngoing: Event<TypeFromFields<{
                            currentNumberOfPressesCounted: ...;
                            newPosition: ...;
                        }>, any>;
                    };
                };
                flags: {
                    momentarySwitchMultiPress: true;
                };
            }, {
                component: {
                    events: {
                        switchLatched: Event<TypeFromFields<{
                            newPosition: ...;
                        }>, any>;
                    };
                };
                flags: {
                    latchingSwitch: true;
                };
            }, {
                component: {
                    events: {
                        initialPress: Event<TypeFromFields<{
                            newPosition: ...;
                        }>, any>;
                    };
                };
                flags: {
                    momentarySwitch: true;
                };
            }, {
                component: {
                    events: {
                        longPress: Event<TypeFromFields<{
                            newPosition: ...;
                        }>, any>;
                        longRelease: Event<TypeFromFields<{
                            previousPosition: ...;
                        }>, any>;
                    };
                };
                flags: {
                    momentarySwitchLongPress: true;
                };
            }, {
                component: {
                    events: {
                        shortRelease: Event<TypeFromFields<{
                            previousPosition: ...;
                        }>, any>;
                    };
                };
                flags: {
                    momentarySwitchRelease: true;
                };
            }, {
                component: false;
                flags: {
                    momentarySwitch: false;
                    momentarySwitchRelease: true;
                };
            }, {
                component: false;
                flags: {
                    momentarySwitch: false;
                    momentarySwitchLongPress: true;
                };
            }, {
                component: false;
                flags: {
                    momentarySwitchLongPress: true;
                    momentarySwitchRelease: false;
                };
            }, {
                component: false;
                flags: {
                    momentarySwitch: false;
                    momentarySwitchMultiPress: true;
                };
            }, {
                component: false;
                flags: {
                    momentarySwitchMultiPress: true;
                    momentarySwitchRelease: false;
                };
            }, {
                component: false;
                flags: {
                    latchingSwitch: true;
                    momentarySwitch: true;
                };
            }, {
                component: false;
                flags: {
                    latchingSwitch: false;
                    momentarySwitch: false;
                };
            }];
            features: {
                latchingSwitch: BitFlag;
                momentarySwitch: BitFlag;
                momentarySwitchLongPress: BitFlag;
                momentarySwitchMultiPress: BitFlag;
                momentarySwitchRelease: BitFlag;
            };
            id: 59;
            name: "Switch";
            revision: 1;
        }>>

      Parameters

      Returns Of<Of<{
          attributes: {
              currentPosition: Attribute<number, any>;
              numberOfPositions: FixedAttribute<number, any>;
          };
          extensions: readonly [{
              component: {
                  attributes: {
                      multiPressMax: FixedAttribute<number, any>;
                  };
                  events: {
                      multiPressComplete: Event<TypeFromFields<{
                          previousPosition: ...;
                          totalNumberOfPressesCounted: ...;
                      }>, any>;
                      multiPressOngoing: Event<TypeFromFields<{
                          currentNumberOfPressesCounted: ...;
                          newPosition: ...;
                      }>, any>;
                  };
              };
              flags: {
                  momentarySwitchMultiPress: true;
              };
          }, {
              component: {
                  events: {
                      switchLatched: Event<TypeFromFields<{
                          newPosition: ...;
                      }>, any>;
                  };
              };
              flags: {
                  latchingSwitch: true;
              };
          }, {
              component: {
                  events: {
                      initialPress: Event<TypeFromFields<{
                          newPosition: ...;
                      }>, any>;
                  };
              };
              flags: {
                  momentarySwitch: true;
              };
          }, {
              component: {
                  events: {
                      longPress: Event<TypeFromFields<{
                          newPosition: ...;
                      }>, any>;
                      longRelease: Event<TypeFromFields<{
                          previousPosition: ...;
                      }>, any>;
                  };
              };
              flags: {
                  momentarySwitchLongPress: true;
              };
          }, {
              component: {
                  events: {
                      shortRelease: Event<TypeFromFields<{
                          previousPosition: ...;
                      }>, any>;
                  };
              };
              flags: {
                  momentarySwitchRelease: true;
              };
          }, {
              component: false;
              flags: {
                  momentarySwitch: false;
                  momentarySwitchRelease: true;
              };
          }, {
              component: false;
              flags: {
                  momentarySwitch: false;
                  momentarySwitchLongPress: true;
              };
          }, {
              component: false;
              flags: {
                  momentarySwitchLongPress: true;
                  momentarySwitchRelease: false;
              };
          }, {
              component: false;
              flags: {
                  momentarySwitch: false;
                  momentarySwitchMultiPress: true;
              };
          }, {
              component: false;
              flags: {
                  momentarySwitchMultiPress: true;
                  momentarySwitchRelease: false;
              };
          }, {
              component: false;
              flags: {
                  latchingSwitch: true;
                  momentarySwitch: true;
              };
          }, {
              component: false;
              flags: {
                  latchingSwitch: false;
                  momentarySwitch: false;
              };
          }];
          features: {
              latchingSwitch: BitFlag;
              momentarySwitch: BitFlag;
              momentarySwitchLongPress: BitFlag;
              momentarySwitchMultiPress: BitFlag;
              momentarySwitchRelease: BitFlag;
          };
          id: 59;
          name: "Switch";
          revision: 1;
      }>, SelectionT>