diff --git a/lib/controller.ts b/lib/controller.ts index 654d1f57..643651c5 100644 --- a/lib/controller.ts +++ b/lib/controller.ts @@ -276,7 +276,7 @@ class Controller { } } - this.eventBus.emitPublishEntityState({entity, message, stateChangeReason}); + this.eventBus.emitPublishEntityState({entity, message, stateChangeReason, payload}); } async iteratePayloadAttributeOutput(topicRoot: string, payload: KeyValue, options: MQTTOptions): Promise { diff --git a/lib/extension/receive.ts b/lib/extension/receive.ts index 53638214..181db560 100755 --- a/lib/extension/receive.ts +++ b/lib/extension/receive.ts @@ -24,7 +24,7 @@ export default class Receive extends Extension { */ if (data.entity.isDevice() && this.debouncers[data.entity.ieeeAddr] && data.stateChangeReason !== 'publishDebounce' && data.stateChangeReason !== 'lastSeenChanged') { - for (const key of Object.keys(data.message)) { + for (const key of Object.keys(data.payload)) { delete this.debouncers[data.entity.ieeeAddr].payload[key]; } } diff --git a/lib/types/types.d.ts b/lib/types/types.d.ts index 3f25e9be..b5d40a5e 100644 --- a/lib/types/types.d.ts +++ b/lib/types/types.d.ts @@ -145,7 +145,8 @@ declare global { type DeviceLeave = { ieeeAddr: string, name: string }; type GroupMembersChanged = {group: Group, action: 'remove' | 'add' | 'remove_all', endpoint: zh.Endpoint, skipDisableReporting: boolean }; - type PublishEntityState = {entity: Group | Device, message: KeyValue, stateChangeReason: StateChangeReason }; + type PublishEntityState = {entity: Group | Device, message: KeyValue, stateChangeReason: StateChangeReason, + payload: KeyValue}; type DeviceMessage = { type: ZHEvents.MessagePayloadType; device: Device;