mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-07-03 02:21:38 +00:00
ca3c6ce32f
* ts * Updates
27 lines
841 B
TypeScript
27 lines
841 B
TypeScript
/* eslint-disable brace-style */
|
|
import * as settings from '../util/settings';
|
|
// @ts-ignore
|
|
import zhc from 'zigbee-herdsman-converters';
|
|
|
|
export default class Group {
|
|
private group: ZHGroup;
|
|
|
|
get zhGroup(): ZHGroup {return this.group;}
|
|
get ID(): number {return this.group.groupID;}
|
|
get settings(): GroupSettings {return settings.getGroup(this.ID);}
|
|
get name(): string {return this.settings?.friendlyName || this.ID.toString();}
|
|
get members(): ZHEndpoint[] {return this.group.members;}
|
|
|
|
constructor(group: ZHGroup) {
|
|
this.group = group;
|
|
}
|
|
|
|
membersDefinitions(): Definition[] {
|
|
return this.members.map((m) => zhc.findByDevice(m.getDevice())).filter((d) => d) as Definition[];
|
|
}
|
|
|
|
membersIeeeAddr(): string[] {
|
|
return this.members.map((m) => m.getDevice().ieeeAddr);
|
|
}
|
|
}
|