mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-08-27 21:20:03 +00:00
Return friendlyNames as answer to get_group_membership (#4210)
* Return friendlyNames as answer to get_group_membership
It would be a lot more useful, if you'd return the friendly names of the groups 😉
* Make the linter happy
* Gracefully echo warning if response is undefined
* Making friendship with the linter
Sorry, really shoud have used an IDE
This commit is contained in:
@@ -29,7 +29,18 @@ class DeviceGroupMembership extends Extension {
|
||||
`genGroups`, 'getMembership', {groupcount: 0, grouplist: []}, {}, true,
|
||||
);
|
||||
|
||||
const {grouplist, capacity} = response;
|
||||
if (!response) {
|
||||
logger.warn(`Couldn't get group membership of ${entity.device.ieeeAddr}`);
|
||||
return;
|
||||
}
|
||||
|
||||
let {grouplist, capacity} = response;
|
||||
|
||||
grouplist = grouplist.map((gid) => {
|
||||
const g = settings.getGroup(gid);
|
||||
return g ? g.friendlyName : gid;
|
||||
});
|
||||
|
||||
const msgGroupList = `${entity.device.ieeeAddr} is in groups [${grouplist}]`;
|
||||
let msgCapacity;
|
||||
if (capacity === 254) {
|
||||
|
||||
Reference in New Issue
Block a user