matterbridge
Version:
Matterbridge plugin manager for Matter
831 lines • 52 kB
TypeScript
/**
* This file contains the class MatterbridgeEndpoint that extends the Endpoint class from the Matter.js library.
*
* @file matterbridgeEndpoint.ts
* @author Luca Liguori
* @date 2024-10-01
* @version 2.0.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 { AnsiLogger, LogLevel } from './logger/export.js';
import { DeviceTypeDefinition, MatterbridgeEndpointOptions } from './matterbridgeDeviceTypes.js';
import { AtLeastOne, Behavior, ClusterId, Endpoint, EndpointNumber, HandlerFunction, NamedHandler } 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';
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;
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;
}
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 {
static bridgeMode: string;
static logLevel: LogLevel;
log: AnsiLogger;
plugin: string | undefined;
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;
name: string | undefined;
deviceType: number;
uniqueStorageKey: string | undefined;
tagList?: Semtag[];
readonly deviceTypes: Map<number, DeviceTypeDefinition>;
readonly commandHandler: NamedHandler<MatterbridgeEndpointCommands>;
/**
* Represents a MatterbridgeEndpoint.
* @constructor
* @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The DeviceTypeDefinition(s) of the endpoint.
* @param {MatterbridgeEndpointOptions} [options={}] - The options for the device.
* @param {boolean} [debug=false] - 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=false] - 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, string | number | bigint | boolean | 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) => void} listener - A callback function that will be called when the attribute value changes.
* @param {AnsiLogger} [log] - Optional logger for logging errors and information.
* @returns {Promise<boolean>} - A boolean indicating whether the subscription was successful.
*/
subscribeAttribute(cluster: Behavior.Type | ClusterType | ClusterId | string, attribute: string, listener: (newValue: any, oldValue: any) => void, log?: AnsiLogger): Promise<boolean>;
/**
* Triggers an event on the specified cluster.
*
* @param {ClusterId} clusterId - 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(clusterId: ClusterId, 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 {HandlerFunction} handler - The handler function to execute when the command is received.
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*/
addCommandHandler(command: keyof MatterbridgeEndpointCommands, handler: HandlerFunction): this;
/**
* Execute the command handler for the specified command. Mainly used 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.
* @returns {Promise<void>} A promise that resolves when the command handler has been executed
*/
executeCommandHandler(command: keyof MatterbridgeEndpointCommands, request?: 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=false] - 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=false] - 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 pluginName - The name of the plugin.
* @returns The serialized Matterbridge device object.
*/
static serialize(device: MatterbridgeEndpoint): SerializedMatterbridgeEndpoint | undefined;
/**
* Deserializes the device into a serialized object.
*
* @returns The deserialized MatterbridgeDevice.
*/
static deserialize(serializedDevice: SerializedMatterbridgeEndpoint): MatterbridgeEndpoint | undefined;
/**
* Creates a default power source wired cluster server.
*
* @param wiredCurrentType - The type of wired current (default: PowerSource.WiredCurrentType.Ac)
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*/
createDefaultPowerSourceWiredClusterServer(wiredCurrentType?: PowerSource.WiredCurrentType): this;
/**
* Creates a default power source replaceable battery cluster server.
*
* @param batPercentRemaining - The remaining battery percentage (default: 100).
* @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
* @param batVoltage - The battery voltage (default: 1500).
* @param batReplacementDescription - The battery replacement description (default: 'Battery type').
* @param batQuantity - The battery quantity (default: 1).
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*/
createDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining?: number, batChargeLevel?: PowerSource.BatChargeLevel, batVoltage?: number, batReplacementDescription?: string, batQuantity?: number): this;
/**
* Creates a default power source rechargeable battery cluster server.
*
* @param batPercentRemaining - The remaining battery percentage (default: 100).
* @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
* @param batVoltage - The battery voltage (default: 1500).
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*/
createDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining?: number, batChargeLevel?: PowerSource.BatChargeLevel, batVoltage?: number): this;
/**
* Creates a default Basic Information Cluster Server for the server node.
*
* @param deviceName - The name of the device.
* @param serialNumber - The serial number of the device.
* @param vendorId - The vendor ID of the device.
* @param vendorName - The vendor name of the device.
* @param productId - The product ID of the device.
* @param productName - The product name of the device.
* @param softwareVersion - The software version of the device. Default is 1.
* @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
* @param hardwareVersion - The hardware version of the device. Default is 1.
* @param hardwareVersionString - The hardware version string of the device. Default is 'v.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 deviceName - The name of the device.
* @param serialNumber - The serial number of the device.
* @param vendorId - The vendor ID of the device.
* @param vendorName - The name of the vendor.
* @param productName - The name of the product.
* @param softwareVersion - The software version of the device. Default is 1.
* @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
* @param hardwareVersion - The hardware version of the device. Default is 1.
* @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*/
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=0] - The time to identify the server. Defaults to 0.
* @param {Identify.IdentifyType} [identifyType=Identify.IdentifyType.None] - 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.
*/
createDefaultScenesClusterServer(): this;
/**
* Creates a default OnOff cluster server for light devices.
*
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
* @param {boolean} [globalSceneControl=false] - The global scene control state.
* @param {number} [onTime=0] - The on time value.
* @param {number} [offWaitTime=0] - The off wait time value.
* @param {OnOff.StartUpOnOff | null} [startUpOnOff=null] - 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=false] - 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.
*
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*/
createDeadFrontOnOffClusterServer(onOff?: boolean): this;
/**
* Creates a default level control cluster server for light devices.
*
* @param {number} [currentLevel=254] - The current level (default: 254).
* @param {number} [minLevel=1] - The minimum level (default: 1).
* @param {number} [maxLevel=254] - The maximum level (default: 254).
* @param {number | null} [onLevel=null] - The on level (default: null).
* @param {number | null} [startUpCurrentLevel=null] - 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 default color control cluster server with Xy, HueSaturation and ColorTemperature.
*
* @param currentX - The current X value.
* @param currentY - The current Y value.
* @param currentHue - The current hue value.
* @param currentSaturation - The current saturation value.
* @param colorTemperatureMireds - The color temperature in mireds.
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*/
createDefaultColorControlClusterServer(currentX?: number, currentY?: number, currentHue?: number, currentSaturation?: number, colorTemperatureMireds?: number, colorTempPhysicalMinMireds?: number, colorTempPhysicalMaxMireds?: number): this;
/**
* Creates a Xy color control cluster server with Xy and ColorTemperature.
*
* @param currentX - The current X value.
* @param currentY - The current Y value.
* @param colorTemperatureMireds - The color temperature in mireds.
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*
* @remarks
* From zigbee to matter = Math.max(Math.min(Math.round(x * 65536), 65279), 0)
*/
createXyColorControlClusterServer(currentX?: number, currentY?: number, colorTemperatureMireds?: number, colorTempPhysicalMinMireds?: number, colorTempPhysicalMaxMireds?: number): this;
/**
* Creates a default hue and saturation control cluster server with HueSaturation and ColorTemperature.
*
* @param currentHue - The current hue value.
* @param currentSaturation - The current saturation value.
* @param colorTemperatureMireds - The color temperature in mireds.
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*/
createHsColorControlClusterServer(currentHue?: number, currentSaturation?: number, colorTemperatureMireds?: number, colorTempPhysicalMinMireds?: number, colorTempPhysicalMaxMireds?: number): this;
/**
* Creates a color temperature color control cluster server.
*
* @param colorTemperatureMireds - The color temperature in mireds.
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*/
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.
*/
configureColorControlMode(colorMode: ColorControl.ColorMode): Promise<void>;
/**
* Creates a default window covering cluster server (Lift and PositionAwareLift).
*
* @param positionPercent100ths - The position percentage in 100ths (0-10000). Defaults to 0. Matter uses 10000 = fully closed 0 = fully opened.
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*/
createDefaultWindowCoveringClusterServer(positionPercent100ths?: number): this;
/**
* Sets the window covering target position as the current position and stops the movement.
*
*/
setWindowCoveringTargetAsCurrentAndStopped(): Promise<void>;
/**
* Sets the current and target 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 The global operational status of the window covering or undefined.
*/
getWindowCoveringStatus(): WindowCovering.MovementStatus | undefined;
/**
* Sets the target and current position of the window covering.
*
* @param position - The position to set, specified as a number.
*/
setWindowCoveringTargetAndCurrentPosition(position: number): Promise<void>;
/**
* Creates a default thermostat cluster server with Thermostat.Feature.Heating, Thermostat.Feature.Cooling, Thermostat.Feature.AutoMode.
*
* @param {number} [localTemperature=23] - The local temperature value in degrees Celsius. Defaults to 23°.
* @param {number} [occupiedHeatingSetpoint=21] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
* @param {number} [occupiedCoolingSetpoint=25] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
* @param {number} [minSetpointDeadBand=1] - The minimum setpoint dead band value. Defaults to 1°.
* @param {number} [minHeatSetpointLimit=0] - The minimum heat setpoint limit value. Defaults to 0°.
* @param {number} [maxHeatSetpointLimit=50] - The maximum heat setpoint limit value. Defaults to 50°.
* @param {number} [minCoolSetpointLimit=0] - The minimum cool setpoint limit value. Defaults to 0°.
* @param {number} [maxCoolSetpointLimit=50] - 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 Thermostat.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 Thermostat.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 fan control cluster server.
*
* @param fanMode The fan mode to set. Defaults to `FanControl.FanMode.Off`.
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*/
createDefaultFanControlClusterServer(fanMode?: FanControl.FanMode): this;
/**
* Creates a default door lock cluster server.
*
* @param {DoorLock.LockState} [lockState=DoorLock.LockState.Locked] - The initial state of the lock (default: Locked).
* @param {DoorLock.LockType} [lockType=DoorLock.LockType.DeadBolt] - The type of the lock (default: DeadBolt).
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*
* @remarks
* All operating modes NOT supported by a lock SHALL be set to one. The value of the OperatingMode enumeration defines the related bit to be set.
*/
createDefaultDoorLockClusterServer(lockState?: DoorLock.LockState, lockType?: DoorLock.LockType): this;
/**
* Creates a default Mode Select cluster server.
*
* @param {string} description - The description of the mode select cluster.
* @param {ModeSelect.ModeOption[]} supportedModes - The list of supported modes.
* @param {number} [currentMode=0] - The current mode (default: 0).
* @param {number} [startUpMode=0] - The startup mode (default: 0).
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*
* @remarks
* endpoint.createDefaultModeSelectClusterServer('Night mode', [{ label: 'Led ON', mode: 0, semanticTags: [] }, { label: 'Led OFF', mode: 1, semanticTags: [] }], 0, 0);
*/
createDefaultModeSelectClusterServer(description: string, supportedModes: ModeSelect.ModeOption[], currentMode?: number, startUpMode?: number): this;
/**
* Creates the default Valve Configuration And Control cluster server.
*
* @param {ValveConfigurationAndControl.ValveState} [valveState=ValveConfigurationAndControl.ValveState.Closed] - The valve state to set. Defaults to `ValveConfigurationAndControl.ValveState.Closed`.
* @param {number} [valveLevel=0] - The valve level to set. Defaults to 0.
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*/
createDefaultValveConfigurationAndControlClusterServer(valveState?: ValveConfigurationAndControl.ValveState, valveLevel?: number): this;
/**
* Creates the default PumpConfigurationAndControl cluster server.
*
* @param {PumpConfigurationAndControl.OperationMode} [pumpMode=PumpConfigurationAndControl.OperationMode.Normal] - The pump mode to set. Defaults to `PumpConfigurationAndControl.OperationMode.Normal`.
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*/
createDefaultPumpConfigurationAndControlClusterServer(pumpMode?: PumpConfigurationAndControl.OperationMode): this;
/**
* Creates the default SmokeCOAlarm Cluster Server.
*
* @param {SmokeCoAlarm.AlarmState} smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
* @param {SmokeCoAlarm.AlarmState} coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*/
createDefaultSmokeCOAlarmClusterServer(smokeState?: SmokeCoAlarm.AlarmState, coState?: SmokeCoAlarm.AlarmState): this;
/**
* Creates a smoke only SmokeCOAlarm Cluster Server.
*
* @param {SmokeCoAlarm.AlarmState} smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*/
createSmokeOnlySmokeCOAlarmClusterServer(smokeState?: SmokeCoAlarm.AlarmState): this;
/**
* Creates a co only SmokeCOAlarm Cluster Server.
*
* @param {SmokeCoAlarm.AlarmState} coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*/
createCoOnlySmokeCOAlarmClusterServer(coState?: SmokeCoAlarm.AlarmState): this;
/**
* Creates a default momentary switch cluster server.
*
* @remarks
* This method adds a cluster server with default momentary switch features and configuration suitable for (AppleHome) Single Double Long automations.
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*/
createDefaultSwitchClusterServer(): this;
/**
* Creates a default latching switch cluster server.
*
* @remarks
* This method adds a cluster server with default latching switch features and configuration suitable for a latching switch with 2 positions.
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*/
createDefaultLatchingSwitchClusterServer(): this;
/**
* Triggers a switch event on the specified endpoint.
*
* @param {string} event - The type of event to trigger. Possible values are 'Single', 'Double', 'Long' for momentarySwitch and 'Press', 'Release' for latchingSwitch.
* @param {Endpoint} endpoint - The endpoint on which to trigger the event (default the device endpoint).
* @returns {boolean} - A boolean indicating whether the event was successfully triggered.
*/
triggerSwitchEvent(event: 'Single' | 'Double' | 'Long' | 'Press' | 'Release', log?: AnsiLogger): Promise<boolean>;
/**
* Creates a default boolean state cluster server.
*
* @param {boolean} contact - The state of the cluster. Defaults to true (true = contact).
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*/
createDefaultBooleanStateClusterServer(contact?: boolean): this;
/**
* Creates a default boolean state configuration cluster server to be used with the waterFreezeDetector, waterLeakDetector, and rainSensor device types.
*
* @remarks Supports the enableDisableAlarm command.
*
* @param {boolean} [sensorFault=false] - Optional boolean value indicating the sensor fault state. Defaults to `false` if not provided.
* @param {number} [currentSensitivityLevel=0] - The current sensitivity level. Defaults to `0` if not provided.
* @param {number} [supportedSensitivityLevels=2] - The number of supported sensitivity levels. Defaults to `2` if not provided (min 2, max 10).
* @param {number} [defaultSensitivityLevel=0] - The default sensitivity level. Defaults to `0` if not provided.
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*/
createDefaultBooleanStateConfigurationClusterServer(sensorFault?: boolean, currentSensitivityLevel?: number, supportedSensitivityLevels?: number, defaultSensitivityLevel?: number): this;
/**
* Creates a default Power Topology Cluster Server with feature TreeTopology. Only needed for an electricalSensor device type.
*
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*/
createDefaultPowerTopologyClusterServer(): this;
/**
* Creates a default Electrical Energy Measurement Cluster Server.
*
* @param {number} energy - The total consumption value in mW/h.
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*/
createDefaultElectricalEnergyMeasurementClusterServer(energy?: number | bigint | null): this;
/**
* Creates a default Electrical Power Measurement Cluster Server.
*
* @param {number} voltage - The voltage value in millivolts.
* @param {number} current - The current value in milliamperes.
* @param {number} power - The power value in milliwatts.
* @param {number} frequency - The frequency value in millihertz.
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*/
createDefaultElectricalPowerMeasurementClusterServer(voltage?: number | bigint | null, current?: number | bigint | null, power?: number | bigint | null, frequency?: number | bigint | null): this;
/**
* Creates a default TemperatureMeasurement cluster server.
*
* @param {number} measuredValue - The measured value of the temperature x 100.
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*/
createDefaultTemperatureMeasurementClusterServer(measuredValue?: number): this;
/**
* Creates a default RelativeHumidityMeasurement cluster server.
*
* @param {number} measuredValue - The measured value of the relative humidity x 100.
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*/
createDefaultRelativeHumidityMeasurementClusterServer(measuredValue?: number): this;
/**
* Creates a default PressureMeasurement cluster server.
*
* @param {number} measuredValue - The measured value for the pressure.
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*/
createDefaultPressureMeasurementClusterServer(measuredValue?: number): this;
/**
* Creates a default IlluminanceMeasurement cluster server.
*
* @param {number} measuredValue - The measured value of illuminance.
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*
* @remarks
* Lux to matter = Math.round(Math.max(Math.min(10000 * Math.log10(lux), 0xfffe), 0))
* Matter to Lux = Math.round(Math.max(Math.pow(10, value / 10000), 0))
*/
createDefaultIlluminanceMeasurementClusterServer(measuredValue?: number): this;
/**
* Creates a default FlowMeasurement cluster server.
*
* @param {number} measuredValue - The measured value of the flow in 10 x m/h.
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*/
createDefaultFlowMeasurementClusterServer(measuredValue?: number): this;
/**
* Creates a default OccupancySensing cluster server.
*
* @param {boolean} occupied - A boolean indicating whether the occupancy is occupied or not. Default is false.
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*/
createDefaultOccupancySensingClusterServer(occupied?: boolean): this;
/**
* Creates a default AirQuality cluster server.
*
* @param {AirQuality.AirQualityEnum} airQuality The air quality level. Defaults to `AirQuality.AirQualityType.Unknown`.
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*/
createDefaultAirQualityClusterServer(airQuality?: AirQuality.AirQualityEnum): this;
/**
* Creates a default TotalVolatileOrganicCompoundsConcentrationMeasurement cluster server.
*
* @param {number} measuredValue - The measured value of the concentration.
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
*/
createDefaultTvocMeasurementClusterServer(measuredValue?: number, measurementUnit?: ConcentrationMeasurement.MeasurementUnit, measurementMedium?: ConcentrationMeasurement.MeasurementMedium): this;
/**
* Create a default CarbonMonoxideConcentrationMeasurement cluster server.
*
* @param {number} measuredValue - The measured value of the concentration.
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
*/
createDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue?: number, measurementUnit?: ConcentrationMeasurement.MeasurementUnit, measurementMedium?: ConcentrationMeasurement.MeasurementMedium): this;
/**
* Create a default CarbonDioxideConcentrationMeasurement cluster server.
*
* @param {number} measuredValue - The measured value of the concentration.
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
*/
createDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue?: number, measurementUnit?: ConcentrationMeasurement.MeasurementUnit, measurementMedium?: ConcentrationMeasurement.MeasurementMedium): this;
/**
* Create a default FormaldehydeConcentrationMeasurement cluster server.
*
* @param {number} measuredValue - The measured value of the concentration.
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
*/
createDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue?: number, measurementUnit?: ConcentrationMeasurement.MeasurementUnit, measurementMedium?: ConcentrationMeasurement.MeasurementMedium): this;
/**
* Create a default Pm1ConcentrationMeasurement cluster server.
*
* @param {number} measuredValue - The measured value of the concentration.
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
*/
createDefaultPm1ConcentrationMeasurementClusterServer(measuredValue?: number, measurementUnit?: ConcentrationMeasurement.MeasurementUnit, measurementMedium?: ConcentrationMeasurement.MeasurementMedium): this;
/**
* Create a default Pm25ConcentrationMeasurement cluster server.
*
* @param {number} measuredValue - The measured value of the concentration.
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
*/
createDefaultPm25ConcentrationMeasurementClusterServer(measuredValue?: number, measurementUnit?: ConcentrationMeasurement.MeasurementUnit, measurementMedium?: ConcentrationMeasurement.MeasurementMedium): this;
/**
* Create a default Pm10ConcentrationMeasurement cluster server.
*
* @param {number} measuredValue - The measured value of the concentration.
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
*/
createDefaultPm10ConcentrationMeasurementClusterServer(measuredValue?: number, measurementUnit?: ConcentrationMeasurement.MeasurementUnit, measurementMedium?: ConcentrationMeasurement.MeasurementMedium): this;
/**
* Create a default OzoneConcentrationMeasurement cluster server.
*
* @param {number} measuredValue - The measured value of the concentration.
* @param {Con