Skip to content

Fix memory leaks in motion and contact sensor drivers#679

Open
brakedalen wants to merge 1 commit into
JohanBendz:sdk3from
brakedalen:sdk3
Open

Fix memory leaks in motion and contact sensor drivers#679
brakedalen wants to merge 1 commit into
JohanBendz:sdk3from
brakedalen:sdk3

Conversation

@brakedalen

Copy link
Copy Markdown
  • Add onUninit() lifecycle methods to clean up event listeners
  • Prevent duplicate listener registration on device reconnect
  • Store bound listener references for proper cleanup
  • Clear timeouts (suppressTimeout, _motionAlarmTimeout) on uninit
  • Use this.homey.setTimeout() for automatic cleanup on app shutdown
  • Add .catch(this.error) to prevent unhandled promise rejections
  • Bump version to 2.1.1

Affected drivers:

  • SML001-occupancy (indoor motion sensor)
  • SML002-occupancy (outdoor motion sensor)
  • SML001 (indoor motion sensor - timed)
  • SML002 (outdoor motion sensor - timed)
  • SOC001 (contact sensor)

Fixes #615, #672

🤖 Generated with Claude Code

- Add onUninit() lifecycle methods to clean up event listeners
- Prevent duplicate listener registration on device reconnect
- Store bound listener references for proper cleanup
- Clear timeouts (suppressTimeout, _motionAlarmTimeout) on uninit
- Use this.homey.setTimeout() for automatic cleanup on app shutdown
- Add .catch(this.error) to prevent unhandled promise rejections
- Bump version to 2.1.1

Affected drivers:
- SML001-occupancy (indoor motion sensor)
- SML002-occupancy (outdoor motion sensor)
- SML001 (indoor motion sensor - timed)
- SML002 (outdoor motion sensor - timed)
- SOC001 (contact sensor)

Fixes JohanBendz#615, JohanBendz#672

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@brakedalen

Copy link
Copy Markdown
Author

I'm testing this build now, to see if it helps to solve the issue. Will report back here after a few days to let you know the results. Looks good after 1 hour of testing 👍

@brakedalen

brakedalen commented Jan 18, 2026

Copy link
Copy Markdown
Author

It appears that this helped, but it didn't fully resolve the issue. I’ve gone back to the bridge app since I need my lights to operate reliably. I hope you can still make use of the work I’ve done @JohanBendz 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Phillip Hue motion detector disconnect from zigbee network

1 participant