mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2024-11-16 18:39:09 -07:00
045ee573a0
* Update * Updates * More refactoringzzz * Bindoo * Loadz of typescripting * Logga * Updates * Updates * Updates * Updates * cleanup * updates * Fix coverage * Fixes * Updates * Updates
24 lines
763 B
TypeScript
24 lines
763 B
TypeScript
/* eslint-disable brace-style */
|
|
import * as settings from '../util/settings';
|
|
import zigbeeHerdsmanConverters from 'zigbee-herdsman-converters';
|
|
|
|
export default class Group {
|
|
public zh: zh.Group;
|
|
|
|
get ID(): number {return this.zh.groupID;}
|
|
get settings(): GroupSettings {return settings.getGroup(this.ID);}
|
|
get name(): string {return this.settings?.friendly_name || this.ID.toString();}
|
|
|
|
constructor(group: zh.Group) {
|
|
this.zh = group;
|
|
}
|
|
|
|
membersDefinitions(): zhc.Definition[] {
|
|
return this.zh.members.map((m) =>
|
|
zigbeeHerdsmanConverters.findByDevice(m.getDevice())).filter((d) => d) as zhc.Definition[];
|
|
}
|
|
|
|
isDevice(): this is Device {return false;}
|
|
isGroup(): this is Group {return true;}
|
|
}
|