renssies / homebridge-am43-blinds

A homebridge plugin to control the AM43 based blind motors in HomeKit
MIT License
18 stars 6 forks source link

How to change bluetooth adapter to be used #35

Closed womby1 closed 3 years ago

womby1 commented 3 years ago

Hi,

this is related to #34, but to make it easier for others to find this, posting a new issue:

How can I tell this plugin which bluetooth adapter to use? I have purchased one, but don't know how to ensure that the USB bluetooth dongle is actually being used.

Any pointers?

Thanks!

renssies commented 3 years ago

If you plug in the adapter and wait a few seconds you can run the command hciconfig. This should then list 2 devices, hci0 and hci1. hci0 is the built-in Bluetooth if enabled.
If the built-in Bluetooth is disabled the USB adapter would become hci0.

Noble (the Bluetooth package in this plugin) will always use the first adapter, so hci0. You can change this by setting NOBLE_HCI_DEVICE_ID in your environment (So the command NOBLE_HCI_DEVICE_ID=?). Where the value is the number of the adapter. So NOBLE_HCI_DEVICE_ID=1 to use the second adapter HCI1.

However it is best to just disable the built-in Bluetooth when plugging in a USB adapter.

womby1 commented 3 years ago

Thank you for the swift response.

What do you mean by disable the bluetooth adapter? Is there a command for that or do you mean through the GUI?

womby1 commented 3 years ago

Just for following readers: I used this tutorial to switch off the onboard bluetooth: https://www.reddit.com/r/RetroPie/comments/6rc0iw/use_usb_bluetooth_adapter_instead_of_internal/

renssies commented 3 years ago

Disabling the Bluetooth adapter depends on the OS and hardware.

Mac Happens automatically when you plug in a compatible USB adapter

Raspberry Pi 3 with Raspberry Pi OS (Raspbian) Add the following to /boot/config.txt on the system drive (SD card) and reboot the Pi dtoverlay=pi3-disable-bt

Raspberry Pi 4 and possibly newer with Raspberry Pi OS (Raspbian) Add the following to /boot/config.txt on the system drive (SD card) and reboot the Pi dtoverlay=disable-bt

Hoobs If you were able to plug in a USB adapter then you already know the Hoobs device is just a raspberry pi. Check above to see the instructions.

renssies commented 3 years ago

Just for following readers: I used this tutorial to switch off the onboard bluetooth: https://www.reddit.com/r/RetroPie/comments/6rc0iw/use_usb_bluetooth_adapter_instead_of_internal/

Note that this only works on the Raspberry Pi 3 with Raspberry Pi OS and not on other devices

womby1 commented 3 years ago

Thanks - it worked!

gielk commented 3 years ago

@renssies I have 4 curtains, but one is far away and is showing no response way too often. Is it possible to us e 2 different Bluetooth dongles? So I can bring one dongle closer to the other curtain?

renssies commented 2 years ago

I seem to have somehow missed this comment, sorry for that.

Currently it is only possible to use 1 adapter with 1 instance of homebridge-am43-blinds.

You could do it by running multiple instances of Homebridge with different environment variables. The node package PM2 can do this for example. In that case you can use NOBLE_HCI_DEVICE_ID in de environment variables to set the adapter to use for the Homebridge instance.

gielk commented 2 years ago

@renssies Thanks for the reply.