From a47914c4df0f29a76a0de01f24590bdd86609d33 Mon Sep 17 00:00:00 2001 From: Rob Coleman Date: Sun, 26 Jan 2025 10:14:46 -0800 Subject: [PATCH] Rearrange the conditions to ensure that we have a device --- lib/extension/groups.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/extension/groups.ts b/lib/extension/groups.ts index d3c88644cc..fab9e48ced 100644 --- a/lib/extension/groups.ts +++ b/lib/extension/groups.ts @@ -167,10 +167,11 @@ export default class Groups extends Extension { if (this.state.exists(device)) { const state = this.state.get(device); const endpointNames = device.isDevice() && device.getEndpointNames(); - const stateKey = device.definition.meta && + const stateKey = endpointNames && endpointNames.length >= member.ID && + device.definition.meta && device.definition.meta.multiEndpoint && - (!device.definition.meta.multiEndpointSkip || !device.definition.meta.multiEndpointSkip.includes('state')) && - endpointNames && endpointNames.length >= member.ID ? `state_${endpointNames[member.ID - 1]}` : 'state'; + (!device.definition.meta.multiEndpointSkip || !device.definition.meta.multiEndpointSkip.includes('state')) ? + `state_${endpointNames[member.ID - 1]}` : 'state'; if (state[stateKey] === 'ON' || state[stateKey] === 'OPEN') { return false;