Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Improve debug log in BLE connection #1128

Merged

Conversation

Loodyy
Copy link

@Loodyy Loodyy commented Dec 3, 2024

♻️ Current situation

I have a slight problem with the log of the connectBLE function (in platform.ts). The this.switchBotBLE object is wrapped in a template literal in JS, so the output of that log is [object Object].

image

💡 Proposed solution

Wrap the this.switchBotBLE object in 'JSON.stringify' to inspect it in more detail

- Wrap the switchBotBLE object in "JSON.stringify" to inspect it in more detail
@github-actions github-actions bot added enhancement New feature or request latest labels Dec 3, 2024
@Loodyy Loodyy force-pushed the fix/ble-connection-debug-log branch from fda66f8 to 9a2c95f Compare December 3, 2024 18:11
@donavanbecker donavanbecker changed the base branch from latest to beta-4.1.6 December 3, 2024 22:39
@donavanbecker donavanbecker merged commit 4525694 into OpenWonderLabs:beta-4.1.6 Dec 3, 2024
1 check passed
@github-actions github-actions bot added the beta label Dec 3, 2024
@donavanbecker
Copy link
Collaborator

This change, causes this issue:
image

@Loodyy
Copy link
Author

Loodyy commented Dec 4, 2024

@donavanbecker
The class this.switchBotBLE is too big, so when stringifying it, a circular reference occurs. To work around this, you can log only the necessary information in the log, such as ${device.deviceType}: ${accessory.displayName} 'node-switchbot' found! or using a stringify library that prevents circular references. Which one looks better?

@donavanbecker
Copy link
Collaborator

I already fixed doing it a different way. If you look at the last commit in the beta branch.

@Loodyy
Copy link
Author

Loodyy commented Dec 4, 2024

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta enhancement New feature or request latest
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants