operating-system
operating-system copied to clipboard
Only the first click from a Shelly BLU Button is recognised
Describe the issue you are experiencing
After a Shelly BLU button is automatically paired with the BTHome integration, only the first button click is recognised by Home Assistant. After a period of around two minutes, the HA Bluetooth discovery process restarts and the next button click from the BLU button is successfully recognised but subsequent clicks are not. This cycle continues.
Tests with the Shelly BLE and nRF Connect apps confirm that the BLU button is sending valid Bluetooth messages on EACH click.
The issue has been reported with HA running on Intel NUC and Raspberry PI 4 platforms.
The issue was not resolved with OS 10.3 (which included a Bluetooth bug fix).
This issue has already been reported by several HA users on the Home Assistant Core issue tracker where it was concluded that the issue would be best progressed on the HA OS repository. See https://github.com/home-assistant/core/issues/93502
An HA log including Bluetooth integration debug messages is included below. The messages in bold highlight the discovery restart and Shelly BLU button click events. Note that subsequent BLU button clicks do not appear in log.
2023-06-20 13:31:55.993 INFO (MainThread) [homeassistant.components.bluetooth.scanner] hci0 (F8:9E:94:DE:17:18): Bluetooth scanner has gone quiet for 90s, restarting 2023-06-20 13:31:55.993 DEBUG (MainThread) [homeassistant.components.bluetooth.scanner] hci0 (F8:9E:94:DE:17:18): Stopping bluetooth discovery 2023-06-20 13:31:55.997 DEBUG (MainThread) [homeassistant.components.bluetooth.scanner] hci0 (F8:9E:94:DE:17:18): Starting bluetooth discovery attempt: (1/3) 2023-06-20 13:31:56.002 DEBUG (MainThread) [bleak_retry_connector] Restored 0 discoveries for hci0 2023-06-20 13:31:56.640 DEBUG (MainThread) [homeassistant.components.bluetooth.manager] hci0 (F8:9E:94:DE:17:18) [connectable]: 78:3C:6B:D1:30:37 AdvertisementData(manufacturer_data={76: b'\x10\x06(\x1a\x81\xd7\xe7\xef'}, tx_power=7, rssi=-89) match: set() 2023-06-20 13:32:23.216 DEBUG (MainThread) [homeassistant.components.bluetooth.manager] hci0 (F8:9E:94:DE:17:18) [connectable]: BC:02:6E:C3:C1:C7 AdvertisementData(service_data={'0000fcd2-0000-1000-8000-00805f9b34fb': b'D\x00z\x01d:\x01'}, rssi=-53) match: set() 2023-06-20 13:32:25.993 DEBUG (MainThread) [homeassistant.components.bluetooth.base_scanner] hci0 (F8:9E:94:DE:17:18): Scanner watchdog time_since_last_detection: 2.77696441700391 2023-06-20 13:32:55.994 DEBUG (MainThread) [homeassistant.components.bluetooth.base_scanner] hci0 (F8:9E:94:DE:17:18): Scanner watchdog time_since_last_detection: 32.77757998199377 2023-06-20 13:33:25.996 DEBUG (MainThread) [homeassistant.components.bluetooth.base_scanner] hci0 (F8:9E:94:DE:17:18): Scanner watchdog time_since_last_detection: 62.77919558400754 2023-06-20 13:33:55.998 DEBUG (MainThread) [homeassistant.components.bluetooth.base_scanner] hci0 (F8:9E:94:DE:17:18): Scanner watchdog time_since_last_detection: 92.78181113800383 2023-06-20 13:33:55.999 INFO (MainThread) [homeassistant.components.bluetooth.scanner] hci0 (F8:9E:94:DE:17:18): Bluetooth scanner has gone quiet for 90s, restarting 2023-06-20 13:33:55.999 DEBUG (MainThread) [homeassistant.components.bluetooth.scanner] hci0 (F8:9E:94:DE:17:18): Stopping bluetooth discovery 2023-06-20 13:33:56.002 DEBUG (MainThread) [homeassistant.components.bluetooth.scanner] hci0 (F8:9E:94:DE:17:18): Starting bluetooth discovery attempt: (1/3) 2023-06-20 13:33:56.005 DEBUG (MainThread) [bleak_retry_connector] Restored 0 discoveries for hci0 2023-06-20 13:33:56.325 DEBUG (MainThread) [homeassistant.components.bluetooth.manager] hci0 (F8:9E:94:DE:17:18) [connectable]: AC:BC:32:74:70:8F AdvertisementData(manufacturer_data={76: b'\x10\x05\x01\x10e\x0eW'}, tx_power=12, rssi=-76) match: set() 2023-06-20 13:33:56.514 DEBUG (MainThread) [homeassistant.components.bluetooth.manager] hci0 (F8:9E:94:DE:17:18) [connectable]: 78:3C:6B:D1:30:37 AdvertisementData(manufacturer_data={76: b'\x10\x06(\x1a\x81\xd7\xe7\xef'}, tx_power=7, rssi=-86) match: set() 2023-06-20 13:34:10.481 DEBUG (MainThread) [homeassistant.components.bluetooth.manager] hci0 (F8:9E:94:DE:17:18) [connectable]: BC:02:6E:C3:C1:C7 AdvertisementData(service_data={'0000fcd2-0000-1000-8000-00805f9b34fb': b'D\x00|\x01d:\x01'}, rssi=-45) match: set()
What operating system image do you use?
generic-x86-64 (Generic UEFI capable x86-64 systems)
What version of Home Assistant Operating System is installed?
10.3
Did you upgrade the Operating System.
Yes
Steps to reproduce the issue
- Pair Shelly BLU button with BTHome integration
- Setup test automation using BLU button single-click as trigger
- Click BLU button and confirm automation triggered
- Click button again - automation will not be triggered ... 2023-06-20 13:31:55.993 INFO (MainThread) [homeassistant.components.bluetooth.scanner] hci0 (F8:9E:94:DE:17:18): Bluetooth scanner has gone quiet for 90s, restarting 2023-06-20 13:31:55.993 DEBUG (MainThread) [homeassistant.components.bluetooth.scanner] hci0 (F8:9E:94:DE:17:18): Stopping bluetooth discovery 2023-06-20 13:31:55.997 DEBUG (MainThread) [homeassistant.components.bluetooth.scanner] hci0 (F8:9E:94:DE:17:18): Starting bluetooth discovery attempt: (1/3) 2023-06-20 13:31:56.002 DEBUG (MainThread) [bleak_retry_connector] Restored 0 discoveries for hci0 2023-06-20 13:31:56.640 DEBUG (MainThread) [homeassistant.components.bluetooth.manager] hci0 (F8:9E:94:DE:17:18) [connectable]: 78:3C:6B:D1:30:37 AdvertisementData(manufacturer_data={76: b'\x10\x06(\x1a\x81\xd7\xe7\xef'}, tx_power=7, rssi=-89) match: set() 2023-06-20 13:32:23.216 DEBUG (MainThread) [homeassistant.components.bluetooth.manager] hci0 (F8:9E:94:DE:17:18) [connectable]: BC:02:6E:C3:C1:C7 AdvertisementData(service_data={'0000fcd2-0000-1000-8000-00805f9b34fb': b'D\x00z\x01d:\x01'}, rssi=-53) match: set() 2023-06-20 13:32:25.993 DEBUG (MainThread) [homeassistant.components.bluetooth.base_scanner] hci0 (F8:9E:94:DE:17:18): Scanner watchdog time_since_last_detection: 2.77696441700391 2023-06-20 13:32:55.994 DEBUG (MainThread) [homeassistant.components.bluetooth.base_scanner] hci0 (F8:9E:94:DE:17:18): Scanner watchdog time_since_last_detection: 32.77757998199377 2023-06-20 13:33:25.996 DEBUG (MainThread) [homeassistant.components.bluetooth.base_scanner] hci0 (F8:9E:94:DE:17:18): Scanner watchdog time_since_last_detection: 62.77919558400754 2023-06-20 13:33:55.998 DEBUG (MainThread) [homeassistant.components.bluetooth.base_scanner] hci0 (F8:9E:94:DE:17:18): Scanner watchdog time_since_last_detection: 92.78181113800383 2023-06-20 13:33:55.999 INFO (MainThread) [homeassistant.components.bluetooth.scanner] hci0 (F8:9E:94:DE:17:18): Bluetooth scanner has gone quiet for 90s, restarting 2023-06-20 13:33:55.999 DEBUG (MainThread) [homeassistant.components.bluetooth.scanner] hci0 (F8:9E:94:DE:17:18): Stopping bluetooth discovery 2023-06-20 13:33:56.002 DEBUG (MainThread) [homeassistant.components.bluetooth.scanner] hci0 (F8:9E:94:DE:17:18): Starting bluetooth discovery attempt: (1/3) 2023-06-20 13:33:56.005 DEBUG (MainThread) [bleak_retry_connector] Restored 0 discoveries for hci0 2023-06-20 13:33:56.325 DEBUG (MainThread) [homeassistant.components.bluetooth.manager] hci0 (F8:9E:94:DE:17:18) [connectable]: AC:BC:32:74:70:8F AdvertisementData(manufacturer_data={76: b'\x10\x05\x01\x10e\x0eW'}, tx_power=12, rssi=-76) match: set() 2023-06-20 13:33:56.514 DEBUG (MainThread) [homeassistant.components.bluetooth.manager] hci0 (F8:9E:94:DE:17:18) [connectable]: 78:3C:6B:D1:30:37 AdvertisementData(manufacturer_data={76: b'\x10\x06(\x1a\x81\xd7\xe7\xef'}, tx_power=7, rssi=-86) match: set() 2023-06-20 13:34:10.481 DEBUG (MainThread) [homeassistant.components.bluetooth.manager] hci0 (F8:9E:94:DE:17:18) [connectable]: BC:02:6E:C3:C1:C7 AdvertisementData(service_data={'0000fcd2-0000-1000-8000-00805f9b34fb': b'D\x00|\x01d:\x01'}, rssi=-45) match: set()
Anything in the Supervisor logs that might be useful for us?
No
Anything in the Host logs that might be useful for us?
No
System information
System Information
version | core-2023.6.2 |
---|---|
installation_type | Home Assistant OS |
dev | false |
hassio | true |
docker | true |
user | root |
virtualenv | false |
python_version | 3.11.4 |
os_name | Linux |
os_version | 6.1.34 |
arch | x86_64 |
timezone | Europe/London |
config_dir | /config |
Home Assistant Community Store
GitHub API | ok |
---|---|
GitHub Content | ok |
GitHub Web | ok |
GitHub API Calls Remaining | 5000 |
Installed Version | 1.32.1 |
Stage | running |
Available Repositories | 1277 |
Downloaded Repositories | 10 |
Home Assistant Cloud
logged_in | false |
---|---|
can_reach_cert_server | ok |
can_reach_cloud_auth | ok |
can_reach_cloud | ok |
Home Assistant Supervisor
host_os | Home Assistant OS 10.3 |
---|---|
update_channel | stable |
supervisor_version | supervisor-2023.06.2 |
agent_version | 1.5.1 |
docker_version | 23.0.6 |
disk_total | 234.0 GB |
disk_used | 6.8 GB |
healthy | true |
supported | true |
board | generic-x86-64 |
supervisor_api | ok |
version_api | ok |
installed_addons | Matter Server (4.6.1), File editor (5.6.0), Terminal & SSH (9.7.1), Home Assistant Google Drive Backup (0.111.1), Log Viewer (0.15.1) |
Additional information
No response
Did you test this on earlier OS versions? Since 10.x introduced quite some Bluetooth problems, it would be interesting to know if this worked with HAOS 9.5. You can downgrade using ha os update --version 9.5
.
From https://github.com/home-assistant/core/issues/93502#issuecomment-1598879673 it sounds like this is a general problem with Linux/BlueZ.
Not yet. I wasn't sure how easy it would be to move back to 10.3 afterward. If I do a full HA backup first and downgrade to 9.5, can I then get back to 10.3 by restoring from my backup?
@pricei Generally you don't even need to create and restore backup when moving between OS versions - the OS is not very coupled with the configuration and you shouldn't encounter any major issues. But it's a good idea to have the backup if you want to stay on the safe side.
The bad news is I am not able to replicate the issue with BLU Button on my NUC. I had a chance to check it on HA running on RPi 4 today and every ~2nd advertisement was lost, both on 9.5 and 10.3, so it looks like a different issue than what we saw with LE packets in general, but I am curious what it would be on Ian's setup.
@sairon Thanks for answering my question. @agners Some progress - I downgraded to OS 9.5 and every BLU button click is now recognised. The log extract below shows six single clicks recorded over a 40-second period. Does this help to identify the problem?
2023-06-25 17:20:12.536 DEBUG (MainThread) [homeassistant.components.bluetooth] Rediscovered adapters: {'hci0': {'address': 'F8:9E:94:DE:17:18', 'sw_version': 'homeassistant', 'hw_version': 'usb:v1D6Bp0246d053F', 'passive_scan': True, 'manufacturer': 'Intel Corporate', 'product': '0aaa', 'vendor_id': '8087', 'product_id': '0aaa'}} 2023-06-25 17:20:18.612 DEBUG (MainThread) [homeassistant.components.bluetooth.base_scanner] hci0 (F8:9E:94:DE:17:18): Scanner watchdog time_since_last_detection: 1.3689913529999842 2023-06-25 17:20:48.612 DEBUG (MainThread) [homeassistant.components.bluetooth.base_scanner] hci0 (F8:9E:94:DE:17:18): Scanner watchdog time_since_last_detection: 0.5329976579999993 2023-06-25 17:21:18.614 DEBUG (MainThread) [homeassistant.components.bluetooth.base_scanner] hci0 (F8:9E:94:DE:17:18): Scanner watchdog time_since_last_detection: 0.5359980400000097 2023-06-25 17:21:18.877 DEBUG (MainThread) [homeassistant.components.bluetooth.manager] hci0 (F8:9E:94:DE:17:18) [connectable]: BC:02:6E:C3:C1:C7 AdvertisementData(service_data={'0000fcd2-0000-1000-8000-00805f9b34fb': b'D\x00\x1c\x01d:\x01'}, rssi=-90) match: {'bthome'} 2023-06-25 17:21:24.332 DEBUG (MainThread) [homeassistant.components.bluetooth.manager] hci0 (F8:9E:94:DE:17:18) [connectable]: BC:02:6E:C3:C1:C7 AdvertisementData(service_data={'0000fcd2-0000-1000-8000-00805f9b34fb': b'D\x00\x1d\x01d:\x01'}, rssi=-89) match: set() 2023-06-25 17:21:34.892 DEBUG (MainThread) [homeassistant.components.bluetooth.manager] hci0 (F8:9E:94:DE:17:18) [connectable]: BC:02:6E:C3:C1:C7 AdvertisementData(service_data={'0000fcd2-0000-1000-8000-00805f9b34fb': b'D\x00\x1e\x01d:\x01'}, rssi=-89) match: set() 2023-06-25 17:21:40.999 DEBUG (MainThread) [homeassistant.components.bluetooth.manager] hci0 (F8:9E:94:DE:17:18) [connectable]: BC:02:6E:C3:C1:C7 AdvertisementData(service_data={'0000fcd2-0000-1000-8000-00805f9b34fb': b'D\x00\x1f\x01d:\x01'}, rssi=-89) match: set() 2023-06-25 17:21:48.615 DEBUG (MainThread) [homeassistant.components.bluetooth.base_scanner] hci0 (F8:9E:94:DE:17:18): Scanner watchdog time_since_last_detection: 1.3779756689999942 2023-06-25 17:21:58.068 DEBUG (MainThread) [homeassistant.components.bluetooth.manager] hci0 (F8:9E:94:DE:17:18) [connectable]: BC:02:6E:C3:C1:C7 AdvertisementData(service_data={'0000fcd2-0000-1000-8000-00805f9b34fb': b'D\x00 \x01d:\x01'}, rssi=-96) match: set() 2023-06-25 17:22:01.356 DEBUG (MainThread) [homeassistant.components.bluetooth.manager] hci0 (F8:9E:94:DE:17:18) [connectable]: BC:02:6E:C3:C1:C7 AdvertisementData(service_data={'0000fcd2-0000-1000-8000-00805f9b34fb': b'D\x00!\x01d:\x01'}, rssi=-85) match: set()
@agners @sairon I just noticed this issue hasn't been assigned to anybody yet. As I'm new to HA, can one of you advise whether I need to do anything further or is assignment an automated process? Thanks.
Having a similar issue with Shelly BLU door/window, it seems it is not the same since downgrading the OS doesn't change the behaviour: two events (open, close) cannot happen faster than some 8 seconds.
Using a Shelly plus device as BT proxy performs as expected.
Having a similar issue with Shelly BLU door/window, it seems it is not the same since downgrading the OS doesn't change the behaviour: two events (open, close) cannot happen faster than some 8 seconds.
Interesting. Downgrading to OS 9.5 definitely eliminated the problem for me. I tried installing the OS 10.5 update that was released yesterday and the problem of missed clicks returned. I note this bug report still hasn't been assigned to anybody.
This issue still exists on version 2023.9.3 - and that makes sense because it looks like no one's working on this! Is this even a HA issue or is it due to issues in some library/package that HA depends on?
For anyone having this problem, could you please check if the problem goes away when you enable "Passive scans" option in the Bluetooth adapter configuration? I did some tests and I can easily reproduce the behavior on RPi4 with the integrated Bluetooth. The problem seems to go away with an external CSR8510 adapter or with disabled active scans - so these two options could serve as a potential workaround.
Later we could take a deeper look if it's something that can be remedied in the OS, Core, or rather if it's a HW limitation that should go to the errata in Bluetooth docs.
@sairon I just checked my HA configuraton (Intel NUC with internal BT adapter) and the 'Passive scanning' option in my Bluetooth integration was already enabled. With this configuration, only the first Shelly button click is recognised (until the Bluetooth discovery process restarts) as I previously reported.
Now for the interesting part. I wasn't aware of the passive scanning option before and I was curious to see what might happen if I disabled this option. Once disabled, all Shelly button clicks are now recognised!
@pricei That's quite interesting indeed. Sorry if I missed that information somewhere, but can you please also share the details about what kind of install are you using (I reckon it's bare-metal HAOS?) and what BT adapter your NUC has? E.g. from the output of lsusb
?
@sairon You're correct, it is HAOS: Home Assistant 2023.9.3 Supervisor 2023.09.2 Operating System 10.5 Frontend 20230911.0 - latest
Sorry, is 'lsusb' a command I enter into a terminal window? If so, I get this output: Bus 001 Device 001: ID 1d6b:0002 Bus 001 Device 003: ID 8087:0aaa Bus 002 Device 001: ID 1d6b:0003 Bus 001 Device 002: ID 10c4:ea60
For anyone having this problem, could you please check if the problem goes away when you enable "Passive scans" option in the Bluetooth adapter configuration? I did some tests and I can easily reproduce the behavior on RPi4 with the integrated Bluetooth. The problem seems to go away with an external CSR8510 adapter or with disabled active scans - so these two options could serve as a potential workaround.
Hey, I don't see any option explicitly called "Passive Scans", but I see this option called "Enable polling for Updates" which sounds like Active scanning. Should I disable this? - would that switch on Passive mode?
I have the same problem as described by everyone above and I'm using the built in Raspberry Pi 4 bluetooth adapter.
@FeignMan That's something different - you must click on the "Configure" link left from the three dots in the Bluetooth integration (this link should redirect you there).
@sairon I just checked my HA configuraton (Intel NUC with internal BT adapter) and the 'Passive scanning' option in my Bluetooth integration was already enabled. With this configuration, only the first Shelly button click is recognised (until the Bluetooth discovery process restarts) as I previously reported.
Now for the interesting part. I wasn't aware of the passive scanning option before and I was curious to see what might happen if I disabled this option. Once disabled, all Shelly button clicks are now recognised!
Here the same, it works after I have turned off the option passive scanning.
There hasn't been any activity on this issue recently. To keep our backlog manageable we have to clean old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant OS version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.