Closed Sorien closed 8 months ago
Hey there @bdraco, mind taking a look at this issue as it has been labeled with an integration (bluetooth
) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)
bluetooth documentation bluetooth source (message by IssueLinks)
Hey there @ernst79, mind taking a look at this issue as it has been labeled with an integration (bthome
) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)
bthome documentation bthome source (message by IssueLinks)
I see you use the ATC firmware on a Xiaomi temperature sensor. In the telink flasher, did you enable the option “send flags” (or something similar). If not, try to enable it.
@Ernst79 it seems to be working, what is that setting? why your addon does not need that? because I have the same problem with iBeacon.
It adds 020106
to the BLE advertisement, which is a Bluetooth advertising data type flag, telling the receiver what type of data it is.
06
sets the following two types to True
BLE_SIG_ADV_FLAG_LE_GENERAL_DISC_MODE (0x02)
BLE_SIG_ADV_FLAG_BR_EDR_NOT_SUPPORTED (0x04)
see also https://docs.particle.io/reference/device-os/api/bluetooth-le-ble/bleadvertisingdatatype-flags/
Most sensors, like Xiaomi, govee and qingping add this data by default. In the ATC firmware, it is disabled by default.
BLE monitor receives the data by collecting raw HCI data, while BTHome uses the Bluetooth integration, which is using some other package to collect the BLE data (bleak
if I remember correct). I guess bleak
requires this flag to be send.
I think it would be good to add this to the documentation, you’re not the first :-). I’ll do that later.
@Ernst79 thx for your help, I really appreciate it
I see that incorrect filtering was added when passive_scanning was introduced https://github.com/home-assistant/core/pull/75542/files#diff-1ce9248554a06c6b1190695bcc9148652a910e6750649c8933a0e75069bc2f80R48
but this file seems to not exist in the current version of the source code.
iBeacom integration seems to have a problem in passive mode because Android will never send that part of the packet and there is no API to force it.
Code is still there but its moved to https://github.com/Bluetooth-Devices/habluetooth/blob/71bd22a4bea50fff5ff9b8661b4c19814a512331/src/habluetooth/scanner.py#L40
Those flags originate from https://github.com/hbldh/bleak/pull/884
We can adjust them, but bluez requires at least one orpattern to work
I'll try to make it working locally and after that will open PR with proposed change
@bdraco @Ernst79 maybe you could have look at it https://github.com/Bluetooth-Devices/habluetooth/pull/31
We can adjust them, but bluez requires at least one orpattern to work
I saw that issue from bleak autors in BlueZ repo but after commenting code that requires to have min one pattern set, I was still able to receive packet data but just only from devices that have advertising flags set.
The problem
when I activate passive mode for Bluetooth adapter bthome devices are not updating, even though I see them updating in Passive BLE monitor connected to different adapter, i've tied to switch adapters, even disable second adapter, Passive BLE monitor and so on, so its not adapter problem, its something wrong in BTHome implementation
What version of Home Assistant Core has the issue?
core-2024.2.2
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant Container
Integration causing the issue
Bluetooth
Link to integration documentation on our website
No response
Diagnostics information
i see them in bluetooth logs when loging is enabled
AdvertisementData(local_name='ATC_AC55D1', service_data={'0000fcd2-0000-1000-8000-00805f9b34fb': b'@\x00\x9e\x01d\x02\x83\x08\x03\x11\x13'}, rssi=-71) match: set() 2024-02-25 10:33:07.735 DEBUG (MainThread) [homeassistant.components.bluetooth.manager] hci1 (C8:8A:9A:5F:1B:16) [connectable]: A4:C1:38:51:BC:CA AdvertisementData(local_name='ATC_51BCCA', service_data={'0000fcd2-0000-1000-8000-00805f9b34fb': b'@\x00I\x01\x19\x02*\x08\x03\x89\x13'}, rssi=-76) match: set() 2024-02-25 10:33:08.502 DEBUG (MainThread) [homeassistant.components.bluetooth.manager] hci1 (C8:8A:9A:5F:1B:16) [connectable]: 58:2D:34:60:BC:D9
Example YAML snippet
No response
Anything in the logs that might be useful for us?
Additional information
Passive BLE: 12.9.0 Linux kernel: 6.6.17 Bluez: 5.68