diff --git a/lib/extension/publish.js b/lib/extension/publish.js index 985b6b83a..eab5a86e1 100644 --- a/lib/extension/publish.js +++ b/lib/extension/publish.js @@ -223,8 +223,10 @@ class EntityPublish extends Extension { if (topic.type === 'set' && converter.convertSet) { logger.debug(`Publishing '${topic.type}' '${key}' to '${resolvedEntity.name}'`); const result = await converter.convertSet(actualTarget, key, value, meta); - const optimistic = !options.hasOwnProperty('optimistic') || options.optimistic; - if (result && result.state && optimistic) { + const isGroup = actualTarget.constructor.name == 'Group'; + // Optimistic behaviour of groups and devices is different. + const publishOptimistic = isGroup || (!options.hasOwnProperty('optimistic') || options.optimistic); + if (result && result.state && publishOptimistic) { const msg = result.state; if (endpointName) { @@ -239,7 +241,7 @@ class EntityPublish extends Extension { this.publishEntityState(resolvedEntity.settings.ID, msg); } - if (result && result.membersState && optimistic) { + if (result && result.membersState && publishOptimistic) { for (const [ieeeAddr, state] of Object.entries(result.membersState)) { this.publishEntityState(ieeeAddr, state); }