-
-
Notifications
You must be signed in to change notification settings - Fork 19
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
Reception of advertising in the "Long Range" mode (Coded PHY S=8) does not work. #45
Comments
I'm afraid I don't have an BT5.2 adapter to test. Is the Bluetooth integration in HA able to receive this data when you enable debug logging? |
Home Assistant does not have a Coded PHY receive option. |
I'm not sure I completely understand the issue. You say:
So, if you make the thermometer send data in "Long Range" mode (Coded PHY S=8)", it isn't received by the BTHome integration in Home Assistant.? So, first thing to figure out, is the Bluetooth integration in HA receiving this data? As I understand from your reaction, it isn't.
So, I think the issue is with the Bluetooth integration then, isn't it? Perhaps @bdraco can help with this? |
USB ID 0bda:8771 Realtek Semiconductor Corp. Bluetooth Radio Example for test in nRFConnect: Do not distinguish random MAC?
It is precisely because of blaming problems on others that Long Range has not worked anywhere since 2016. PS2: How can "Periodic Advertisements" be used if "Unknown" is enabled through an unregulated timeout? |
There is no way to change the PHY type of the adapter during HA runtime. It is required to reboot the entire system, with switching during stop HA. nRFConnect on smartphones accepts both 1M PHY and Coded PHY advertisements on the main BLE channels. And the current implementation of integrations in HA does not know how. The reception of Coded PHY was written in the BLE standards back in 2016... |
I don't blame @bdraco, he has been more than helpful for me with the development of BTHome. But all code for receiving Bluetooth data is being carried out by the Bluetooth integration. The BTHome integration is only using the parsed data from the Bluetooth integration to further parse it into entities. But all the data receiving logic is implemented in the Bluetooth integration in HA. So, to my opinion, you should create an issue in the Home Assistant core github, and label it with the Bluetooth integration. In that way, @bdraco can have a look if it is possible to implement this. It is out of my capabilities to do this, unfortunately. PS2. I'll create a separate issue for the Periodic Advertisements. We had the same issue for some of the Xiaomi sensors, like door sensors. We can implement the same fix for BTHome. |
Home Assistant Bluetooth support is entirely based on bleak so we only support what bleak supports. Работа термометров в Home Assistant c Bluetooth LE Long Range. BTHome->Bluetooth->Bleak->dbus->Bluez->kernel->adapter and in a circle. Everyone points to each other. |
Home Assistant does support reading characteristics. E.g. the xiaomi ble integration supports reading the battery from the plant sensor, which is only possible by reading characteristics. Anyway, @bdraco has made changes and improvement to bleak as well, when he developed the Bluetooth integration. So, if one is able to look into your request, we should ask him. |
About the pointing to each other, that is not what I want. I just try to say that your request is way out of my capabilities. So, unfortunately I can’t help with this, just because of my lack of experience. |
BTHome->Bluetooth->Bleak->dbus->Bluez->kernel->adapter and in a circle. Everyone points to each other. Bluetooth->Bleak->dbus->Bluez>kernel - This chain will not work with BT5.0 for years. |
I understand, but that is still way out of my capabilities. And I think the HA devs probably like a solution that works for every Bluetooth integration. Again, you should ask @bdraco, he can help thinking about a possible solution. I’ll ask him on discord if he is willing to have a look here. |
To date, switching is only relevant for BTHome for DIY sensors. Or wait years for Linux to start initializing BT adapters in normal mode, and not BT4.0?
Maybe ask Linus Torvalds? :) PS: Then I make a decision: "LE Long Range" will be banned for english-speaking audiences on Linux for years to come. |
😄 Ok, I understand, only BTHome for now. But again, Its out of my capabilities. Its not that im not willing, but I know my limitation with regards to programming. And this is too difficult for me unfortunately. |
"Home Assistant" will never use Bluetooth 5.0 and above. Asking them about it is useless. The documentation for Home Assistant does not show that Bluetooth 5.0 is not supported. The first part related to blocking the driver while receiving BLE ads has been patched. But not in all utilities. PS: BLE in Linux is dead. |
@pvvx please, correct me if I am wrong, but isn't the DBUS interface from bluez the missing link at the moment so that bleak, and eventually HA bluetooth integration and BTHome to support this feature? I'm not too familiar with Bluez, but it seems to me that the management API is there, but not exposed to the DBUS Adapter API in any way. |
Начало завязки лежит в kernel. Там свои тараканы у подписывающих патчи и принимавших решения по развитию. И у них лицензия GNU - т.е. с авторскими правами. Т.е. что хотят, то и творят - могут принять ваши коды и поправки под своё авторство, а могут не не принять. Пока, с 2016 года, принимали только отрицательные решения по BLE от кентов из Intel, чтобы развития BLE в Linux не происходило. В итоге Google нарвалось и не может это сдвинуть уже несколько лет. The beginning of the tie lies in the kernel. They have their own cockroaches signing patches and making decisions on development. And they have a GNU license - that is, with copyrights. That is, they do what they want - they can accept your codes and amendments under their authorship, or they cannot not accept. So far, since 2016, only negative decisions have been made on BLUE from Intel's kents, so that the development of BLE in Linux does not occur. As a result, Google has faced this and has not been able to provide BLE 5.0 support to all users in its APIs for several years. Bluez does not have "primary PHY" parameters in API requests. Rebuilding of all queries is required. Bleak works via DBUS. Drivers - ok since 2016. |
Web Bluetooth API: Implementation Status :) For today, BT 5.0 support is available only in Android and Mac via the internal API. The Android WEB bluetooth API lacks support for scanning BT5.0+ formats. But, if the Chrome scan list has an entry of a MAC device with BT 5.0 and higher, then the connection is provided with any PHY and formats. Not on Linux. To date, to connect to a device in version 4.2 according to the specification, you will need to change a lot of settings in Bluez. Or fix the kernel. Bluez utilities do not support new API branches in Bluez. And new branches arose due to the lack of support in the old versions of the BT 5.0. But the BT4.2 specification does not work either. The problem with timeouts.
|
The BT5.2 adapter supports "Extended Advertising" reception.
Reception of advertising in the "Long Range" mode (Coded PHY S=8) does not work in BTHome-ble.
The test version of the "Long Range" thermometer is successfully received in nRF Connect:

And connects successfully:

The text was updated successfully, but these errors were encountered: