/** * The Zigbee group `DeviceSource` — a fifth source, alongside * `ZigbeeDeviceSource`, exposing each Zigbee2MQTT group as an ordinary * device (design.md D1, D2; specs/zigbee-groups/spec.md). * * A group has no `ieee_address` and no `definition.exposes` of its own — * `bridge/groups` gives only `{ id, friendly_name, members }` — so this * source derives everything a consumer needs from the same `DeviceRegistry` * `ZigbeeDeviceSource` reads: member capabilities are intersected (D3) and * member state is aggregated (D4), rather than re-deriving from descriptors. * * Identity is the numeric bridge id (D2): `qualifiedId = "zigbee-group:"`, * stable across a friendly-name rename in Zigbee2MQTT. */ import type { Logger } from "pino"; import type { Capability } from "../../types/capabilities.js"; import type { MqttService } from "../mqtt/mqtt-service.js"; import type { DeviceRegistry } from "../zigbee/device-registry.js"; import type { DeviceChangeListener, DeviceCommandOutcome, DeviceDescriptor, DeviceSource } from "./device-source.js"; export declare const ZIGBEE_GROUP_SOURCE_ID = "zigbee-group"; /** * Intersects the capabilities of every group member into the group's own * declared capability set (design.md D3; task 2.1). A property is offered * only when every member declares it, with a compatible `valueType`. * * Rebuilds the source-neutral container shape the intersected leaves came * from (e.g. a `kind: "light"` capability wrapping `features`), from the * first member's structure — not just a flat leaf list — because that * container `kind` is what `detectCapabilities()` * (`services/capability-detection.ts`) keys HomeKit exposure on. A flat list * of on/off + brightness properties with no `light`/`switch` wrapper would * match no HomeKit service and be silently skipped, even though every * member is an ordinary bulb. * * A pure function with no dependency on the registry or MQTT, so it is * testable in isolation from device discovery and state tracking. */ export declare function intersectCapabilities(memberCapabilitySets: Capability[][]): Capability[]; /** * Derives a group's reported state from its members' tracked state * (design.md D4; task 2.2): a boolean property reports on when any member * reports on; a numeric property reports the mean across members currently * on (determined by any declared boolean property); a property no member * reports is omitted rather than defaulted. * * A pure function with no dependency on the registry, so it is testable in * isolation from MQTT and device discovery. */ export declare function deriveGroupState(capabilities: Capability[], memberStates: Record[]): Record; export declare class ZigbeeGroupDeviceSource implements DeviceSource { private readonly registry; private readonly mqtt; private readonly logger; readonly id = "zigbee-group"; private readonly listeners; /** Per-member-friendly-name state handlers, rebuilt on every group-list change. */ private readonly memberStateHandlers; /** IEEE address → set of group ids containing that member, rebuilt on `onGroupsChanged`. */ private ieeeToGroupIds; private onGroupsChangedCb; constructor(registry: DeviceRegistry | null, mqtt: MqttService, logger: Logger); get available(): boolean; start(): void; stop(): void; list(): DeviceDescriptor[]; get(deviceId: string): DeviceDescriptor | undefined; command(deviceId: string, properties: Record): Promise; subscribe(listener: DeviceChangeListener): () => void; private findGroup; private findDeviceByIeee; /** * Rebuilds the IEEE → group-ids index and the per-member-friendly-name * state subscriptions from the registry's current group list (design.md * D4; task 2.5). Called on start and every subsequent `bridge/groups` * change, since membership and friendly names can both change. */ private rebuildIndexAndSubscriptions; /** A member's state changed — recompute and notify only the groups containing it (task 2.5). */ private onMemberStateChange; private notify; /** Resolves each member to its current device record and tracked state, skipping any member not yet known. */ private resolveMembers; private capabilitiesFor; private toDescriptor; } //# sourceMappingURL=zigbee-group-source.d.ts.map