project-chip / matter.js

A complete typescript implementation of the Matter protocol specification (https://buildwithmatter.com). Includes full support for controller, device, commissioning, secure communications, device types, and cluster definitions.
Apache License 2.0
329 stars 57 forks source link

Paired Node looses attribute callbacks on re-subscribing #1121

Closed digitaldan closed 2 weeks ago

digitaldan commented 2 weeks ago

Hi, I noticed that after a few days of running a modified version of the shell app some nodes would send attribute changed messages, but my callbacks were not being called. I tracked this down to this line:

https://github.com/project-chip/matter.js/blob/81c0c32f0c2abf360aceb980189bd7387ef2dfc2/packages/matter.js/src/device/PairedNode.ts#L375-L378

which is subscribing again when it detects a missed subscription event, but is not passing in the callbacks originally setup with the paired node.

I have a PR that fixes this for me and maybe better describes the issue, but feel free to disregard/close it if there is a better solution ;-)

Apollon77 commented 2 weeks ago

Good catch you are right params are missing here. I comment on pr.