/** * @license * Copyright 2022-2026 Matter.js Authors * SPDX-License-Identifier: Apache-2.0 */ /*** THIS FILE IS GENERATED, DO NOT EDIT ***/ import { IdentifyServer as BaseIdentifyServer } from "../behaviors/identify/IdentifyServer.js"; import { GroupsServer as BaseGroupsServer } from "../behaviors/groups/GroupsServer.js"; import { OnOffServer as BaseOnOffServer } from "../behaviors/on-off/OnOffServer.js"; import { ScenesManagementServer as BaseScenesManagementServer } from "../behaviors/scenes-management/ScenesManagementServer.js"; import { LevelControlServer as BaseLevelControlServer } from "../behaviors/level-control/LevelControlServer.js"; import { OccupancySensingClient as BaseOccupancySensingClient } from "../behaviors/occupancy-sensing/OccupancySensingClient.js"; import { MutableEndpoint } from "../endpoint/type/MutableEndpoint.js"; import { SupportedBehaviors } from "../endpoint/properties/SupportedBehaviors.js"; import { Identity } from "@matter/general"; /** * An On/Off Plug-in Unit is a device that provides power to another device that is plugged into it, and is capable of * switching that provided power on or off. * * The Mounted On/Off Control (added in Matter 1.4) has identical cluster requirements as the On/Off Plug-In Unit, and * is marked as superset of this device type (since Matter 1.4.2). For devices intended to be mounted permanently, the * Mounted On/Off Control device type shall be used, with the On/Off Plug-In Unit device type optionally added in the * DeviceTypeList of the Descriptor cluster in addition to the On/Off Plug-In Unit device type (see Mounted On/Off * Control server guidance section). * * Before Matter 1.4, mounted units typically used the On/Off Plug-In Unit device type. Clients can encounter devices * which were made before or after these specification updates. Therefore, clients SHOULD use the following heuristic to * distinguish the type of physical device based on the device type revision found on an endpoint ("--" means the device * type is not listed). * * ### Cluster Requirements * * The inclusion of the Level Control cluster on this device is recommended to provide a consistent user experience when * the device is grouped with additional dimmable lights and the “with on/off” commands are used. For this device, since * its only states are on or off, if the Level Control cluster is implemented, it shall NOT have any effect on the * actual light level except for those commands that cause an on/off state change, that is, the “with on/off” commands. * In addition, if the Level Control cluster is implemented, the device shall accept and process Level Control cluster * commands, adjusting the value of the CurrentLevel attribute accordingly and, where necessary, adjusting the On/Off * cluster OnOff attribute. * * ### Element Requirements * * As the TriggerEffect command of the Identify cluster and the OffWithEffect command of the On/Off cluster specify * light effects that require dimming of the light output, and such is not possible on this device type, the specified * light effects may be replaced by pure on/off light effects. * * @see {@link MatterSpecification.v161.Device} § 5.1 */ export interface OnOffPlugInUnitDevice extends Identity {} export namespace OnOffPlugInUnitRequirements { /** * The Identify cluster is required by the Matter specification. * * This version of {@link IdentifyServer} is specialized per the specification. */ export const IdentifyServer = BaseIdentifyServer.alter({ commands: { triggerEffect: { optional: false } } }); /** * The Groups cluster is required by the Matter specification. * * We provide this alias to the default implementation {@link GroupsServer} for convenience. */ export const GroupsServer = BaseGroupsServer; /** * The OnOff cluster is required by the Matter specification. * * This version of {@link OnOffServer} is specialized per the specification. */ export const OnOffServer = BaseOnOffServer.with("Lighting"); /** * The ScenesManagement cluster is required by the Matter specification. * * This version of {@link ScenesManagementServer} is specialized per the specification. */ export const ScenesManagementServer = BaseScenesManagementServer .alter({ commands: { copyScene: { optional: false } } }); /** * The LevelControl cluster is optional per the Matter specification. * * This version of {@link LevelControlServer} is specialized per the specification. */ export const LevelControlServer = BaseLevelControlServer .with("OnOff", "Lighting") .alter({ attributes: { currentLevel: { min: 1, max: 254 }, minLevel: { min: 1, max: 1, default: 1 }, maxLevel: { min: 254, max: 254, default: 254 } } }); /** * The OccupancySensing cluster is optional per the Matter specification. * * We provide this alias to the default implementation {@link OccupancySensingClient} for convenience. */ export const OccupancySensingClient = BaseOccupancySensingClient; /** * An implementation for each server cluster supported by the endpoint per the Matter specification. */ export const server = { mandatory: { Identify: IdentifyServer, Groups: GroupsServer, OnOff: OnOffServer, ScenesManagement: ScenesManagementServer }, optional: { LevelControl: LevelControlServer } }; /** * A definition for each client cluster supported by the endpoint per the Matter specification. */ export const client = { optional: { OccupancySensing: OccupancySensingClient } }; } export const OnOffPlugInUnitDeviceDefinition = MutableEndpoint({ name: "OnOffPlugInUnit", deviceType: 0x10a, deviceRevision: 5, requirements: OnOffPlugInUnitRequirements, behaviors: SupportedBehaviors( OnOffPlugInUnitRequirements.server.mandatory.Identify, OnOffPlugInUnitRequirements.server.mandatory.Groups, OnOffPlugInUnitRequirements.server.mandatory.OnOff, OnOffPlugInUnitRequirements.server.mandatory.ScenesManagement ) }); Object.freeze(OnOffPlugInUnitDeviceDefinition); export const OnOffPlugInUnitDevice: OnOffPlugInUnitDevice = OnOffPlugInUnitDeviceDefinition;