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

Enable BT5 Long Range #139

Open
Poil opened this issue Mar 28, 2023 · 4 comments
Open

Enable BT5 Long Range #139

Poil opened this issue Mar 28, 2023 · 4 comments

Comments

@Poil
Copy link
Contributor

Poil commented Mar 28, 2023

Hi,

Is it possible to enable BT5 PHY/LE ? I think we have to patch bluetooth_utils.py but I'm not sure ?

It looks like we need to configure the adaptator to

hcitool -i hciX cmd 08 31 03 05 05
# or 
hcitool -i hciX cmd 08 31 03 07 07
< HCI Command: LE Set Default PHY (0x08|0x0031) plen 3                                                                                                                                                                                                                                                   #17 [hci1] 6.052660
        All PHYs preference: 0x03
          No TX PHY preference
          No RX PHY preference
        TX PHYs preference: 0x05
          LE 1M
          LE Coded
        RX PHYs preference: 0x05
          LE 1M
          LE Coded
> HCI Event: Command Complete (0x0e) plen 4                                                                                                                                                                                                                                                              #18 [hci1] 6.053720
      LE Set Default PHY (0x08|0x0031) ncmd 2
        Status: Success (0x00)

ref. custom-components/ble_monitor#1135 & Bluetooth-Devices/bthome-ble#45

Requirements

# cat /etc/systemd/system/bluetooth.service.d/override.conf 
[Service]
Type=dbus
BusName=org.bluez
ExecStart=
ExecStart=/usr/lib/bluetooth/bluetoothd --experimental

# bluetoothd  --version
5.66

Best regards

@JsBergbau
Copy link
Owner

That looks like a systemwide change. I'm not sure whether this should be done at all in MiTemperature2.
What is your goal? Since we are only passive listening, it shouldn't matter whether Bluetooth5 is enabled or not.

@Poil
Copy link
Contributor Author

Poil commented Mar 28, 2023

BT5 is OK, but not I'm unable to find any sensor when I enable Long Range on firmware 4.2 (https://github.com/pvvx/ATC_MiThermometer)
I thank you override some adaptator configuration, but perhaps I'm wrong

@JsBergbau
Copy link
Owner

Thanks for the link. Now I understand.

Raspberry PIs seem not to support BT5 Long range mode https://forums.raspberrypi.com/viewtopic.php?t=244386#p1523836

So the only thing they seem to have done is a new qualification for the latest version, and not actually implemented any of the new optional features such as 2 Mbit/s PHY, Long Range, Extended advertisements etc.

So when trying this with raspberry PI, you won't see the sensors, even with "BT5" enabled.

@Poil
Copy link
Contributor Author

Poil commented Mar 28, 2023

I'm trying on a X86 machine with a BT5.1 USB dongle :)
With btmon I don't see a change that disable PHY/LE mode when running your script, I will try with another BT dongle.
My idea is to remove my 3x Pi Zero W that collect my Misensors to use only the X86 server that centralized the collect today

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

No branches or pull requests

2 participants