MCPcopy
hub / github.com/Koenkk/zigbee2mqtt / getGroup

Function getGroup

lib/util/settings.ts:508–523  ·  view source on GitHub ↗
(IDorName: string | number)

Source from the content-addressed store, hash-verified

506}
507
508export function getGroup(IDorName: string | number): GroupOptions | undefined {
509 const settings = get();
510 const byID = settings.groups[IDorName];
511
512 if (byID) {
513 return {...byID, ID: Number(IDorName)};
514 }
515
516 for (const [ID, group] of Object.entries(settings.groups)) {
517 if (group.friendly_name === IDorName) {
518 return {...group, ID: Number(ID)};
519 }
520 }
521
522 return undefined;
523}
524
525function getGroupThrowIfNotExists(IDorName: string): GroupOptions {
526 const group = getGroup(IDorName);

Callers 4

getGroupThrowIfNotExistsFunction · 0.85
addGroupFunction · 0.85
changeEntityOptionsFunction · 0.85
changeFriendlyNameFunction · 0.85

Calls 1

getFunction · 0.85

Tested by

no test coverage detected