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

Not working when daemonized on macOS Big Sur #23

Closed
virtualxdriver opened this issue Nov 20, 2020 · 4 comments
Closed

Not working when daemonized on macOS Big Sur #23

virtualxdriver opened this issue Nov 20, 2020 · 4 comments
Labels
bug Something isn't working

Comments

@virtualxdriver
Copy link

Similar to abandonware/noble#143 (comment)

The plugin is unable to communicate with SwitchBot devices when run as a daemon (via hb-service).

[11/20/2020, 11:54:48 AM] [Bot] Failed to discover WoHand (C0:51:13:D6:C2:9C). Is Bluetooth enabled?
[11/20/2020, 11:54:48 AM] [Bot] Error: Failed to initialize the Noble object: resetting
    at Noble.<anonymous> (/opt/homebrew/lib/node_modules/homebridge-switchbot-for-mac/node_modules/node-switchbot/lib/switchbot.js:171:25)
    at Object.onceWrapper (node:events:436:26)
    at Noble.emit (node:events:341:22)
    at Noble.onStateChange (/opt/homebrew/lib/node_modules/homebridge-switchbot-for-mac/node_modules/@abandonware/noble/lib/noble.js:87:8)
    at NobleMac.emit (node:events:329:20)

The plugin is able to communicate with SwitchBot devices when run directly in a terminal with sudo homebridge (at which point the user gets prompted to grant Bluetooth access to the Terminal app).

@virtualxdriver
Copy link
Author

virtualxdriver commented Nov 20, 2020

Figured it out. I had to manually grant Bluetooth access in Settings > Privacy to the node executable after following symlinks, then restart the homebridge service with sudo hb-service restart.

The symlink part is important. If you installed node via homebrew, you cannot grant Bluetooth privileges to /opt/homebrew/bin/node, but have to target /opt/homebrew/Cellar/node/15.2.1/bin/node explicitly.
If done correctly, the plugin will discover the bots correctly after a restart, and the configuration will persist on reboots.

@zizi4n5 zizi4n5 added the bug Something isn't working label Nov 20, 2020
@zizi4n5
Copy link
Owner

zizi4n5 commented Nov 21, 2020

@virtualxdriver
Thank you.
I didn't know how to deal with the problem that doesn't work in Big Sur, so this Issue is very good information and helpful.
I will include this information in the README.

@zizi4n5
Copy link
Owner

zizi4n5 commented Nov 21, 2020

I will include this information in the README.

Added the following.
https://github.com/zizi4n5/homebridge-switchbot-for-mac#big-sur

@virtualxdriver
Copy link
Author

Awesome, thanks a lot for the support! Keep up the good work, this plugin is great! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants