matterbridge
Version:
Matterbridge plugin manager for Matter
797 lines • 89.2 kB
TypeScript
/**
* This file contains the class MatterbridgeEndpoint that extends the Endpoint class from the Matter.js library.
*
* @file matterbridgeEndpoint.ts
* @author Luca Liguori
* @created 2024-10-01
* @version 2.1.1
* @license Apache-2.0
*
* Copyright 2024, 2025, 2026 Luca Liguori.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { ActionContext, AtLeastOne, Behavior, ClusterId, Endpoint, EndpointNumber, HandlerFunction, NamedHandler, ServerNode } from '@matter/main';
import { ClusterType, Semtag } from '@matter/main/types';
import { PowerSource } from '@matter/main/clusters/power-source';
import { Identify } from '@matter/main/clusters/identify';
import { OnOff } from '@matter/main/clusters/on-off';
import { ColorControl } from '@matter/main/clusters/color-control';
import { WindowCovering } from '@matter/main/clusters/window-covering';
import { FanControl } from '@matter/main/clusters/fan-control';
import { DoorLock } from '@matter/main/clusters/door-lock';
import { ModeSelect } from '@matter/main/clusters/mode-select';
import { ValveConfigurationAndControl } from '@matter/main/clusters/valve-configuration-and-control';
import { PumpConfigurationAndControl } from '@matter/main/clusters/pump-configuration-and-control';
import { SmokeCoAlarm } from '@matter/main/clusters/smoke-co-alarm';
import { AirQuality } from '@matter/main/clusters/air-quality';
import { ConcentrationMeasurement } from '@matter/main/clusters/concentration-measurement';
import { OperationalState } from '@matter/main/clusters/operational-state';
import { DeviceEnergyManagement } from '@matter/main/clusters/device-energy-management';
import { DeviceEnergyManagementMode } from '@matter/main/clusters/device-energy-management-mode';
import { ResourceMonitoring } from '@matter/main/clusters/resource-monitoring';
import { AnsiLogger, LogLevel } from './logger/export.js';
import { DeviceTypeDefinition, MatterbridgeEndpointOptions } from './matterbridgeDeviceTypes.js';
export type PrimitiveTypes = boolean | number | bigint | string | object | undefined | null;
export type CommandHandlerData = {
request: Record<string, any>;
cluster: string;
attributes: Record<string, PrimitiveTypes>;
endpoint: MatterbridgeEndpoint;
};
export type CommandHandlerFunction = (data: CommandHandlerData) => void | Promise<void>;
export interface MatterbridgeEndpointCommands {
identify: HandlerFunction;
triggerEffect: HandlerFunction;
on: HandlerFunction;
off: HandlerFunction;
toggle: HandlerFunction;
offWithEffect: HandlerFunction;
moveToLevel: HandlerFunction;
moveToLevelWithOnOff: HandlerFunction;
moveToColor: HandlerFunction;
moveColor: HandlerFunction;
stepColor: HandlerFunction;
moveToHue: HandlerFunction;
moveHue: HandlerFunction;
stepHue: HandlerFunction;
moveToSaturation: HandlerFunction;
moveSaturation: HandlerFunction;
stepSaturation: HandlerFunction;
moveToHueAndSaturation: HandlerFunction;
moveToColorTemperature: HandlerFunction;
upOrOpen: HandlerFunction;
downOrClose: HandlerFunction;
stopMotion: HandlerFunction;
goToLiftPercentage: HandlerFunction;
goToTiltPercentage: HandlerFunction;
lockDoor: HandlerFunction;
unlockDoor: HandlerFunction;
setpointRaiseLower: HandlerFunction;
step: HandlerFunction;
changeToMode: HandlerFunction;
open: HandlerFunction;
close: HandlerFunction;
suppressAlarm: HandlerFunction;
enableDisableAlarm: HandlerFunction;
selfTestRequest: HandlerFunction;
resetCounts: HandlerFunction;
setUtcTime: HandlerFunction;
setTimeZone: HandlerFunction;
setDstOffset: HandlerFunction;
pauseRequest: HandlerFunction;
resumeRequest: HandlerFunction;
pause: HandlerFunction;
stop: HandlerFunction;
start: HandlerFunction;
resume: HandlerFunction;
goHome: HandlerFunction;
selectAreas: HandlerFunction;
boost: HandlerFunction;
cancelBoost: HandlerFunction;
enableCharging: HandlerFunction;
disable: HandlerFunction;
powerAdjustRequest: HandlerFunction;
cancelPowerAdjustRequest: HandlerFunction;
setTemperature: HandlerFunction;
resetCondition: HandlerFunction;
}
export interface SerializedMatterbridgeEndpoint {
pluginName: string;
deviceName: string;
serialNumber: string;
uniqueId: string;
productId?: number;
productName?: string;
vendorId?: number;
vendorName?: string;
deviceTypes: DeviceTypeDefinition[];
endpoint: EndpointNumber | undefined;
endpointName: string;
clusterServersId: ClusterId[];
}
export declare class MatterbridgeEndpoint extends Endpoint {
/** The bridge mode of Matterbridge */
static bridgeMode: 'bridge' | 'childbridge' | '';
/** The default log level of the new MatterbridgeEndpoints */
static logLevel: LogLevel;
/**
* Activates a special mode for this endpoint.
* - 'server': it creates the device server node and add the device as Matter device that needs to be paired individually.
* In this case the bridge mode is not relevant. The device is autonomous. The main use case is a workaround for the Apple Home rvc issue.
*
* - 'matter': it adds the device directly to the bridge server node as Matter device. In this case the implementation must respect
* the 9.2.3. Disambiguation rule (i.e. use taglist if needed cause the device doesn't have nodeLabel).
* Furthermore the device will be a part of the bridge (i.e. will have the same name and will be in the same room).
* See 9.12.2.2. Native Matter functionality in Bridge.
*
* @remarks
* Always use createDefaultBasicInformationClusterServer() to create the BasicInformation cluster server.
*/
mode: 'server' | 'matter' | undefined;
/** The server node of the endpoint, if it is a single not bridged endpoint */
serverNode: ServerNode<ServerNode.RootEndpoint> | undefined;
/** The logger instance for the MatterbridgeEndpoint */
log: AnsiLogger;
/** The plugin name this MatterbridgeEndpoint belongs to */
plugin: string | undefined;
/** The configuration URL of the device, if available */
configUrl: string | undefined;
deviceName: string | undefined;
serialNumber: string | undefined;
uniqueId: string | undefined;
vendorId: number | undefined;
vendorName: string | undefined;
productId: number | undefined;
productName: string | undefined;
softwareVersion: number | undefined;
softwareVersionString: string | undefined;
hardwareVersion: number | undefined;
hardwareVersionString: string | undefined;
productUrl: string;
/** The name of the first device type of the endpoint (old api compatibility) */
name: string | undefined;
/** The code of the first device type of the endpoint (old api compatibility) */
deviceType: number | undefined;
/** The original id (with spaces and .) of the endpoint (old api compatibility) */
uniqueStorageKey: string | undefined;
tagList?: Semtag[];
/** Maps the DeviceTypeDefinitions with their code */
readonly deviceTypes: Map<number, DeviceTypeDefinition>;
/** Command handler for the MatterbridgeEndpoint commands */
readonly commandHandler: NamedHandler<MatterbridgeEndpointCommands>;
/**
* Represents a MatterbridgeEndpoint.
*
* @class MatterbridgeEndpoint
* @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The DeviceTypeDefinition(s) of the endpoint.
* @param {MatterbridgeEndpointOptions} [options] - The options for the device.
* @param {boolean} [debug] - Debug flag.
*/
constructor(definition: DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>, options?: MatterbridgeEndpointOptions, debug?: boolean);
/**
* Loads an instance of the MatterbridgeEndpoint class.
*
* @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The DeviceTypeDefinition(s) of the device.
* @param {MatterbridgeEndpointOptions} [options] - The options for the device.
* @param {boolean} [debug] - Debug flag.
* @returns {Promise<MatterbridgeEndpoint>} MatterbridgeEndpoint instance.
*/
static loadInstance(definition: DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>, options?: MatterbridgeEndpointOptions, debug?: boolean): Promise<MatterbridgeEndpoint>;
/**
* Get all the device types of this endpoint.
*
* @returns {DeviceTypeDefinition[]} The device types of this endpoint.
*/
getDeviceTypes(): DeviceTypeDefinition[];
/**
* Checks if the provided cluster server is supported by this endpoint.
*
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to check.
* @returns {boolean} True if the cluster server is supported, false otherwise.
*/
hasClusterServer(cluster: Behavior.Type | ClusterType | ClusterId | string): boolean;
/**
* Checks if the provided attribute server is supported for a given cluster of this endpoint.
*
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to check.
* @param {string} attribute - The attribute name to check.
* @returns {boolean} True if the attribute server is supported, false otherwise.
*/
hasAttributeServer(cluster: Behavior.Type | ClusterType | ClusterId | string, attribute: string): boolean;
/**
* Retrieves the initial options for the provided cluster server.
*
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to get options for.
* @returns {Record<string, boolean | number | bigint | string | object | null> | undefined} The options for the provided cluster server, or undefined if the cluster is not supported.
*/
getClusterServerOptions(cluster: Behavior.Type | ClusterType | ClusterId | string): Record<string, boolean | number | bigint | string | object | null> | undefined;
/**
* Retrieves the value of the provided attribute from the given cluster.
*
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to retrieve the attribute from.
* @param {string} attribute - The name of the attribute to retrieve.
* @param {AnsiLogger} [log] - Optional logger for error and info messages.
* @returns {any} The value of the attribute, or undefined if the attribute is not found.
*/
getAttribute(cluster: Behavior.Type | ClusterType | ClusterId | string, attribute: string, log?: AnsiLogger): any;
/**
* Sets the value of an attribute on a cluster server.
*
* @param {Behavior.Type | ClusterType | ClusterId | string} clusterId - The ID of the cluster.
* @param {string} attribute - The name of the attribute.
* @param {boolean | number | bigint | string | object | null} value - The value to set for the attribute.
* @param {AnsiLogger} [log] - (Optional) The logger to use for logging errors and information.
* @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the attribute was successfully set.
*/
setAttribute(clusterId: Behavior.Type | ClusterType | ClusterId | string, attribute: string, value: boolean | number | bigint | string | object | null, log?: AnsiLogger): Promise<boolean>;
/**
* Update the value of an attribute on a cluster server only if the value is different.
*
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to set the attribute on.
* @param {string} attribute - The name of the attribute.
* @param {boolean | number | bigint | string | object | null} value - The value to set for the attribute.
* @param {AnsiLogger} [log] - (Optional) The logger to use for logging the update. Errors are logged to the endpoint logger.
* @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the attribute was successfully set.
*/
updateAttribute(cluster: Behavior.Type | ClusterType | ClusterId | string, attribute: string, value: boolean | number | bigint | string | object | null, log?: AnsiLogger): Promise<boolean>;
/**
* Subscribes to the provided attribute on a cluster.
*
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to subscribe the attribute to.
* @param {string} attribute - The name of the attribute to subscribe to.
* @param {(newValue: any, oldValue: any, context: ActionContext) => void} listener - A callback function that will be called when the attribute value changes. When context.offline === true then the change is locally generated and not from the controller.
* @param {AnsiLogger} [log] - Optional logger for logging errors and information.
* @returns {Promise<boolean>} - A boolean indicating whether the subscription was successful.
*
* @remarks The listener function (cannot be async) will receive three parameters:
* - `newValue`: The new value of the attribute.
* - `oldValue`: The old value of the attribute.
* - `context`: The action context, which includes information about the action that triggered the change. When context.offline === true then the change is locally generated and not from the controller.
*/
subscribeAttribute(cluster: Behavior.Type | ClusterType | ClusterId | string, attribute: string, listener: (newValue: any, oldValue: any, context: ActionContext) => void, log?: AnsiLogger): Promise<boolean>;
/**
* Triggers an event on the specified cluster.
*
* @param {ClusterId} cluster - The ID of the cluster.
* @param {string} event - The name of the event to trigger.
* @param {Record<string, boolean | number | bigint | string | object | undefined | null>} payload - The payload to pass to the event.
* @param {AnsiLogger} [log] - Optional logger for logging information.
* @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the event was successfully triggered.
*/
triggerEvent(cluster: Behavior.Type | ClusterType | ClusterId | string, event: string, payload: Record<string, boolean | number | bigint | string | object | undefined | null>, log?: AnsiLogger): Promise<boolean>;
/**
* Adds cluster servers from the provided server list.
*
* @param {ClusterId[]} serverList - The list of cluster IDs to add.
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*/
addClusterServers(serverList: ClusterId[]): this;
/**
* Adds a fixed label to the FixedLabel cluster. If the cluster server is not present, it will be added.
*
* @param {string} label - The label to add.
* @param {string} value - The value of the label.
* @returns {Promise<this>} The current MatterbridgeEndpoint instance for chaining.
*/
addFixedLabel(label: string, value: string): Promise<this>;
/**
* Adds a user label to the UserLabel cluster. If the cluster server is not present, it will be added.
*
* @param {string} label - The label to add.
* @param {string} value - The value of the label.
* @returns {Promise<this>} The current MatterbridgeEndpoint instance for chaining.
*/
addUserLabel(label: string, value: string): Promise<this>;
/**
* Adds a command handler for the specified command.
*
* @param {keyof MatterbridgeEndpointCommands} command - The command to add the handler for.
* @param {CommandHandlerFunction} handler - The handler function to execute when the command is received.
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*
* @remarks
* The handler function will receive an object with the following properties:
* - `request`: The request object sent with the command.
* - `cluster`: The id of the cluster that received the command (i.e. "onOff").
* - `attributes`: The current attributes of the cluster that received the command (i.e. { onOff: true}).
* - `endpoint`: The MatterbridgeEndpoint instance that received the command.
*/
addCommandHandler(command: keyof MatterbridgeEndpointCommands, handler: CommandHandlerFunction): this;
/**
* Execute the command handler for the specified command. Used ONLY in Jest tests.
*
* @param {keyof MatterbridgeEndpointCommands} command - The command to execute.
* @param {Record<string, boolean | number | bigint | string | object | null>} [request] - The optional request to pass to the handler function.
* @param {string} [cluster] - The optional cluster to pass to the handler function.
* @param {Record<string, boolean | number | bigint | string | object | null>} [attributes] - The optional attributes to pass to the handler function.
* @param {MatterbridgeEndpoint} [endpoint] - The optional MatterbridgeEndpoint instance to pass to the handler function
*
* @deprecated Used ONLY in Jest tests.
*/
executeCommandHandler(command: keyof MatterbridgeEndpointCommands, request?: Record<string, boolean | number | bigint | string | object | null>, cluster?: string, attributes?: Record<string, boolean | number | bigint | string | object | null>, endpoint?: MatterbridgeEndpoint): Promise<void>;
/**
* Invokes a behavior command on the specified cluster. Used ONLY in Jest tests.
*
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to invoke the command on.
* @param {string} command - The command to invoke.
* @param {Record<string, boolean | number | bigint | string | object | null>} [params] - The optional parameters to pass to the command.
*
* @deprecated Used ONLY in Jest tests.
*/
invokeBehaviorCommand(cluster: Behavior.Type | ClusterType | ClusterId | string, command: keyof MatterbridgeEndpointCommands, params?: Record<string, boolean | number | bigint | string | object | null>): Promise<void>;
/**
* Adds the required cluster servers (only if they are not present) for the device types of the specified endpoint.
*
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*/
addRequiredClusterServers(): MatterbridgeEndpoint;
/**
* Adds the optional cluster servers (only if they are not present) for the device types of the specified endpoint.
*
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*/
addOptionalClusterServers(): MatterbridgeEndpoint;
/**
* Retrieves all cluster servers.
*
* @returns {Behavior.Type[]} An array of all cluster servers.
*/
getAllClusterServers(): Behavior.Type[];
/**
* Retrieves the names of all cluster servers.
*
* @returns {string[]} An array of all cluster server names.
*/
getAllClusterServerNames(): string[];
/**
* Iterates over each attribute of each cluster server of the device state and calls the provided callback function.
*
* @param {Function} callback - The callback function to call with the cluster name, cluster id, attribute name, attribute id and attribute value.
*/
forEachAttribute(callback: (clusterName: string, clusterId: number, attributeName: string, attributeId: number, attributeValue: boolean | number | bigint | string | object | null | undefined) => void): void;
/**
* Adds a child endpoint with the specified device types and options.
* If the child endpoint is not already present, it will be created and added.
* If the child endpoint is already present, the existing child endpoint will be returned.
*
* @param {string} endpointName - The name of the new endpoint to add.
* @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The device types to add.
* @param {MatterbridgeEndpointOptions} [options] - The options for the endpoint.
* @param {boolean} [debug] - Whether to enable debug logging.
* @returns {MatterbridgeEndpoint} - The child endpoint that was found or added.
*
* @example
* ```typescript
* const endpoint = device.addChildDeviceType('Temperature', [temperatureSensor], { tagList: [{ mfgCode: null, namespaceId: LocationTag.Indoor.namespaceId, tag: LocationTag.Indoor.tag, label: null }] }, true);
* ```
*/
addChildDeviceType(endpointName: string, definition: DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>, options?: MatterbridgeEndpointOptions, debug?: boolean): MatterbridgeEndpoint;
/**
* Adds a child endpoint with one or more device types with the required cluster servers and the specified cluster servers.
* If the child endpoint is not already present in the childEndpoints, it will be added.
* If the child endpoint is already present in the childEndpoints, the device types and cluster servers will be added to the existing child endpoint.
*
* @param {string} endpointName - The name of the new enpoint to add.
* @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The device types to add.
* @param {ClusterId[]} [serverList] - The list of cluster IDs to include.
* @param {MatterbridgeEndpointOptions} [options] - The options for the device.
* @param {boolean} [debug] - Whether to enable debug logging.
* @returns {MatterbridgeEndpoint} - The child endpoint that was found or added.
*
* @example
* ```typescript
* const endpoint = device.addChildDeviceTypeWithClusterServer('Temperature', [temperatureSensor], [], { tagList: [{ mfgCode: null, namespaceId: LocationTag.Indoor.namespaceId, tag: LocationTag.Indoor.tag, label: null }] }, true);
* ```
*/
addChildDeviceTypeWithClusterServer(endpointName: string, definition: DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>, serverList?: ClusterId[], options?: MatterbridgeEndpointOptions, debug?: boolean): MatterbridgeEndpoint;
/**
* Retrieves a child endpoint by its name.
*
* @param {string} endpointName - The name of the endpoint to retrieve.
* @returns {Endpoint | undefined} The child endpoint with the specified name, or undefined if not found.
*/
getChildEndpointByName(endpointName: string): MatterbridgeEndpoint | undefined;
/**
* Retrieves a child endpoint by its EndpointNumber.
*
* @param {EndpointNumber} endpointNumber - The EndpointNumber of the endpoint to retrieve.
* @returns {MatterbridgeEndpoint | undefined} The child endpoint with the specified EndpointNumber, or undefined if not found.
*/
getChildEndpoint(endpointNumber: EndpointNumber): MatterbridgeEndpoint | undefined;
/**
* Get all the child endpoints of this endpoint.
*
* @returns {MatterbridgeEndpoint[]} The child endpoints.
*/
getChildEndpoints(): MatterbridgeEndpoint[];
/**
* Serializes the Matterbridge device into a serialized object.
*
* @param {MatterbridgeEndpoint} device - The Matterbridge device to serialize.
*
* @returns {SerializedMatterbridgeEndpoint | undefined} The serialized Matterbridge device object.
*/
static serialize(device: MatterbridgeEndpoint): SerializedMatterbridgeEndpoint | undefined;
/**
* Deserializes the device into a serialized object.
*
* @param {SerializedMatterbridgeEndpoint} serializedDevice - The serialized Matterbridge device object.
* @returns {MatterbridgeEndpoint | undefined} The deserialized Matterbridge device.
*/
static deserialize(serializedDevice: SerializedMatterbridgeEndpoint): MatterbridgeEndpoint | undefined;
/**
* Creates a default power source wired cluster server.
*
* @param {PowerSource.WiredCurrentType} wiredCurrentType - The type of wired current (default: PowerSource.WiredCurrentType.Ac)
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*
* @remarks
* - order: The order of the power source is a persisted attribute that indicates the order in which the power sources are used.
* - description: The description of the power source is a fixed attribute that describes the power source type.
* - wiredCurrentType: The type of wired current is a fixed attribute that indicates the type of wired current used by the power source (AC or DC).
*/
createDefaultPowerSourceWiredClusterServer(wiredCurrentType?: PowerSource.WiredCurrentType): this;
/**
* Creates a default power source replaceable battery cluster server.
*
* @param {number} batPercentRemaining - The remaining battery percentage (default: 100).
* @param {PowerSource.BatChargeLevel} batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
* @param {number} batVoltage - The battery voltage (default: 1500).
* @param {string} batReplacementDescription - The description of the battery replacement (default: 'Battery type').
* @param {number} batQuantity - The quantity of the battery (default: 1).
* @param {PowerSource.BatReplaceability} batReplaceability - The replaceability of the battery (default: PowerSource.BatReplaceability.Unspecified).
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*
* @remarks
* - order: The order of the power source is a persisted attribute that indicates the order in which the power sources are used.
* - description: The description of the power source is a fixed attribute that describes the power source type.
* - batReplaceability: The replaceability of the battery is a fixed attribute that indicates whether the battery is user-replaceable or not.
* - batReplacementDescription: The description of the battery replacement is a fixed attribute that describes the battery type.
* - batQuantity: The quantity of the battery is a fixed attribute that indicates how many batteries are present in the device.
*/
createDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining?: number, batChargeLevel?: PowerSource.BatChargeLevel, batVoltage?: number, batReplacementDescription?: string, batQuantity?: number, batReplaceability?: PowerSource.BatReplaceability): this;
/**
* Creates a default power source rechargeable battery cluster server.
*
* @param {number} [batPercentRemaining] - The remaining battery percentage (default: 100).
* @param {PowerSource.BatChargeLevel} [batChargeLevel] - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
* @param {number} [batVoltage] - The battery voltage in mV (default: 1500).
* @param {PowerSource.BatReplaceability} [batReplaceability] - The replaceability of the battery (default: PowerSource.BatReplaceability.Unspecified).
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*
* @remarks
* - order: The order of the power source is a persisted attribute that indicates the order in which the power sources are used.
* - description: The description of the power source is a fixed attribute that describes the power source type.
* - batReplaceability: The replaceability of the battery is a fixed attribute that indicates whether the battery is user-replaceable or not.
*/
createDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining?: number, batChargeLevel?: PowerSource.BatChargeLevel, batVoltage?: number, batReplaceability?: PowerSource.BatReplaceability): this;
/**
* Setup the default Basic Information Cluster Server attributes for the server node.
*
* This method sets the device name, serial number, unique ID, vendor ID, vendor name, product ID, product name, software version, software version string, hardware version and hardware version string.
*
* In bridge mode, it also adds the bridgedNode device type to the deviceTypes map and the bridgedNode device type to the deviceTypeList of the Descriptor cluster and creates a default BridgedDeviceBasicInformationClusterServer.
*
* The actual BasicInformationClusterServer is created by the MatterbridgeEndpoint class for device.mode = 'server' and for the unique device of an AccessoryPlatform.
*
* @param {string} deviceName - The name of the device.
* @param {string} serialNumber - The serial number of the device.
* @param {number} [vendorId] - The vendor ID of the device. Default is 0xfff1 (Matter Test VendorId).
* @param {string} [vendorName] - The name of the vendor. Default is 'Matterbridge'.
* @param {number} [productId] - The product ID of the device. Default is 0x8000 (Matter Test ProductId).
* @param {string} [productName] - The name of the product. Default is 'Matterbridge device'.
* @param {number} [softwareVersion] - The software version of the device. Default is 1.
* @param {string} [softwareVersionString] - The software version string of the device. Default is '1.0.0'.
* @param {number} [hardwareVersion] - The hardware version of the device. Default is 1.
* @param {string} [hardwareVersionString] - The hardware version string of the device. Default is '1.0.0'.
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*/
createDefaultBasicInformationClusterServer(deviceName: string, serialNumber: string, vendorId?: number, vendorName?: string, productId?: number, productName?: string, softwareVersion?: number, softwareVersionString?: string, hardwareVersion?: number, hardwareVersionString?: string): this;
/**
* Creates a default BridgedDeviceBasicInformationClusterServer for the aggregator endpoints.
*
* @param {string} deviceName - The name of the device.
* @param {string} serialNumber - The serial number of the device.
* @param {number} [vendorId] - The vendor ID of the device. Default is 0xfff1 (Matter Test VendorId).
* @param {string} [vendorName] - The name of the vendor. Default is 'Matterbridge'.
* @param {string} [productName] - The name of the product. Default is 'Matterbridge device'.
* @param {number} [softwareVersion] - The software version of the device. Default is 1.
* @param {string} [softwareVersionString] - The software version string of the device. Default is '1.0.0'.
* @param {number} [hardwareVersion] - The hardware version of the device. Default is 1.
* @param {string} [hardwareVersionString] - The hardware version string of the device. Default is '1.0.0'.
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*
* @remarks The bridgedNode device type must be added to the deviceTypeList of the Descriptor cluster.
*/
createDefaultBridgedDeviceBasicInformationClusterServer(deviceName: string, serialNumber: string, vendorId?: number, vendorName?: string, productName?: string, softwareVersion?: number, softwareVersionString?: string, hardwareVersion?: number, hardwareVersionString?: string): this;
/**
* Creates a default identify cluster server with the specified identify time and type.
*
* @param {number} [identifyTime] - The time to identify the server. Defaults to 0.
* @param {Identify.IdentifyType} [identifyType] - The type of identification. Defaults to Identify.IdentifyType.None.
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*/
createDefaultIdentifyClusterServer(identifyTime?: number, identifyType?: Identify.IdentifyType): this;
/**
* Creates a default groups cluster server.
*
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*/
createDefaultGroupsClusterServer(): this;
/**
* Creates a default scenes management cluster server.
*
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*
* @remarks The scenes management cluster server is still provisional and so not yet implemented.
*/
createDefaultScenesClusterServer(): this;
/**
* Creates a default OnOff cluster server for light devices with feature Lighting.
*
* @param {boolean} [onOff] - The initial state of the OnOff cluster.
* @param {boolean} [globalSceneControl] - The global scene control state.
* @param {number} [onTime] - The on time value.
* @param {number} [offWaitTime] - The off wait time value.
* @param {OnOff.StartUpOnOff | null} [startUpOnOff] - The start-up OnOff state. Null means previous state.
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*/
createDefaultOnOffClusterServer(onOff?: boolean, globalSceneControl?: boolean, onTime?: number, offWaitTime?: number, startUpOnOff?: OnOff.StartUpOnOff | null): this;
/**
* Creates an OnOff cluster server without features.
*
* @param {boolean} [onOff] - The initial state of the OnOff cluster.
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*/
createOnOffClusterServer(onOff?: boolean): this;
/**
* Creates a DeadFront OnOff cluster server with feature DeadFrontBehavior.
*
* @param {boolean} [onOff] - The initial state of the OnOff cluster.
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*/
createDeadFrontOnOffClusterServer(onOff?: boolean): this;
/**
* Creates an OffOnly OnOff cluster server with feature OffOnly.
*
* @param {boolean} [onOff] - The initial state of the OnOff cluster.
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*/
createOffOnlyOnOffClusterServer(onOff?: boolean): this;
/**
* Creates a default level control cluster server for light devices with feature OnOff and Lighting.
*
* @param {number} [currentLevel] - The current level (default: 254).
* @param {number} [minLevel] - The minimum level (default: 1).
* @param {number} [maxLevel] - The maximum level (default: 254).
* @param {number | null} [onLevel] - The on level (default: null).
* @param {number | null} [startUpCurrentLevel] - The startUp on level (default: null).
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*/
createDefaultLevelControlClusterServer(currentLevel?: number, minLevel?: number, maxLevel?: number, onLevel?: number | null, startUpCurrentLevel?: number | null): this;
/**
* Creates a level control cluster server without features.
*
* @param {number} [currentLevel] - The current level (default: 254).
* @param {number | null} [onLevel] - The on level (default: null).
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*/
createLevelControlClusterServer(currentLevel?: number, onLevel?: number | null): this;
/**
* Creates a default color control cluster server with features Xy, HueSaturation and ColorTemperature.
*
* @param {number} currentX - The current X value (range 0-65279).
* @param {number} currentY - The current Y value (range 0-65279).
* @param {number} currentHue - The current hue value (range: 0-254).
* @param {number} currentSaturation - The current saturation value (range: 0-254).
* @param {number} colorTemperatureMireds - The color temperature in mireds (default range 147-500).
* @param {number} colorTempPhysicalMinMireds - The physical minimum color temperature in mireds (default range 147).
* @param {number} colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds (default range 500).
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*
* @remarks colorMode and enhancedColorMode persist across restarts.
* @remarks currentHue and currentSaturation persist across restarts.
* @remarks currentX and currentY persist across restarts.
* @remarks colorTemperatureMireds persists across restarts.
* @remarks startUpColorTemperatureMireds persists across restarts.
* @remarks coupleColorTempToLevelMinMireds persists across restarts.
*/
createDefaultColorControlClusterServer(currentX?: number, currentY?: number, currentHue?: number, currentSaturation?: number, colorTemperatureMireds?: number, colorTempPhysicalMinMireds?: number, colorTempPhysicalMaxMireds?: number): this;
/**
* Creates a Xy color control cluster server with feature Xy and ColorTemperature.
*
* @param {number} currentX - The current X value (range 0-65279).
* @param {number} currentY - The current Y value (range 0-65279).
* @param {number} colorTemperatureMireds - The color temperature in mireds (default range 147-500).
* @param {number} colorTempPhysicalMinMireds - The physical minimum color temperature in mireds (default range 147).
* @param {number} colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds (default range 500).
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*
* @remarks
* From zigbee to matter = Math.max(Math.min(Math.round(x * 65536), 65279), 0)
*
* @remarks colorMode and enhancedColorMode persist across restarts.
* @remarks currentX and currentY persist across restarts.
* @remarks colorTemperatureMireds persists across restarts.
* @remarks startUpColorTemperatureMireds persists across restarts.
* @remarks coupleColorTempToLevelMinMireds persists across restarts.
*/
createXyColorControlClusterServer(currentX?: number, currentY?: number, colorTemperatureMireds?: number, colorTempPhysicalMinMireds?: number, colorTempPhysicalMaxMireds?: number): this;
/**
* Creates a default hue and saturation control cluster server with feature HueSaturation and ColorTemperature.
*
* @param {number} currentHue - The current hue value (range: 0-254).
* @param {number} currentSaturation - The current saturation value (range: 0-254).
* @param {number} colorTemperatureMireds - The color temperature in mireds (default range 147-500).
* @param {number} colorTempPhysicalMinMireds - The physical minimum color temperature in mireds (default range 147).
* @param {number} colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds (default range 500).
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*
* @remarks colorMode and enhancedColorMode persist across restarts.
* @remarks currentHue and currentSaturation persist across restarts.
* @remarks colorTemperatureMireds persists across restarts.
* @remarks startUpColorTemperatureMireds persists across restarts.
* @remarks coupleColorTempToLevelMinMireds persists across restarts.
*/
createHsColorControlClusterServer(currentHue?: number, currentSaturation?: number, colorTemperatureMireds?: number, colorTempPhysicalMinMireds?: number, colorTempPhysicalMaxMireds?: number): this;
/**
* Creates a color temperature color control cluster server with feature ColorTemperature.
* This cluster server is used for devices that only support color temperature control.
*
* @param {number} colorTemperatureMireds - The color temperature in mireds (default range 147-500).
* @param {number} colorTempPhysicalMinMireds - The physical minimum color temperature in mireds (default range 147).
* @param {number} colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds (default range 500).
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*
* @remarks colorMode and enhancedColorMode persist across restarts.
* @remarks colorTemperatureMireds persists across restarts.
* @remarks startUpColorTemperatureMireds persists across restarts.
* @remarks coupleColorTempToLevelMinMireds persists across restarts.
*/
createCtColorControlClusterServer(colorTemperatureMireds?: number, colorTempPhysicalMinMireds?: number, colorTempPhysicalMaxMireds?: number): this;
/**
* Configures the color control mode for the device.
*
* @param {ColorControl.ColorMode} colorMode - The color mode to set.
*
* @remarks colorMode and enhancedColorMode persist across restarts.
*/
configureColorControlMode(colorMode: ColorControl.ColorMode): Promise<void>;
/**
* Creates a default window covering cluster server with feature Lift and PositionAwareLift.
*
* @param {number} positionPercent100ths - The position percentage in 100ths (0-10000). Defaults to 0. Matter uses 10000 = fully closed 0 = fully opened.
* @param {WindowCovering.WindowCoveringType} type - The type of window covering (default: WindowCovering.WindowCoveringType.Rollershade). Must support feature Lift.
* @param {WindowCovering.EndProductType} endProductType - The end product type (default: WindowCovering.EndProductType.RollerShade). Must support feature Lift.
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*
* @remarks mode attributes is writable and persists across restarts.
* currentPositionLiftPercent100ths persists across restarts.
* configStatus attributes persists across restarts.
*/
createDefaultWindowCoveringClusterServer(positionPercent100ths?: number, type?: WindowCovering.WindowCoveringType, endProductType?: WindowCovering.EndProductType): this;
/**
* Creates a default window covering cluster server with features Lift, PositionAwareLift, Tilt, PositionAwareTilt.
*
* @param {number} positionLiftPercent100ths - The lift position percentage in 100ths (0-10000). Defaults to 0. Matter uses 10000 = fully closed 0 = fully opened.
* @param {number} positionTiltPercent100ths - The tilt position percentage in 100ths (0-10000). Defaults to 0. Matter uses 10000 = fully closed 0 = fully opened.
* @param {WindowCovering.WindowCoveringType} type - The type of window covering (default: WindowCovering.WindowCoveringType.TiltBlindLift). Must support features Lift and Tilt.
* @param {WindowCovering.EndProductType} endProductType - The end product type (default: WindowCovering.EndProductType.InteriorBlind). Must support features Lift and Tilt.
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*
* @remarks mode attributes is writable and persists across restarts.
* currentPositionTiltPercent100ths persists across restarts.
* configStatus attributes persists across restarts.
*/
createDefaultLiftTiltWindowCoveringClusterServer(positionLiftPercent100ths?: number, positionTiltPercent100ths?: number, type?: WindowCovering.WindowCoveringType, endProductType?: WindowCovering.EndProductType): this;
/**
* Sets the window covering lift target position as the current position and stops the movement.
*
*/
setWindowCoveringTargetAsCurrentAndStopped(): Promise<void>;
/**
* Sets the lift current and target position and the status of a window covering.
*
* @param {number} current - The current position of the window covering.
* @param {number} target - The target position of the window covering.
* @param {WindowCovering.MovementStatus} status - The movement status of the window covering.
*/
setWindowCoveringCurrentTargetStatus(current: number, target: number, status: WindowCovering.MovementStatus): Promise<void>;
/**
* Sets the status of the window covering.
*
* @param {WindowCovering.MovementStatus} status - The movement status to set.
*/
setWindowCoveringStatus(status: WindowCovering.MovementStatus): Promise<void>;
/**
* Retrieves the status of the window covering.
*
* @returns {WindowCovering.MovementStatus | undefined} The movement status of the window covering, or undefined if not available.
*/
getWindowCoveringStatus(): WindowCovering.MovementStatus | undefined;
/**
* Sets the lift target and current position of the window covering.
*
* @param {number} liftPosition - The position to set, specified as a number.
* @param {number} [tiltPosition] - The tilt position to set, specified as a number.
*/
setWindowCoveringTargetAndCurrentPosition(liftPosition: number, tiltPosition?: number): Promise<void>;
/**
* Creates a default thermostat cluster server with features Heating, Cooling and AutoMode.
*
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
* @param {number} [occupiedHeatingSetpoint] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
* @param {number} [occupiedCoolingSetpoint] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
* @param {number} [minSetpointDeadBand] - The minimum setpoint dead band value. Defaults to 1°.
* @param {number} [minHeatSetpointLimit] - The minimum heat setpoint limit value. Defaults to 0°.
* @param {number} [maxHeatSetpointLimit] - The maximum heat setpoint limit value. Defaults to 50°.
* @param {number} [minCoolSetpointLimit] - The minimum cool setpoint limit value. Defaults to 0°.
* @param {number} [maxCoolSetpointLimit] - The maximum cool setpoint limit value. Defaults to 50°.
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*/
createDefaultThermostatClusterServer(localTemperature?: number, occupiedHeatingSetpoint?: number, occupiedCoolingSetpoint?: number, minSetpointDeadBand?: number, minHeatSetpointLimit?: number, maxHeatSetpointLimit?: number, minCoolSetpointLimit?: number, maxCoolSetpointLimit?: number): this;
/**
* Creates a default heating thermostat cluster server with feature Heating.
*
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
* @param {number} [occupiedHeatingSetpoint] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
* @param {number} [minHeatSetpointLimit] - The minimum heat setpoint limit value. Defaults to 0°.
* @param {number} [maxHeatSetpointLimit] - The maximum heat setpoint limit value. Defaults to 50°.
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*/
createDefaultHeatingThermostatClusterServer(localTemperature?: number, occupiedHeatingSetpoint?: number, minHeatSetpointLimit?: number, maxHeatSetpointLimit?: number): this;
/**
* Creates a default cooling thermostat cluster server with feature Cooling.
*
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
* @param {number} [occupiedCoolingSetpoint] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
* @param {number} [minCoolSetpointLimit] - The minimum cool setpoint limit value. Defaults to 0°.
* @param {number} [maxCoolSetpointLimit] - The maximum cool setpoint limit value. Defaults to 50°.
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*/
createDefaultCoolingThermostatClusterServer(localTemperature?: number, occupiedCoolingSetpoint?: number, minCoolSetpointLimit?: number, maxCoolSetpointLimit?: number): this;
/**
* Creates a default thermostat user interface configuration cluster server.
*
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
* @remarks
* The default values are:
* - temperatureDisplayMode: ThermostatUserInterfaceConfiguration.TemperatureDisplayMode.Celsius (writeble).
* - keypadLockout: ThermostatUserInterfaceConfiguration.KeypadLockout.NoLockout (writeble).
* - scheduleProgrammingVisibility: ThermostatUserInterfaceConfiguration.ScheduleProgrammingVisibility.ScheduleProgrammingPermitted (writeble).
*/
createDefaultThermostatUserInterfaceConfigurationClusterServer(): this;
/**
* Creates a default fan control cluster server with features Auto, and Step and mode Off Low Med High Auto.
*
* @param {FanControl.FanMode} [fanMode] - The fan mode to set. Defaults to `FanControl.FanMode.Off`.
* @param {FanControl.FanModeSequence} [fanModeSequence] - The fan mode sequence to set. Defaults to `FanControl.FanModeSequence.OffLowMedHighAuto`.
* @param {number} [percentSetting] - The initial percent setting. Defaults to 0.
* @param {number} [percentCurrent] - The initial percent current. Defaults to 0.
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*
* @remarks
* - fanmode is writable and persists across reboots.
* - fanModeSequence is fixed.
* - percentSetting is writable.
*/
createDefaultFanControlClusterServer(fanMode?: FanControl.FanMode, fanModeSequence?: FanControl.FanModeSequence, percentSetting?: number, percentCurrent?: number): this;
/**
* Creates an On Off fan control cluster server without features and mode Off High.
*
* @param {FanControl.FanMode} [fanMode] - The fan mode to set. Defaults to `FanControl.FanMode.Off`.
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*
* @remarks
* fanmode is writable and pe